Find a file
Michael Morrison 4b911c61cf Update readme
2014-09-13 09:34:18 -05:00
bin Update readme 2014-09-13 09:34:18 -05:00
lib Update readme 2014-09-13 09:34:18 -05:00
protocols Fixed path for core protocol in mumbleping 2014-09-09 08:05:53 -05:00
reference Add a ton of reference 2014-02-03 16:04:51 -06:00
.gitignore Super mega-commit 2014-01-31 16:27:52 -06:00
games.txt Update arma2 and arma3 defs 2014-09-13 09:23:42 -05:00
LICENSE initial commit 2013-07-10 05:02:48 -05:00
package.json bump version to 0.2.4 2014-02-03 16:21:30 -06:00
README.md Update readme 2014-09-13 09:34:18 -05:00

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 "git+https://github.com/sonicsnes/node-gamedig.git"

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
  • 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.

Supported Games

Don't see your game listed here?

  1. Let us know so we can fix it
  2. 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 Not Supported (yet!)

  • rFactor Engine (rfactor):
  • rFactor
  • Arca Sim Racing
  • Cube Engine (cube):
  • Cube 1
  • Assault Cube
  • Cube 2: Sauerbraten
  • Blood Frontier
  • BFRIS
  • Counter-Strike 2D
  • Freelancer
  • Ghost Recon
  • GTR2
  • Haze
  • Hexen 2
  • OpenTTD
  • 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 the games above are documented in the /reference folder, ready for you to develop into GameDig!

Not Supported

  • Call of Duty: Black Ops 1 and 2 (no documentation, may require rcon)

Games with Additional Notes

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

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.