Archived

This topic is now archived and is closed to further replies.

johnc82

Game Loop and Game Engine

Recommended Posts

m_wherrett    122
more in depth than what?
I don''t know, but I''ll give you a little info anyway.

Every game operates in a constant loop whereby, input is read, objects are updates and graphics are displayed. In terms of pseudocode, it could look something like this...

while(gameplaying == true)
{
checkInput();
updatePlayers();
updateEnemies();
drawGraphics();
}

Obviosuly that is just an example but it should give you the general idea. That is the basics of how a game-loop works.


A game engine can mean different things to different people, but I''ll explain it in terms of that game-loop example.

The engine is the real work-horse of your game taking care of that game-loop. It will start by loading all the resources (graphics, levels and sounds etc). Once everything is loaded it can go about setting the game in motion. How this is achieved is obviously dependant on your game but lets assume its a platform game. It will load all the level data, load the player data, the enemy data, the sounds and so on. Once done it will enter that aforementioned game-loop and take care of that constant looping process.

Not sure if that will help but I hope it does something useful for ya.

Share this post


Link to post
Share on other sites
m_wherrett    122
Well, give us an idea of what you can do first? That way we can gauge how much detail you require.

Have you made any games before?
What language?
How long have you been programming?
And so on

Share this post


Link to post
Share on other sites
Mathematix    259
The game loop is the cycle of instructions executed that comprise the entire game engine. The game engine itself can be subdivided into a graphics engine, sound engine, etc. A game loop roughly follows the structure:

1) Initialise game.

Then the actual loop is:
2) Accept user input
3) Update game state
Terminate loop.

4) Close game.

Hope this clarifies.

Share this post


Link to post
Share on other sites
Rob Loach    1504
I suggest using states in the game loop to tell if it''s in the main menu, in-game, or end screen....

while(gameplaying == true)
{
switch(gameState)
{
blah blah blah.......
}
}



- Rob Loach
Current Project: Go Through Object-Oriented Programming in C++ by Robert Lafore

"Do or do not. There is no try."
- Yoda

Share this post


Link to post
Share on other sites