Game Development Reference
In-Depth Information
// Process inputs
...
update game world with gameDeltaTime
// Render outputs
...
while (time spent this frame) < targetFrameTime
// Do something to take up a small amount of
time
...
loop
loop
There is one further case that must be considered: What if the game is sufficiently
complex that occasionally a frame actually takes longer than the target frame
time? There are a couple of solutions to this problem, but a common one is to skip
rendering on the subsequent frame in an attempt to catch back up to the desired
frame rate. This is known as dropping a frame , and will cause a perceptible visu-
al hitch. You may have noticed this from time to time when playing a game and
performing things slightly outside the parameters of the expected gameplay (or
perhaps the game was just poorly optimized).
Game Objects
In a broad sense, a game object is anything in the game world that needs to be
updated, drawn, or both updated and drawn on every frame. Even though it's de-
scribed as a “game object,” this does not necessarily mean that it must be repres-
ented by a traditional object in the object-oriented sense. Some games employ tra-
ditional objects, but many employ composition or other, more complex methods.
Regardless of the implementation, the game needs some way to track these objects
and then incorporate them into the game loop. Before we worry about incorporat-
ing the objects into the loop, let's first take a look at the three categories of game
objects a bit more closely.
Search WWH ::




Custom Search