Go to file
Michael Morrison 0d1577fa35 bunches of updates:
find bots in source engine
add altaddress
pass address to query object output
2013-09-09 23:50:23 -05:00
protocols bunches of updates: 2013-09-09 23:50:23 -05:00
Class.js initial commit 2013-07-10 05:02:48 -05:00
LICENSE initial commit 2013-07-10 05:02:48 -05:00
README.md Fix markdown on npm directory 2013-07-12 08:33:57 -05:00
index.js bunches of updates: 2013-09-09 23:50:23 -05:00
package.json version bump 2013-07-12 06:33:38 -05:00
reader.js remove iconv dependency 2013-07-10 07:20:05 -05:00

README.md

node-GameDig - Game Server Query Library

Usage

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);
	}
);

Input Parameters

  • type: One of the types from the protocols folder
  • host
  • port: (optional) Uses the protocol default if not set
  • login: (optional) Used only by nadeo protocol
  • password: (optional) Used only by nadeo protocol
  • 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

  • Armagetron
  • Gamespy 3 Protocol
  • Minecraft
  • Unreal Tournament 3
  • GoldSrc Engine
  • Half Life: Death Match
  • Ricochet
  • Counter-Strike: 1.6
  • + others
  • Nadeo Protocol
  • Trackmania Forever
  • Trackmania 2
  • Shootmania
  • Quake 2 Protocol
  • Quake 2
  • Quake 3 Protocol
  • Quake 3 Arena
  • Quake 3 Team Arena
  • Warsow
  • Source Engine
  • Counter-Strike: Source
  • Counter-Strike: Global Offensive
  • Team Fortress 2
  • + others
  • Terraria (tshock)
  • Unreal 2 Protocol
  • Killing Floor
  • Unreal Tournament 2004