How to use the Open Game Cache

A public OGC server is running at ogc.gulpe.de:11111. If you want to run your own OGC server you can download it.

To use the OGC protocol in a Java application you can use the OGC Java library. To use it in other programs refer to the OGC protocol:

Open Game Cache protocol

You have to set up an UDP socket to receive and send commands to the Open Game Cache server. The OGC server will send all answers back to the client port from which the client has sent something to the server.

Hosting a game

To put a game on the OGC server list you have to open an UDP socket and send the GAME: command to the OGC server. You have to keep the UDP socket open as long as you want your game to be in the list. To delete your game from the list use the QUIT: command. The OGC server will delete your game automatically when it does not receive an update for 30 minutes.

Browsing the list

For browsing the list you send the command LISTGAMES: followed by the name of your game to the OGC server. The OGC server will start sending a list of hosted games to your UDP socket from where you have sent this command. Note that you only get a list of games you asked for. So if you send LISTGAME:tetris you won't get the other games. After the OGC server finished sending the list, your client will be put on the browsing game list and receive further updates for 10 minutes about games that are added to the list in this period or that are being removed.

To make sure the browsing client won't get any updates or to delete the browsing client from the list the client has to send LISTQUIT: to the OGC server.

Sending and receiving commands

All commands are followed by a :. After that you can put the parameters seperated by a tab. Example for c:

        sprintf (senddata, "GAME:BomberClone\t0.11.0\tSteffen's Game\tIPv6\t3\t\8\tWaiting\tData");
        sprintf (senddata, "QUIT:");
      

Commands

In the following command specification "string" means a sequence of bytes and "char" means a byte. Use ASCII only (0 - 127) to make it look the same in all charsets!

GAME:

Add the game to the OGC list or update the game in the list.

ParameterComments
GameName of the game (i.e. BomberClone, Tetris..)
VersionVersionsnumber of the Game. The OGC saves the first 12 chars of this string (i.e. 0.11.0p1)
NetnameName of the network game. (i. e. Steffen's Game)
NettypeNetwork type you use followed by the portnumber. Possible values are:
TCP4:Port - TCP/IP Game (i.e. TCP4:5403)
TCP6:Port - TCP/IP Game using IPv6 (the new internet protocol, i.e. TCP6:5403)
UDP4:Port - UDP/IP Game (i.e. UDP6:5403)
UDP6:Port - UDP/IP Game using IPv6 (the new internet protocol, i.e. UDP6:5403)
IPv4 - old parameter for UDP games using IPv4. The port will be got from the OGC Client UDP port. (i.e. IPv4)
IPv6 - old parameter for UDP games using IPv6. The port will be got from the OGC Client UDP port. (i.e. IPv6)
curplayersCurrent number of players
maxplayersMaximum number of players
statuscan hold any information which fits in 16 chars to inform the client if the game is closed, joinable, updateing, running and so on
dataadditional 256bytes of text ad data. Not allowed is \0, \t and \n.

QUIT:

Delete the game from the OGC list. You do not need to supply the command with the parameters to delete just any game from your host. The parameters are needed if you are running more game on one mashine.

ParameterComments
GameName of the game (i.e. BomberClone, Tetris..)
NetnameName of the network game. (i. e. Steffen's Game)

LISTGAMES:

Add the OGC client to the browsing/watching game list for the specified game.

ParameterComments
GameName of the game you want to have a list from.

LISTALL:

Add the OGC client to the browsing/watching game list.

ParameterComments

LISTQUIT:

Delete the OGC client from the browsing list. This will stop the OGC server from sending a list to the OGC client.

ParameterComments

Replys from the Server

ENTRY:

Game information.

ParameterComments
IDnumId of the game in the list. Every game which is added will get a ID to identify the game in the list.
HostHostname where the game is running.
PortPortnumber where the game is running.
GameName of the Game
VersionVersion of the game.
NettypeType of network what is used.
TCP4, TCP6, UDP4, UDP6 - protocol what is used for the game
IPv4, IPv6 - old style for UDP games.
NetnameName of the network game (i.e. Steffen's Game
StatusStatus of the game
CurPlayersCurrent number of players
MaxPlayersMaximum number of players
DataAdditional data.

DELENTRY:

Information that a game got deleted.

ParameterComments
IDnumthe id number of the deleted game in the list.