XFactorDev.net Article   XFactorDev.net Article

 

Prt-1- Basics of the Game

 

Coding styles....well everything has got to start somewhere, so to start with we'll outline the coding styles that will be used for the project.  I'm sure a lot of you code this way anyway.

 

Style What For Example
C Classes CMyDraw
m_ Member variables of a class m_iCount
g_ Global Variables g_iHowManyEggs
i Integer iCounter
p pointer pSomething
sz String szPassword

 

 

What next?  Oh yeah, lets just mention coding style...for this project we'll break the code up into small simple understandable sections/functions/classes.... none of this 2000 line piece of function code that does it all.  Also we'll be commenting the code like crazy..well not to crazy...not going to comment things like, this is an integer int etc...but you get the idea.

 

All functions/ sections will start on a new like...for example any 'if''s will put there '{' on a new line...it makes it easy to read I think... lets show you an example below:

 

if

{

      code goes here

}

 

void myfunction(parameters)

{

      code fo_r the function here

}

 

 

GameEngine Directory/File layout......

Well we don't want all the .cpp and .h files in our one big directory do we....a 100 or so files...so a nicer way to create a sort of hierachy for our code....well just to start off with..we can move and change things if it doesn't work out later on.

 

 

main.cpp/.h

 

 

 

 

 

 

 

 
code  
  game.cpp/.h
gamepad
splash -splash.h/splash.cpp
misc  
.etc.....

 

 

 

so our entry point for our game-engine will be main.cpp.....I think this allows us to design and build and test the various parts of our game engine...and bring it together.

 

 

A single header! ... so all our vital files are in a single header which we simple include in all our other files

 

#gameheaders.h/.cpp

 

 

Now before we start any coding...lets just jot down what we'll need in this skeleton of a game engine:

 

QuickName Description
CGamePad GamePad Class - as the name tells us, for our xbox game pad.
CCamera So we can move the camera with the player...
   
CEnviromentBox  
CTimer  
CCollisionDetection  
CLandscape  
CSkyBox  
   
CParticleEngine  
   
   
   

 

 

 

 

 

 

 

 

 

 

 

 

  XFactorDev.net Article



      
webmaster@xfactordev.net