Game Development Reference
In-Depth Information
which is filled with JavaFX UI (class) objects, based on the UI design structure (hier-
archy) created using FXML. I will give you an overview of how this works later in the
chapter so that you have a handle on how this works (see the section “JavaFX Scene
Builder: Using FXML for UI Design”).
Game Optimization: Balancing Static
Elements with Dynamic
Game optimization comes down to balancing static elements, which do not require
processing in real time, with dynamic elements, which require constant processing. Too
much dynamic processing, especially when it is not really needed, can make your game
play jerky, or stilted. This is why game programming is an art form: it requires balance
as well as great characters, a story line, creativity, illusion, anticipation, accuracy, and,
finally, optimization .
Some of the different game component considerations for optimization in a dynam-
ic game are listed in Table 5-1 . As you can see, there are a lot of areas of game play
that can be optimized to make the processor's workload significantly less “busy.” If
you have even one of these primary dynamic game processing areas “run away” with
the processor's precious cycles per frame, this can greatly affect the user experience
for your game. I will be getting into game terminology (sprites, collision detection,
physics simulation, and so on) in the next section of the chapter.
Table 5-1 . Aspects of Game Play That Can Be Optimized to Minimize System Memory
and Processor Cycle Usage
Game Play
Aspect
Basic Optimization Principle
Sprite position
(Move)
Move sprites by as many pixels as possible to achieve smooth movement
on the screen.
Collision detec-
tion
Check for collisions between objects on the screen only when necessary
(in close proximity).
Physics simula-
tion
Minimize the number of objects in a scene that require physics calcula-
tions to be performed.
Sprite anima-
tion
Minimize the number of frames that need to be cycled to create an illusion
of smooth animation.
 
 
Search WWH ::




Custom Search