Game Development Reference
In-Depth Information
will decrease. That's right, like digital video and animation, Java 8 games have frame
rates, too, but Java 8 game frame rates are based upon the efficiency of your program-
ming logic. The lower the frame rate of your game, the less smooth the game play be-
comes, at least for dynamic, real-time games, such as arcade games; how smoothly a
game plays relates to how seamless (enjoyable) the user experience is for the custom-
er, the game player.
For this reason, the concept of static versus dynamic is very important to every as-
pect of game play design and makes it easier to achieve a great user experience with
certain types of games than with others. I will be discussing different types of games
later in the chapter (see the section “Types of Games: Puzzles, Board Games, Arcade
Games, Hybrids”), but, as you might imagine, board games are more static in nature,
and arcade games are more dynamic. That said, there are optimization approaches that
can keep a game dynamic, that is, seem like a lot is going on, when, from a processing
point of view, what is really going on is quite manageable. This is one of the many
tricks of game design, which, when all is said and done, is about optimization.
One of the most significant static-versus-dynamic design issues in Android (Java)
programming is UI design using XML ( static design ) versus UI design using Java ( dy-
namic design ). The Android platform allows UI design to be done using XML instead
of Java so that nonprogrammers (designers) can do the front-end design for an applic-
ation. JavaFX allows exactly the same thing to be done using FXML . You have to cre-
ate an FXML JavaFX application to do this, as you saw in Chapter 2 (see Figure 2-4 ,
right-hand side, third option, “JavaFX FXML Application”). Doing so will add the
javafx.fxml package and classes to the application, letting you design UIs, using
FXML, and later having your Java programming logic “inflate” them so that the design
consists of JavaFX UI objects.
It is important to note that using FXML adds another layer, containing the FXML
markup and its translation and processing, to the application development and compila-
tion process. I am going to demonstrate later in the chapter how this is done, in case
your design team wants to use FXML for the UI design work process, instead of Java
(see the section “JavaFX Scene Builder: Using FXML for UI Design”). I am doing this
because I want to cover all the design options in JavaFX, including FXML, to make
sure that this topic is complete in its coverage of what can be done using Java 8 and
JavaFX 8.0. At the end of the day, this is a Java 8 programming title, however, so my
primary focus during this topic will be using Java 8, not FXML.
In any event, the point that I am making regarding using XML (or FXML) to create
the UI design is that this approach can be viewed as static, because the design is cre-
ated beforehand, using XML, and is “inflated” at compile time, using Java. Java infla-
tion methods use the designer-provided FXML structure to create the scene graph,
Search WWH ::




Custom Search