Designing the game loop

Strategy games have one of the most intensively changing gameplays. At each point in time, many actions happen simultaneously. Readers finish their building; a barrack produces a soldier; a soldier gets attacked by the enemy; the player commands units to move, build, attack, or run; and so on. The game loop handles everything. Usually, a game engine provides a well-designed game loop.

The game loop runs while we play the game. As we already mentioned, the loop handles player actions, updates the game state, and also renders the game (makes state changes visible to the player). It does so on each iteration. The loop should also control the rate of gameplay, that is, its FPS. A common term for one iteration of the game ...

Get Expert C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.