Game loop

from Wikipedia, the free encyclopedia

A game loop is the event loop of a computer game . In it the processing of the user's inputs is initiated, the calculation of new world states is started and the generation of new outputs is instructed. In contrast to the EVA principle , a game loop continues without any further input from the user.

Game loop

Phases

The three phases of input, simulation and output continue to loop until the user exits the application.

input

At the beginning of each loop iteration, all entries made by a user since the last loop iteration are processed. Which input devices are involved depends on the area of ​​application. The keyboard and mouse input devices are common for computer games. With complex VR systems, however, additional devices such as a tracking system, microphones for voice control and gesture recognizers such as the LeapMotion are added.

One of the main tasks of this phase is to combine inputs that were made at different times to form consistent information.

simulation

In this phase, a new world state of the application is calculated on the basis of any entries made by the user and information from the simulated scene. Typical sub-systems of these phases are, for example, application logic, animation and physics simulation.

output

In this last phase, the output is made to the user. The two most common forms of output are visual rendering and acoustic output. Which output channels are available in which form, as with the input, differs greatly between the respective application areas.

Frequency limitation

A game loop is limited in its maximum frequency for two reasons. On the one hand, output channels such as B. a screen, a maximum output frequency. An output at a higher frequency would therefore not be displayed by the device. On the other hand, limiting the frequency also ensures that the game runs at the same speed as possible (see Delta Time ). The latter was z. B. a problem with games that were written in the late 1980s and early 1990s and were no longer playable on faster processors.

literature

  • Gregory, Jason and Lander, Jeff: Game Engine Architecture . First edition. Taylor & Francis Ltd., 2009, ISBN 978-1-56881-413-1 .
  • Game Programming Patterns: Game Loop
  • Valente, Luis and Conci, Aura and Feijo: Real time game loop models for single-player computer games . In: Proceedings of the IV Brazilian Symposium on Computer Games and Digital Entertainment . 2005, p. 89--99 ( puc-rio.br [PDF; accessed on March 2, 2016]).
  • Joselli, Mark and Zamith, Marcelo and Clua, Esteban and Montenegro, Anselmo and Leal-Toledo, Regina and Conci, Aura and Pagliosa, Paulo and Valente, Luis and Feijo, Bruno: An adaptative game loop architecture with automatic distribution of tasks between CPU and GPU . In: Comput. Entertain. tape 7 , no. 4 . ACM, January 2010, ISSN  1544-3574 , p. 50: 1--50: 15 , doi : 10.1145 / 1658866.1658869 .