bin | ||
lib | ||
protocols | ||
reference | ||
.gitignore | ||
games.txt | ||
LICENSE | ||
package.json | ||
README.md |
node-GameDig - Game Server Query Library
node-GameDig is a game server query library, capable of querying for the status of nearly any game or voice server. If a server makes its status publically available, GameDig can fetch it for you.
GameDig is available as a node.js module, as well as a command line executable.
Usage from Node.js
npm install gamedig
var Gamedig = require('gamedig');
Gamedig.query(
{
type: 'minecraft',
host: 'mc.example.com'
},
function(state) {
if(state.error) console.log("Server is offline");
else console.log(state);
}
);
Is NPM out of date? If you're feeling lucky, you can install the latest code with
npm install sonicsnes/node-gamedig
Input Parameters
- type: One of the game IDs listed in the game list below
- host
- port: (optional) Uses the protocol default if not set
- notes: (optional) Passed through to output
###Callback Function
The callback function is "guaranteed" to be called exactly once.
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.
Otherwise, the returned object is guaranteed to contain the following keys:
Stable, always present:
- name
- map
- password: Boolean
- onlineplayers
- maxplayers
- players: (array of objects) Each object may contain name, ping, score, team, address
- bots: Same schema as players
- notes: Passed through from the input
Unstable, not guaranteed:
- raw: Contains all information received from the server
- query: Details about the query performed
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.
Games List
###Supported
- Age of Chivalry (ageofchivalry)
- Age of Empires 2 (aoe2) [Separate Query Port]
- Alien Arena (alienarena) [Separate Query Port]
- Alien Swarm (alienswarm)
- Aliens vs Predator 2 (avp2)
- Aliens vs Predator 2010 (avp2010)
- America's Army (americasarmy) [Separate Query Port]
- America's Army 2 (americasarmy2) [Separate Query Port]
- America's Army 3 (americasarmy3) [Separate Query Port]
- America's Army: Proving Grounds (americasarmypg) [Separate Query Port]
- ArmA Armed Assault 1 (arma)
- ArmA Armed Assault 2 (arma2) [Separate Query Port]
- ArmA Armed Assault 3 (arma3) [Separate Query Port]
- Armagetron (armagetron)
- Baldur's Gate (baldursgate) [Separate Query Port]
- Battlefield 1942 (bf1942) [Separate Query Port]
- Battlefield Vietnam (bfv) [Separate Query Port]
- Battlefield 2 (bf2) [Separate Query Port]
- Battlefield 2142 (bf2142) [Separate Query Port]
- Battlefield: Bad Company 2 (bfbc2) [Separate Query Port]
- Battlefield 3 (bf3) [Separate Query Port]
- Battlefield 4 (bf4) [Separate Query Port]
- Breach (breach)
- Breed (breed)
- Brink (brink) [Separate Query Port]
- Build and Shoot (buildandshoot) [Separate Query Port]
- Call of Duty (cod)
- Call of Duty: United Offensive (coduo)
- Call of Duty 2 (cod2)
- Call of Duty 3 (cod3)
- Call of Duty 4: Modern Warfare (cod4)
- Call of Duty: World at War (codwaw)
- Call of Duty: Modern Warfare 2 (codmw2)
- Call of Duty: Modern Warfare 3 (codmw3) [Separate Query Port]
- Call of Juarez (callofjuarez) [Separate Query Port]
- Chaser (chaser) [Separate Query Port]
- Chrome (chrome) [Separate Query Port]
- Codename Eagle (codenameeagle) [Separate Query Port]
- Commandos 3: Destination Berlin (commandos3) [Separate Query Port]
- Command and Conquer: Renegade (cacrenegade) [Separate Query Port]
- Contact J.A.C.K. (contactjack) [Separate Query Port]
- Counter-Strike 1.6 (cs16)
- Counter-Strike: Condition Zero (cscz)
- Counter-Strike: Source (css)
- Counter-Strike: Global Offensive (csgo) [Additional Notes]
- Cross Racing Championship (crossracing) [Separate Query Port]
- Crysis (crysis)
- Crysis Wars (crysiswars)
- Crysis 2 (crysis2)
- Daikatana (daikatana) [Separate Query Port]
- Dark Messiah of Might and Magic (dmomam)
- Darkest Hour (darkesthour) [Separate Query Port]
- DayZ (dayz) [Separate Query Port] [Additional Notes]
- DayZ Mod (dayzmod) [Separate Query Port]
- Deadly Dozen: Pacific Theater (deadlydozenpt) [Separate Query Port]
- Deer Hunter 2005 (dh2005) [Separate Query Port]
- Descent 3 (descent3) [Separate Query Port]
- Deus Ex (deusex) [Separate Query Port]
- Devastation (devastation) [Separate Query Port]
- Dino D-Day (dinodday)
- Dirt Track Racing 2 (dirttrackracing2) [Separate Query Port]
- Day of Defeat (dod)
- Day of Defeat: Source (dods)
- Doom 3 (doom3)
- DOTA 2 (dota2)
- Drakan (drakan) [Separate Query Port]
- Enemy Territory Quake Wars (etqw) [Separate Query Port]
- F.E.A.R. (fear) [Separate Query Port]
- F1 2002 (f12002) [Separate Query Port]
- F1 Challenge 99-02 (f1c9902) [Separate Query Port]
- Far Cry (farcry) [Separate Query Port]
- Far Cry (farcry2) [Separate Query Port]
- Fortress Forever (fortressforever)
- Flashpoint (flashpoint) [Separate Query Port]
- Frontlines: Fuel of War (ffow) [Separate Query Port]
- Garry's Mod (garrysmod)
- Ghost Recon: Advanced Warfighter (graw) [Separate Query Port]
- Ghost Recon: Advanced Warfighter 2 (graw2) [Separate Query Port]
- Giants: Citizen Kabuto (giantscitizenkabuto) [Separate Query Port]
- Global Operations (globaloperations) [Separate Query Port]
- Gore (gore) [Separate Query Port]
- Gunman Chronicles (gunmanchronicles)
- Half-Life 1 Deathmatch (hldm)
- Half-Life 2 Deathmatch (hl2dm)
- Halo (halo)
- Halo 2 (halo2)
- Heretic 2 (heretic2) [Separate Query Port]
- Hexen World (hexenworld) [Separate Query Port]
- The Hidden: Source (hidden)
- Hidden and Dangerous 2 (had2) [Separate Query Port]
- Homefront (homefront)
- Homeworld 2 (homeworld2) [Separate Query Port]
- IGI-2: Covert Strike (igi2) [Separate Query Port]
- IL-2 Sturmovik (il2) [Separate Query Port]
- Insurgency (insurgency)
- Iron Storm (ironstorm) [Separate Query Port]
- James Bond: Nightfire (jamesbondnightfire) [Separate Query Port]
- Just Cause 2 Multiplayer (jc2mp)
- Killing Floor (killingfloor) [Separate Query Port]
- Kingpin: Life of Crime (kingpin) [Separate Query Port]
- KISS Psycho Circus (kisspc) [Separate Query Port]
- KzMod (kzmod)
- Left 4 Dead (left4dead)
- Left 4 Dead 2 (left4dead2)
- Mafia 2 Multiplayer (m2mp) [Separate Query Port]
- Medal of Honor: Allied Assault (mohaa) [Separate Query Port]
- Medal of Honor: Pacific Assault (mohpa) [Separate Query Port]
- Medal of Honor: Airborne (mohab) [Separate Query Port]
- Medal of Honor: Spearhead (mohsh) [Separate Query Port]
- Medal of Honor: Breakthrough (mohbt) [Separate Query Port]
- Medal of Honor 2010 (moh2010) [Separate Query Port]
- Medal of Honor: Warfighter (mohwf) [Separate Query Port]
- Minecraft (minecraft) [Additional Notes]
- Minecraft (minecraftping) [Additional Notes]
- Monday Night Combat (mnc) [Separate Query Port]
- Multi Theft Auto: Vice City (mtavc) [Separate Query Port]
- Multi Theft Auto: San Andreas (mtasa) [Separate Query Port]
- Mumble (mumble) [Separate Query Port] [Additional Notes]
- Mumble (mumbleping) [Additional Notes]
- Mutant Factions (mutantfactions)
- Nascar Thunder 2004 (nascarthunder2004) [Separate Query Port]
- netPanzer (netpanzer)
- No More Room in Hell (nmrih)
- Natural Selection (ns)
- Natural Selection 2 (ns2) [Separate Query Port]
- Need for Speed: Hot Pursuit 2 (nfshp2) [Separate Query Port]
- Nerf Arena Blast (nab) [Separate Query Port]
- Neverwinter Nights (nwn) [Separate Query Port]
- Neverwinter Nights 2 (nwn2) [Separate Query Port]
- Nexuiz (nexuiz) [Separate Query Port]
- Nitro Family (nitrofamily) [Separate Query Port]
- No One Lives Forever (nolf) [Separate Query Port]
- No One Lives Forever 2 (nolf2) [Separate Query Port]
- Nuclear Dawn (nucleardawn)
- OpenArena (openarena) [Separate Query Port]
- OpenTTD (openttd)
- Operation Flashpoint (operationflashpoint) [Separate Query Port]
- Painkiller (painkiller) [Separate Query Port]
- Postal 2 (postal2) [Separate Query Port]
- Prey (prey) [Separate Query Port]
- Quake 1: QuakeWorld (quake1)
- Quake 2 (quake2)
- Quake 3: Arena (quake3)
- Quake 4 (quake4)
- Rag Doll Kung Fu (ragdollkungfu)
- Rainbow Six (r6) [Separate Query Port]
- Rainbow Six 2: Rogue Spear (r6roguespear) [Separate Query Port]
- Rainbow Six 3: Raven Shield (r6ravenshield) [Separate Query Port]
- RalliSport Challenge (rallisportchallenge) [Separate Query Port]
- Rally Masters (rallymasters) [Separate Query Port]
- Red Orchestra (redorchestra) [Separate Query Port]
- Red Orchestra: Ostfront 41-45 (redorchestraost) [Separate Query Port]
- Red Orchestra 2 (redorchestra2) [Separate Query Port]
- Redline (redline) [Separate Query Port]
- Return to Castle Wolfenstein (rtcw) [Separate Query Port]
- Ricochet (ricochet)
- Rise of Nations (riseofnations) [Separate Query Port]
- Rune (rune) [Separate Query Port]
- Rust (rust) [Separate Query Port]
- San Andreas Multiplayer (samp)
- Serious Sam (ss) [Separate Query Port]
- Serious Sam 2 (ss2)
- Shattered Horizon (shatteredhorizon)
- The Ship (ship)
- Shogo (shogo) [Separate Query Port]
- Shootmania (shootmania) [Additional Notes]
- SiN (sin) [Separate Query Port]
- SiN Episodes (sinep)
- Soldat (soldat) [Separate Query Port]
- Soldier of Fortune (sof) [Separate Query Port]
- Soldier of Fortune 2 (sof2) [Separate Query Port]
- S.T.A.L.K.E.R. (stalker) [Separate Query Port]
- Star Trek: Bridge Commander (stbc) [Separate Query Port]
- Star Trek: Voyager - Elite Force (stvef) [Separate Query Port]
- Star Trek: Voyager - Elite Force 2 (stvef2) [Separate Query Port]
- Star Wars: Battlefront (swbf) [Separate Query Port]
- Star Wars: Battlefront 2 (swbf2) [Separate Query Port]
- Star Wars: Jedi Knight (swjk) [Separate Query Port]
- Star Wars: Jedi Knight 2 (swjk2) [Separate Query Port]
- Star Wars: Republic Commando (swrc) [Separate Query Port]
- Starbound (starbound)
- StarMade (starmade)
- Suicide Survival (suicidesurvival)
- SWAT 4 (swat4) [Separate Query Port]
- Sven Coop (svencoop)
- Synergy (synergy)
- Tactical Ops (tacticalops) [Separate Query Port]
- Team Factor (teamfactor) [Separate Query Port]
- Team Fortress Classic (tfc)
- Team Fortress 2 (tf2)
- Teamspeak 2 (teamspeak2) [Separate Query Port]
- Teamspeak 3 (teamspeak3) [Separate Query Port] [Additional Notes]
- Terminus (terminus) [Separate Query Port]
- Terraria (terraria) [Separate Query Port] [Additional Notes]
- Tony Hawk's Pro Skater 3 (thps3) [Separate Query Port]
- Tony Hawk's Pro Skater 4 (thps4) [Separate Query Port]
- Tony Hawk's Underground 2 (thu2) [Separate Query Port]
- Trackmania 2 (trackmania2) [Additional Notes]
- Trackmania Forever (trackmaniaforever) [Additional Notes]
- Tremulous (tremulous) [Separate Query Port]
- Tribes: Vengeance (tribesvengeance) [Separate Query Port]
- Tron 2.0 (tron20) [Separate Query Port]
- Turok 2 (turok2) [Separate Query Port]
- Universal Combat (universalcombat) [Separate Query Port]
- Unreal (unreal) [Separate Query Port]
- Unreal Tournament (ut) [Separate Query Port]
- Unreal Tournament 2003 (ut2003) [Separate Query Port]
- Unreal Tournament 2004 (ut2004) [Separate Query Port]
- Unreal Tournament 3 (ut3) [Separate Query Port]
- Urban Terror (urbanterror) [Separate Query Port]
- V8 Supercar Challenge (v8supercar) [Separate Query Port]
- Ventrilo (ventrilo)
- Vietcong (vietcong) [Separate Query Port]
- Vietcong 2 (vietcong2) [Separate Query Port]
- Warsow (warsow)
- Wheel of Time (wheeloftime) [Separate Query Port]
- Wolfenstein 2009 (wolfenstein2009) [Separate Query Port]
- Wolfenstein: Enemy Territory (wolfensteinet) [Separate Query Port]
- Xpand Rally (xpandrally) [Separate Query Port]
- Zombie Master (zombiemaster)
- Zombie Panic: Source (zps)
###Not supported (yet)
- rFactor Engine (rfactor):
- rFactor
- Arca Sim Racing
- Cube Engine (cube):
- Cube 1
- Assault Cube
- Cube 2: Sauerbraten
- Blood Frontier
- BFRIS
- Call of Duty: Black Ops 1 and 2 (no documentation, may require rcon)
- Counter-Strike 2D
- Freelancer
- Ghost Recon
- GTR2
- Haze
- Hexen 2
- Plain Sight
- Red Faction
- Savage: Battle for Newerth
- Savage 2: A Tortured Soul
- Sum of All Fears
- Teeworlds
- Tribes 1: Starsiege
- Tribes 2
- Vice City Multiplayer
- World in Conflict
Want support for one of these games? Please open an issue to show your interest! Know how to code? Protocols for most of the games above are documented in the /reference folder, ready for you to develop into GameDig!
Don't see your game listed here?
First, let us know so we can fix it. Then, you can try using some common query protocols directly by using one of these server types:
- protocol-ase
- protocol-battlefield
- protocol-doom3
- protocol-gamespy1
- protocol-gamespy2
- protocol-gamespy3
- protocol-nadeo
- protocol-quake2
- protocol-quake3
- protocol-unreal2
- protocol-valve
Games with Additional Notes
Counter-Strike: Global Offensive
To receive a full player list response from CS:GO servers, the server must have set the cvar: host_players_show 2
DayZ
DayZ uses a query port that is separate from its main game port. The query port is usually the game port PLUS 24714 or 24715. You may need to pass this port in as the 'port_query' request option.
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.
Mumble
For full query results from Mumble, you must be running the GTmurmur plugin. If you do not wish to run the plugin, or do not require details such as channel and user lists, you can use the 'mumbleping' server type instead, which uses a less accurate but more reliable solution
Nadeo (ShootMania / TrackMania / etc)
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. Pass the login into to GameDig with the additional options: login, password
TeamSpeak 3
For teamspeak 3 queries to work correctly, the following permissions must be available for the guest server group:
- Virtual Server
- b_virtualserver_info_view
- b_virtualserver_channel_list
- b_virtualserver_client_list
- Group
- b_virtualserver_servergroup_list
- b_virtualserver_channelgroup_list
Terraria
Requires tshock server mod, and a REST user token, which can be passed to GameDig with the additional option: token
Separate Query Port
Games with this note use a query port which is usually not the same as the game's connection port. Usually, no action will be required from you. The 'port' option you pass GameDig should be the game's connection port. GameDig will attempt to calculate the query port automatically. If the query still fails, you may need to pass the 'port_query' option to GameDig as well, indicating the separate query port.
Usage from Command Line
Want to integrate server queries from a batch script or other programming language? You'll still need npm to install gamedig:
npm install gamedig -g
After installing gamedig globally, you can call gamedig via the command line using the same parameters mentioned in the API above:
gamedig --type minecraft --host mc.example.com --port 11234
The output of the command will be in JSON format.