Game Development Reference
In-Depth Information
'
Finally, you
ll need to decide how to handle your resources and scripts. This includes
deciding on the directory structure, level structure, and how it will all be stored and
loaded.
In this chapter, you
ll see how each of these challenges was approached for the game
of Teapot Wars. Before we start digging into the internals of the game, you should
take the time to download the code base and get it running on your system if you
haven
'
t be able to cover every single line of code in detail, but I can
offer a guided tour of how this game came together. It works best if you can follow
along in the code.
'
t already. I won
'
Creating the Core Classes
In the GameCode4 engine, there are several core classes that control the entire game.
They are GameCodeApp , BaseGameLogic , and HumanView . These three core classes
are meant to be used as base classes for your game-specific code. Many of the func-
tions defined in the base classes are meant to be overridden here as well. Let ' s take a
look at the Teapot Wars classes and see how they
'
re defined.
The Teapot Wars Application Layer
The application layer is the place that holds all the operating system-dependent code like
initialization, strings, the resource cache, and so on. Teapot Wars creates the Teapot
WarsApp class, which extends the GameCodeApp class you saw in Chapter 5,
Game
Initialization and Shutdown.
Here
'
sthedefinitionof TeapotWarsApp :
class TeapotWarsApp : public GameCodeApp
{
protected:
virtual BaseGameLogic *VCreateGameAndView();
public:
virtual TCHAR *VGetGameTitle() { return _T(
Teapot Wars
); }
virtual TCHAR *VGetGameAppDirectory()
{
return _T(
Game Coding Complete 4\\Teapot Wars\\4.0
);
}
virtual HICON VGetIcon();
protected:
virtual void VRegisterGameEvents(void);
virtual void VCreateNetworkEventForwarder(void);
virtual void VDestroyNetworkEventForwarder(void);
};
 
 
 
Search WWH ::




Custom Search