The game will operate in a client-server way, even when in single-player mode, so the client will be an important part of the engine's architecture:
usedModule is an instance of the Module object which contains all of the date that is peculiar to a specific game (graphics, sounds, scripts).
dDev, sDev, kDev, and mDev are objects which perform the various IO functions. Among other things, I will use them to encapsulate the system-specifc stuff so that as much of the engine as possible can be written in code that will run under Windows, Mac, or Linux.
activeGame is an instance of the Game object, which holds all of the client data that is specific to a single playing of a Game.
conn is the instance of the Conn class, which handles client-server communcations.
What I envision at the start of the client application is that if it is not supplied with a module file in the command line, then it will require the user to select a module file at start-up. Then it will load the specified module, create the various IO objects, and then run the first script in the loaded module. When that script exits, the Client object will be destroyed, and the application will exit.
Obviously, this first script must display the splash screen, then the main menu, and then run other scripts depending on the menu choices made. So it would look like this:
Or something like this.
class Client {
Module usedModule;
DisplayDevice dDev;
SoundDevice sDev;
KeyboardDevice kDev;
MouseDevice mDev;
Game activeGame;
Conn conn;
public:
Client();
~Client();
void go();
};
|
usedModule is an instance of the Module object which contains all of the date that is peculiar to a specific game (graphics, sounds, scripts).
dDev, sDev, kDev, and mDev are objects which perform the various IO functions. Among other things, I will use them to encapsulate the system-specifc stuff so that as much of the engine as possible can be written in code that will run under Windows, Mac, or Linux.
activeGame is an instance of the Game object, which holds all of the client data that is specific to a single playing of a Game.
conn is the instance of the Conn class, which handles client-server communcations.
What I envision at the start of the client application is that if it is not supplied with a module file in the command line, then it will require the user to select a module file at start-up. Then it will load the specified module, create the various IO objects, and then run the first script in the loaded module. When that script exits, the Client object will be destroyed, and the application will exit.
Obviously, this first script must display the splash screen, then the main menu, and then run other scripts depending on the menu choices made. So it would look like this:
Client::Client(char* fileName) : usedModule(fileName) { }
void Client::go() {
usedModule.runScript(FIRST_SCRIPT);
}
|
Or something like this.
Leave a comment
