Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 4 ■ an IntroduCtIon to Game desIGn: Game desIGn ConCepts, Genres, enGInes, and teChnIques

Game Optimization: Balancing Static Elements with the 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’s not really needed, can make your gameplay jerky or stilted. This is why game programming is an art form;
it requires “balance,” as well as great characters, a storyline, creativity, illusions, anticipation, accuracy, and,
finally, optimization.
For instance, Table 4-1 describes some of the different game component considerations for
optimization in a dynamic game. As you can see, there are a lot of areas of gameplay 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,” it can greatly affect the user
experience for your game. We will be getting into game terminology (sprites, collision detection, physics
simulation, etc.) in the next section of the chapter.


Table 4-1. Some Aspects of Gameplay That Can Be Optimized


Gameplay Aspect Basic Optimization Principle


Sprite Position (Move) Move sprite as many pixels as possible while still achieving a smooth
movement appearance


Sprite Animation Minimize the number of frames needing to be cycled to create illusion of
smooth animation


Collision Detection Check for collision between objects on the screen only when necessary (in
close proximity)


Physics Simulation Minimize number of objects in a scene that require physics calculations to be
performed


Flock/Crowd Simulation Minimize number of members that need to be cycled to create an illusion of
crowd or flock


Particle Systems Minimize particle complexity and number of particles needed to create
intended illusion


Camera Animation (3D) Minimize camera animation unless it’s an integral part of (absolutely required
for) gameplay


Background Animation Minimize animated background regions so entire background looks animated
but is not


Digital Video Decoding Minimize digital video use, unless it’s an integral part of (absolutely required
for) gameplay


Gameplay (or AI) Logic Design/code gameplay logic, simulated, or artificial intelligence to be efficient
as possible


Scoreboard Updates Update scoreboard via binding and minimize display updates to once per
second maximum


User Interface Design Use static user interface design so that pulse events aren’t used for UI element
positioning


Considering all these gameplay memory and CPU processing optimization issues will make your
Pro Java 9 games design, and Java coding, quite a tricky endeavor indeed. Needless to say, a lot goes into
professional Java 9 games.

Free download pdf