Game Development Reference
In-Depth Information
levels, logic, and AI. You will also examine the different types of games that can be de-
signed, and how they differ from each other.
Then, you will explore the role that multimedia assets play in today's visually (and
aurally) impressive games. You will learn about the principles of
digital imaging
,
di-
gital video
, and
animation
as well as
digital audio
, as you will be using many of these
new media asset types over the course of the topic, and will need this foundational
knowledge to be able to work with them.
Finally, you will take an in-depth look at the bootstrap JavaFX application code
that you generated in
Chapter 2
and at how the Java .main() method and the JavaFX
.start() method create the primaryStage Stage object, using the
Stage()
constructor
method, and, inside that, create a Scene object named scene, using the
Scene()
con-
structor method. You will look at how to use methods from the Stage class to set the
scene, title the stage, and show the stage as well as how to create and use
StackPane
and
Button
class (objects) and how to add an
EventHandler
to a button.
High-Level Concept: Static vs. Dynamic
I want to start out with a high-level concept that touches on everything that I will be
talking about in this chapter, from the types of games you can create, to game optimiz-
ation, to JavaFX Scene Builder and JavaFX Scene Graph. You took a look at this
of a Java constant, which is fixed, or
static
, and does not change, versus a Java vari-
able, which is
dynamic
and changes in real time. Similarly, a UI design in JavaFX
Scene Graph can be static (fixed and immovable) or dynamic (animated, draggable, or
skinnable, meaning that you can change the UI look to suit your personal taste).
The reason these concepts are important in game design and development is that
your game's engine, which you design to run or render your game, must constantly
check on its dynamic portions to see if they have changed and require a response (up-
date a score, move a sprite position, play an animation frame, change the game piece's
state, calculate collision detection, calculate physics, and so on). This checking (and
the ensuing processing) on every frame update (called a pulse in JavaFX; see
Chapter
ics, and the like are conforming to your Java game engine logic, can really add up, and,
at some point, the processor that is doing all this work can get overloaded, which can
slow it down!
The result of this overloading of all the real-time, per-frame checking that enhances
the dynamics of your game (play) is that the
frame rate
at which your game is running