Real Time Game Loop Models for Single-Player Computer Games LUIS VALENTE 1 AURA CONCI 1 BRUNO FEIJÓ 2 1 Universidade Federal Fluminense – Instituto de Computação {lvalente,aconci}@ic.uff.br 2 ICAD/IGames/VisionLab, Departamento de Informática – PUC-Rio bruno@inf.puc-rio.br ___________________________________________________________________ Abstract There are few academic works on game loop models and algorithms in the literature. Also, the literature lacks a comprehensive conceptual framework for real time game loops. This paper proposes a general classification for real time game loop models and presents an algorithm that improves one of the most common models for single-player computer games. Keywords: Real time loops, computer games ___________________________________________________________________ 1 Introduction Real time systems have time restrictions to perform their work. In other words, the time required to execute all tasks must not exceed some threshold; otherwise the system will fail [1]. Interactive real time systems have three main modules: input data acquisition, processing and presentation of results [2]. In computer games, the input system corresponds to input device management (such as keyboard, mouse, and joystick). The processing stage is responsible for taking decisions that affect the game state. The presentation stage presents the results from other stages, using audio and video. During the game execution life cycle, if it is not possible to execute all those complex tasks below some time threshold, the interactivity of the game may not be acceptable. This issue characterizes computer games as a heavy real time application. A common parameter, which an application may use to estimate performance, is the amount of frames per second (FPS) displayed on the screen. A frame represents an image that the application builds and displays on screen. A common accepted lower bound for FPS, in order to maintain interactivity, is 16 frames per second. A frame rate from 50 to 60 FPS is considered optimal. A real time game loop model describes a particular way of organizing the execution of game tasks. This important issue is in the heart of real time applications. However, it is very difficult to find academic works on this subject. The works by Dalmau [2], Dickinson [6], and Watte [10] are amongst the few ones. Also, the literature lacks a comprehensive conceptual framework for real time game loops. This paper proposes a general classification for real time game loop models and presents an algorithm that improves one of the most common game loop models. Although some of the loop models can be used in any kind of game, the present paper focuses on single-player computer games. This research was performed during the specification of the Guff framework [3], which is a game development tool. 2 Real Time Loop Models A real time game loop model is an approach to organize the execution of game tasks. The way these tasks are organized determines the game architecture and how the game runs in different machines. While the game is running, the user perceives the stages of input data acquisition, processing, and rendering as occurring simultaneously. However, most computers today have only one processor and limited amount of memory, so it is necessary to arrange such tasks in order to simulate that parallelism and to maintain interactivity. In fact, this is the major motivation to elaborate