Introduction Manual Class Reference Header Reference

Application Design

Zoidcom is designed for the client/server network topology. In this topology there is one entity, the server, that everyone else connects to. This server typically has the full authority over everything that happens in the game.

The job of the client is to capture user input, send it to the server, process incoming data from the server and display the game world accordingly. The client should not make any game logic decisions.

The job of the server is to process incoming client input, update the client's avatar based on that input and distribute the new state to all clients. The server decides who wins, who hits whom etc.

Most games have two different server modes, the dedicated server and the localhost server. The dedicated server is a pure server application without graphical output. If anyone wants to use a dedicated server to play a game, a client needs to be started seperately and used to connect to the server. A localhost server on the other hand is client and server in one program. It allows connection from remote players, but also allows one or more players to play directly.

If your project is in the planning stage, it is advised to design the project for networking right from the start. Bolting on network code in a late state of the project will most likely either lead to massive refactoring or a large amount of hacking, resulting in hardly maintanable and bug ridden code.

The cleanest way is to implement the whole game as if it were a pure network game. That is, implement code for a dedicated server, and implement this code for being server code only. Implement the game client code in a similar manner. Server and client can run in the same process and don't even need to use a real network socket, but they should be seperate entities and all code should be designed to work that way. When the player jumps, don't alter the player's jump vector directly, but send a 'jump-key-pressed' packet to the server and let the server handle that.

This means that even in a singleplayer game, there is an invisible server running in the background. A multiplayer version of the same game just needs to connect to a remote server instead of the local one et voila, multiplayer done. The advantages of this are:

Projects using this scheme are almost all games using any of the Quake engines, Civilization 4, Neverwinter Nights and many many more.

For connecting client and server in the same process with zero latency, local sockets can be used. These are provided by Zoidcom and pass packets directly from one ZCom_Control to another, without going through an OS level socket.

Things To Expect

When implementing networking with Zoidcom, you will need at least these things:

Of course, there will be a lot more things to do, but in general, you need a client and a server class plus one ZCom_Node for each of your game objects.


This file is part of the documentation for Zoidcom. Documentation copyright © 2004-2008 by Jörg Rüppel. Generated on Sat Aug 16 15:26:51 2008 for Zoidcom by doxygen 1.4.6-NO