Wiki

Clone wiki

Matchmaker / Home

Matchmaker

Matchmaker is a simple PHP matchmaking service for indie and hobby game developers.

Features

  • Post game server information to a web server at a known location where clients will be able to access it
  • Discover active game servers so that clients can connect directly to the game servers
  • Install on any web server with PHP and MySQL, so pretty much anywhere

Installation

  1. Grab a copy of the source and extract it to your local drive for editing
  2. Create a new MySQL database for Matchmaker
  3. Execute the SQL contained in createTable.sql against your new database. Modify the default port number if desired.
  4. Open dbTEMPLATE.php and fill in the variables with information for your own database
  5. Rename dbTEMPLATE.php to db.php
  6. Upload db.php, getServers.php, and postServer.php to your web server in the same directory
  7. Visit getServers.php in your web browser. You should be presented with a very plain page with "No Games" listed.

Posting a Server

You can post a server by visiting postServer.php in your browser with a few parameters:

  • game (required), The name of the game you are posting a server for. Case sensitive
  • version (required), The version of the game you are posting a server for
  • port (optional), The port number the game server is listening on. If not provided, it will use the default defined in postServer.php

If the server posting was successful, it will return either:

<?xml version="1.0"?>

<success code="200">
Successfully Added
</success>

or

<?xml version="1.0"?>

<success code="201">
Successfully Updated
</success>

Each game server posting will expire after 2 minutes. The game server should re-post the server information at a regular interval, I would recommend every 1 minute. This prevents clients from attempting to connect to stale servers.

Example Server Posts

  • Simple usage:

http://myserver.com/matchmaker/postServer.php?game=AwesomeGame&version=1.0

  • version is a string and can be anything you want, except nothing:

http://myserver.com/matchmaker/postServer.php?game=Booyeah&version=Five

  • Providing a non-default port:

http://myserver.com/matchmaker/postServer.php?game=My%20Game&version=2&port=42

Discovering Servers

The client should visit getServers.php with some optional parameters:

  • game (optional), Filters the server results to those hosting this game. Case sensitive
  • version (optional), Filters the server results to those hosting with this version (only recognized if game is also provided)

If the user-agent is set to game, then the results will be returned in XML, otherwise the results will be returned in a HTML table.

If servers have been active in the last 2 minutes, the XML will look like:

<?xml version="1.0" encoding="utf-8"?>

<serverList>
	<server>
		<ipaddress>$ipAddress</ipaddress>
		<port>$port</port>
		<game>$game</game>
		<version>$version</version>
		<createdOn>$createdOn</createdOn>
		<updatedOn>$updatedOn</updatedOn>
	</server>
	{ ... repeated for every active server ... }
</serverList>

Otherwise, if there are no active servers, the XML will look like:

<?xml version="1.0" encoding="utf-8"?>

<serverList>
	No Results
</serverList>

If you visit in your browser, the HTML is in a table with the same columns.

Example Server Discoveries

  • Grab everything:

http://myserver.com/matchmaker/getServers.php

  • Grab only servers hosting "My Game":

http://myserver.com/matchmaker/getServers.php?game=My%20Game

  • Grab only servers hosting "My Game" version 2:

http://myserver.com/matchmaker/getServers.php?game=My%20Game&version=2


This work is licensed under a Creative Commons Attribution 3.0 Unported License

Licence is negotiable, just contact me.

Updated