2013-07-10 12:02:48 +02:00
|
|
|
node-GameDig - Game Server Query Library
|
2014-02-01 09:39:06 +01:00
|
|
|
---
|
2014-02-02 03:10:52 +01:00
|
|
|
node-GameDig is a game server library, capable of querying for the status of
|
|
|
|
nearly any game server. If has a node.js api, as well as a command line interface.
|
2013-07-10 12:02:48 +02:00
|
|
|
|
2014-01-31 23:27:52 +01:00
|
|
|
Usage from Node.js
|
2013-07-10 12:02:48 +02:00
|
|
|
---
|
|
|
|
|
2013-07-11 11:25:49 +02:00
|
|
|
```shell
|
2013-07-10 14:23:18 +02:00
|
|
|
npm install gamedig
|
|
|
|
```
|
|
|
|
|
2013-07-10 12:02:48 +02:00
|
|
|
```javascript
|
|
|
|
var Gamedig = require('gamedig');
|
2013-07-10 14:23:18 +02:00
|
|
|
Gamedig.query(
|
|
|
|
{
|
|
|
|
type: 'minecraft',
|
|
|
|
host: 'mc.example.com'
|
|
|
|
},
|
|
|
|
function(state) {
|
2013-07-10 12:02:48 +02:00
|
|
|
if(state.error) console.log("Server is offline");
|
|
|
|
else console.log(state);
|
|
|
|
}
|
2013-07-10 14:23:18 +02:00
|
|
|
);
|
2013-07-10 12:02:48 +02:00
|
|
|
```
|
|
|
|
|
2013-07-12 11:18:55 +02:00
|
|
|
### Input Parameters
|
|
|
|
|
2014-01-31 23:27:52 +01:00
|
|
|
* **type**: One of the game IDs listed in the game list below
|
2013-07-12 11:18:55 +02:00
|
|
|
* **host**
|
2013-07-12 11:20:17 +02:00
|
|
|
* **port**: (optional) Uses the protocol default if not set
|
2013-07-12 11:23:40 +02:00
|
|
|
* **notes**: (optional) Passed through to output
|
2013-07-12 11:18:55 +02:00
|
|
|
|
|
|
|
###Callback Function
|
2013-07-12 11:15:11 +02:00
|
|
|
|
2013-07-12 11:12:02 +02:00
|
|
|
The callback function is "guaranteed" to be called exactly once.
|
2013-07-10 12:06:44 +02:00
|
|
|
|
2013-07-12 11:12:02 +02:00
|
|
|
If an error occurs, the returned object will contain an "error" key, indicating the issue.
|
|
|
|
If the error key exists, it should be assumed that the game server is offline or unreachable.
|
|
|
|
|
2013-07-12 11:12:55 +02:00
|
|
|
Otherwise, the returned object is guaranteed to contain the following keys:
|
2013-07-10 12:02:48 +02:00
|
|
|
|
2013-07-12 15:29:25 +02:00
|
|
|
**Stable, always present:**
|
2013-07-12 15:33:57 +02:00
|
|
|
|
2013-07-12 11:18:55 +02:00
|
|
|
* **name**
|
|
|
|
* **map**
|
|
|
|
* **password**: Boolean
|
|
|
|
* **maxplayers**
|
2013-07-12 15:29:25 +02:00
|
|
|
* **players**: (array of objects) Each object **may** contain name, ping, score, team, address
|
|
|
|
* **bots**: Same schema as players
|
2013-07-12 11:18:55 +02:00
|
|
|
* **notes**: Passed through from the input
|
2013-07-12 15:29:25 +02:00
|
|
|
|
|
|
|
**Unstable, not guaranteed:**
|
2013-07-12 15:33:57 +02:00
|
|
|
|
2013-07-12 15:29:25 +02:00
|
|
|
* **raw**: Contains all information received from the server
|
2013-07-12 11:18:55 +02:00
|
|
|
* **query**: Details about the query performed
|
2013-07-11 11:13:39 +02:00
|
|
|
|
2013-07-12 11:12:02 +02:00
|
|
|
It can usually be assumed that the number of players online is equal to the length of the players array.
|
|
|
|
Some servers may return an additional player count number, which may be present in the unstable raw object.
|
2013-07-10 12:02:48 +02:00
|
|
|
|
|
|
|
Supported Games
|
|
|
|
---
|
2013-10-12 08:43:16 +02:00
|
|
|
|
2014-02-01 16:48:01 +01:00
|
|
|
* Age of Chivalry (ageofchivalry)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Alien Swarm (alienswarm)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Aliens vs Predator 2 (avp2)
|
2014-02-01 16:48:01 +01:00
|
|
|
* America's Army 1 (americasarmy) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
|
|
|
* America's Army 2 (americasarmy2) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
|
|
|
* America's Army 3 (americasarmy3) [[Separate Query Port - Usually 27020](#separate-query-port)]
|
|
|
|
* America's Army: Proving Grounds (americasarmypg) [[Separate Query Port - Usually 27020](#separate-query-port)]
|
|
|
|
* ArmA Armed Assault 1 (arma)
|
|
|
|
* ArmA Armed Assault 2 (arma2)
|
|
|
|
* ArmA Armed Assault 3 (arma3)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Armagetron (armagetron)
|
2014-02-01 16:48:01 +01:00
|
|
|
* Battlefield 1942 (bf1942) [[Separate Query Port - Usually 23000](#separate-query-port)]
|
|
|
|
* Battlefield 2 (bf2) [[Separate Query Port - Usually 29900](#separate-query-port)]
|
2014-02-02 00:46:10 +01:00
|
|
|
* Battlefield 3 (bf3) [[Separate Query Port - Usually port+22000](#separate-query-port)]
|
|
|
|
* Battlefield 4 (bf4) [[Separate Query Port - Usually port+22000](#separate-query-port)]
|
|
|
|
* Battlefield: Bad Company 2 (bfbc2) [[Separate Query Port - Usually 48888](#separate-query-port)]
|
|
|
|
* Battlefield: Vietnam (bfv) [[Separate Query Port - Usually 48888](#separate-query-port)]
|
2014-02-01 16:48:01 +01:00
|
|
|
* Brink (brink) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
2014-01-31 23:27:52 +01:00
|
|
|
* Build and Shoot (buildandshoot)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Call of Duty (cod)
|
|
|
|
* Call of Duty 2 (cod2)
|
|
|
|
* Call of Duty 4 (cod4)
|
|
|
|
* Call of Duty: Modern Warfare 3 (codmw3) [[Separate Query Port - Usually port+2](#separate-query-port)]
|
|
|
|
* Call of Duty: United Offensive (coduo)
|
|
|
|
* Call of Duty: World at War (codwaw)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Counter-Strike 1.6 (cs16)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Counter-Strike: Condition Zero (cscz)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Counter-Strike: Source (css)
|
|
|
|
* Counter-Strike: Global Offensive (csgo)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Crysis (crysis)
|
|
|
|
* Crysis 2 (crysis2)
|
|
|
|
* Crysis Wars (crysiswars)
|
|
|
|
* Darkest Hour (darkesthour) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
|
|
|
* Day of Defeat (dod)
|
|
|
|
* Day of Defeat: Source (dods)
|
|
|
|
* DayZ (dayz) [[Separate Query Port - Usually 27016-27020](#separate-query-port)]
|
2014-01-31 23:27:52 +01:00
|
|
|
* Dino D-Day (dinodday)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Doom 3 (doom3)
|
|
|
|
* DOTA 2 (dota2)
|
|
|
|
* Enemy Territory Quake Wars (etqw)
|
|
|
|
* F.E.A.R. (fear)
|
|
|
|
* Fortress Forever (fortressforever)
|
|
|
|
* Frontlines: Fuel of War (ffow)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Garry's Mod (garrysmod)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Ghost Recon: Advanced Warfighter (graw)
|
|
|
|
* Ghost Recon: Advanced Warfighter 2 (graw2)
|
|
|
|
* Gore (gore)
|
|
|
|
* Half-Life 1 Deathmatch (hldm)
|
|
|
|
* Half-Life 2 Deathmatch (hl2dm)
|
|
|
|
* Halo (halo)
|
2014-01-31 23:27:52 +01:00
|
|
|
* The Hidden: Source (hidden)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Homefront (homefront)
|
|
|
|
* Insurgency (insurgency)
|
|
|
|
* Just Cause 2 Multiplayer (jc2mp)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Killing Floor (killingfloor)
|
|
|
|
* KzMod (kzmod)
|
|
|
|
* Left 4 Dead (left4dead)
|
|
|
|
* Left 4 Dead 2 (left4dead2)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Mafia 2 Multiplayer (m2mp) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
|
|
|
* Medal of Honor: Allied Assault (mohaa) [[Separate Query Port - Usually port+97](#separate-query-port)]
|
|
|
|
* Medal of Honor: Spearhead (mohsh) [[Separate Query Port - Usually port+97](#separate-query-port)]
|
|
|
|
* Medal of Honor: Breakthrough (mohbt) [[Separate Query Port - Usually port+97](#separate-query-port)]
|
|
|
|
* Medal of Honor 2010 (moh2010) [[Separate Query Port - Usually 48888](#separate-query-port)]
|
|
|
|
* Medal of Honor: Warfighter (mohwf)
|
2014-02-01 09:38:40 +01:00
|
|
|
* Minecraft (minecraft) [[Additional Notes](#minecraft)]
|
2014-02-02 00:46:10 +01:00
|
|
|
* Monday Night Combat (mnc)
|
|
|
|
* Multi Theft Auto [[Separate Query Port - Usually port+123](#separate-query-port)]
|
2014-01-31 23:27:52 +01:00
|
|
|
* Mutant Factions (mutantfactions)
|
|
|
|
* Natural Selection (ns)
|
2014-02-01 16:48:01 +01:00
|
|
|
* Natural Selection 2 (ns2) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
2014-01-31 23:27:52 +01:00
|
|
|
* No More Room in Hell (nmrih)
|
|
|
|
* Nuclear Dawn (nucleardawn)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Prey (prey)
|
|
|
|
* Quake 1 (quake1)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Quake 2 (quake2)
|
|
|
|
* Quake 3 (quake3)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Quake 4 (quake4)
|
|
|
|
* Red Orchestra: Ostfront 41-45 (redorchestraost) [[Separate Query Port - Usually port+10](#separate-query-port)]
|
|
|
|
* Red Orchestra 2 (redorchestra2) [[Separate Query Port - Usually 27015](#separate-query-port)]
|
|
|
|
* Return to Castle Wolfenstein (rtcw)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Ricochet (ricochet)
|
|
|
|
* Rust (rust)
|
|
|
|
* The Ship (ship)
|
2014-02-01 09:38:40 +01:00
|
|
|
* ShootMania (shootmania) [[Additional Notes](#nadeo-shootmania--trackmania--etc)]
|
2014-02-02 00:46:10 +01:00
|
|
|
* Soldier of Fortune 2 (sof2)
|
|
|
|
* Star Wars: Battlefront 2 (swbf2)
|
|
|
|
* Star Wars: Jedi Knight (swjk)
|
|
|
|
* Star Wars: Jedi Knight 2 (swjk2)
|
2014-01-31 23:27:52 +01:00
|
|
|
* Starbound (starbound)
|
|
|
|
* Suicide Survival (suicidesurvival)
|
2014-02-02 00:46:10 +01:00
|
|
|
* SWAT 4 (swat4) [[Separate Query Port - Usually port+2](#separate-query-port)]
|
2014-01-31 23:27:52 +01:00
|
|
|
* Sven Coop (svencoop)
|
|
|
|
* Synergy (synergy)
|
|
|
|
* Team Fortress 2 (tf2)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Team Fortress Classic (tfc)
|
2014-02-01 09:38:40 +01:00
|
|
|
* Terraria (terraria) [[Additional Notes](#terraria)]
|
|
|
|
* TrackMania 2 (trackmania2) [[Additional Notes](#nadeo-shootmania--trackmania--etc)]
|
|
|
|
* TrackMania Forever (trackmaniaforever) [[Additional Notes](#nadeo-shootmania--trackmania--etc)]
|
2014-02-02 00:46:10 +01:00
|
|
|
* Unreal Tournament (ut) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
2014-02-02 03:04:41 +01:00
|
|
|
* Unreal Tournament 2004 (ut2004) [[Separate Query Port - Usually port+1](#separate-query-port)]
|
2014-02-02 00:46:10 +01:00
|
|
|
* Unreal Tournament 3 (ut3) [[Separate Query Port - Usually 6500](#separate-query-port)]
|
2014-01-31 23:27:52 +01:00
|
|
|
* Warsow (warsow)
|
2014-02-02 00:46:10 +01:00
|
|
|
* Wolfenstein 2009 (wolfenstein2009)
|
|
|
|
* Wolfenstein: Enemy Territory (wolfensteinet)
|
|
|
|
* Zombie Master (zombiemaster)
|
|
|
|
* Zombie Panic: Source (zps)
|
2014-01-31 23:27:52 +01:00
|
|
|
|
|
|
|
Don't see your game listed here?
|
2014-02-01 09:38:40 +01:00
|
|
|
|
2014-01-31 23:27:52 +01:00
|
|
|
1. Let us know so we can fix it
|
2014-02-01 09:38:40 +01:00
|
|
|
1. You can try using some common query protocols directly by using one of these server types:
|
2014-02-02 00:50:32 +01:00
|
|
|
* protocol-ase
|
|
|
|
* protocol-battlefield
|
|
|
|
* protocol-doom3
|
|
|
|
* protocol-gamespy1
|
|
|
|
* protocol-gamespy2
|
2014-02-01 09:38:40 +01:00
|
|
|
* protocol-gamespy3
|
|
|
|
* protocol-nadeo
|
|
|
|
* protocol-quake2
|
|
|
|
* protocol-quake3
|
|
|
|
* protocol-unreal2
|
|
|
|
* protocol-valve
|
|
|
|
* protocol-valvegold
|
|
|
|
|
|
|
|
### Games with Additional Notes
|
|
|
|
|
|
|
|
#### Minecraft
|
|
|
|
Some minecraft servers may not respond to a typical status query. If this is the case, try using the
|
|
|
|
'minecraftping' server type instead, which uses a less accurate but more reliable solution.
|
|
|
|
|
|
|
|
#### Nadeo (ShootMania / TrackMania / etc)
|
2014-02-01 16:48:01 +01:00
|
|
|
The server must have xmlrpc enabled, and you must pass the xmlrpc port to GameDig, not the connection port.
|
|
|
|
You must have a user account on the server with access level User or higher.
|
2014-02-01 09:38:40 +01:00
|
|
|
Pass the login into to GameDig with the additional options: login, password
|
|
|
|
|
|
|
|
#### Terraria
|
|
|
|
Requires tshock server mod, and a REST user token, which can be passed to GameDig with the
|
|
|
|
additional option: token
|
2014-01-31 23:27:52 +01:00
|
|
|
|
2014-02-01 16:48:01 +01:00
|
|
|
#### Separate Query Port
|
|
|
|
Games with this note use a query port which is usually not the same as the game's connection port.
|
|
|
|
You must pass the query port to GameDig, not the connection port.
|
|
|
|
|
2014-01-31 23:27:52 +01:00
|
|
|
Usage from Command Line
|
|
|
|
---
|
2013-10-12 08:43:16 +02:00
|
|
|
|
2014-01-31 23:27:52 +01:00
|
|
|
Want to integrate server queries from a batch script or other programming language?
|
|
|
|
You'll still need npm to install gamedig:
|
|
|
|
```shell
|
|
|
|
npm install gamedig -g
|
2013-10-12 08:43:16 +02:00
|
|
|
```
|
2014-01-31 23:27:52 +01:00
|
|
|
|
|
|
|
After installing gamedig globally, you can call gamedig via the command line
|
|
|
|
using the same parameters mentioned in the API above:
|
|
|
|
```shell
|
|
|
|
gamedig --type minecraft --host mc.example.com --port 11234
|
2013-10-12 08:43:16 +02:00
|
|
|
```
|
|
|
|
|
2014-01-31 23:27:52 +01:00
|
|
|
The output of the command will be in JSON format.
|