Hemant Bothra 7d0a5c0edb Issue 989 batch-2 (#1108)
* Adding support for maven assembly plugin to generate executable jar with all dependencies in built

* Merge branch 'master' into issue-989

# Conflicts:
#	abstract-document/pom.xml
#	pom.xml

* Adding maven assemly plugin for projects with name A

* Update in format as per checkstyle, i.e. Spcae in place of tab with size of 2

* batch set - 2 having all project with B and C

* issue-989 d-e-f

* fixing eip pom and adding g-h-i-l-m-n Skipping naked object as it seems it doesn't have main method, will consider this at end

* Adding for O and P projects Skipping Object-Mother as we don't have main method for same.
2019-12-18 22:04:08 +02:00
..
2019-11-16 14:40:23 +02:00
2019-12-18 22:04:08 +02:00

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Game Loop game-loop /patterns/game-loop/ Behavioral
Game programming

Intent

A game loop runs continuously during gameplay. Each turn of the loop, it processes user input without blocking, updates the game state, and renders the game. It tracks the passage of time to control the rate of gameplay.

This pattern decouple the progression of game time from user input and processor speed.

Applicability

This pattern is used in every game engine.

Explanation

Game loop is the main process of all the game rendering threads. It drives input process, internal status update, rendering, AI and all the other processes.

There are a lot of implementations of game loop:

  • Frame-based game loop

Frame-based game loop is the easiest implementation. The loop always keeps spinning for the following three processes: processInput, update and render. The problem with it is you have no control over how fast the game runs. On a fast machine, that loop will spin so fast users wont be able to see whats going on. On a slow machine, the game will crawl. If you have a part of the game thats content-heavy or does more AI or physics, the game will actually play slower there.

  • Variable-step game loop

The variable-step game loop chooses a time step to advance based on how much real time passed since the last frame. The longer the frame takes, the bigger steps the game takes. It always keeps up with real time because it will take bigger and bigger steps to get there.

  • Fixed-step game loop

For fixed-step game loop, a certain amount of real time has elapsed since the last turn of the game loop. This is how much game time need to be simulated for the games “now” to catch up with the players.

Class diagram

alt text

Credits