Use a client/server architecture
Posted: Mon Jan 31, 2005 8:51 pm
I know it is an old discussion subject, but now, there are some new developpers who may want to talk about it.
The main idea is to split the game into two parts : a "server", and one or several "clients". Note that lots of network softwares, and especially games, are organized in this way. My main model is "freeciv" (www.freeciv.org).
This idea comes from the fact that there are not a lot of information exchanged between the interface and the core of the game :
* start a new week
* display the game result
* send the players who will play
* display the transfer list
etc.
The server knows how to play. Clients are just interfaces between the human and/or artificial players and the server. Imagine the consequences of a client/server architecture :
* you can imagine other clients : Qt clients, MSWindows clients, Tk clients for very poor people, etc. Each client can be developped independantly, provided it respects communication standards with the server.
* some clients can be not interfaces, but rather small programs, or scripts, which play AI teams. Then, everybody can develop its own AI player, and then compare the most efficient strategies, etc.
* client/server architecture will make the network game very easy
I don't want to tell "Bygfoot has to be a client/server software now". I just want to propose that this architecture can be "simulated", through interface functions which will be changed when the network game will be ready. For example, look at the following (fictive) example :
void ActionHandler(void) { DoAction(); }
interface.h:
void DoAction(void) { ActionOnBygfoot(); }
instead of
void ActionHandler(void) { ActionOnBygfoot(); }
This will lead to more flexibility, since the software will be splitted into two parts, communicating only through functions of "interface.h", for example.
Well, I hope I was clear... Have a good night!
The main idea is to split the game into two parts : a "server", and one or several "clients". Note that lots of network softwares, and especially games, are organized in this way. My main model is "freeciv" (www.freeciv.org).
This idea comes from the fact that there are not a lot of information exchanged between the interface and the core of the game :
* start a new week
* display the game result
* send the players who will play
* display the transfer list
etc.
The server knows how to play. Clients are just interfaces between the human and/or artificial players and the server. Imagine the consequences of a client/server architecture :
* you can imagine other clients : Qt clients, MSWindows clients, Tk clients for very poor people, etc. Each client can be developped independantly, provided it respects communication standards with the server.
* some clients can be not interfaces, but rather small programs, or scripts, which play AI teams. Then, everybody can develop its own AI player, and then compare the most efficient strategies, etc.
* client/server architecture will make the network game very easy
I don't want to tell "Bygfoot has to be a client/server software now". I just want to propose that this architecture can be "simulated", through interface functions which will be changed when the network game will be ready. For example, look at the following (fictive) example :
void ActionHandler(void) { DoAction(); }
interface.h:
void DoAction(void) { ActionOnBygfoot(); }
instead of
void ActionHandler(void) { ActionOnBygfoot(); }
This will lead to more flexibility, since the software will be splitted into two parts, communicating only through functions of "interface.h", for example.
Well, I hope I was clear... Have a good night!