28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6<br />

The Foundation of Game Design:<br />

The <strong>Java</strong>FX Scene Graph and the<br />

InvinciBagel Game Infrastructure<br />

In this chapter, you will start to design the infrastructure of your InvinciBagel game, both from the user interface (UI)<br />

and user experience standpoint as well as from the “under the hood” game engine, sprite engine, collision engine,<br />

and physics engine standpoint. You will keep optimization in mind, as you must do as you work through the rest of<br />

the book, so that you do not get a scene graph that is so extensive or complicated that the pulse system cannot update<br />

everything efficiently. This means keeping primary game UI screens (Scene or SubScene nodes) to a minimum<br />

(three or four); making sure that the 3D and Media engine (digital audio and digital video) use their own threads; and<br />

checking that the functional “engines” that drive the game are all coded logically, using their own classes and proper<br />

<strong>Java</strong> 8 programming conventions, structures, variables, constants, and modifiers (see Chapter 3).<br />

First, you will learn about the top-level, front-facing UI screen design that your game will offer the user,<br />

including the InvinciBagel “branding” splash screen he or she sees when launching the application. This screen will<br />

have Button controls on it, accessing other information screens, which you will want to minimize in number, as they<br />

will be either Scene nodes (primary game play screen) or ImageView nodes (the other information screens). These<br />

game support screens will contain things that the user needs to know to play the game effectively, such as game<br />

instructions and a high scores screen. You will also include a legal disclaimers screen (to keep your legal department<br />

happy), which will also have credits for the various programmers and new media artisans who worked on the creation<br />

of the game engine and game assets.<br />

The next level down of the InvinciBagel game design foundation that you will develop is the under the hood, or<br />

back-facing (unseen by the game user), game engine component <strong>Java</strong> class design aspects for the InvinciBagel game.<br />

These include a game play engine, which will use a javafx.animation.AnimationTimer class to control the game<br />

play updates to the game play interface screen; a sprites engine, which will use <strong>Java</strong> list arrays and sets to manage<br />

game sprites; a collision engine, which will detect and respond when a collision has occurred between two sprites; a<br />

physics engine, which will apply force and similar physics simulations to the game play so that sprites accelerate and<br />

react to gravity realistically; and an actor engine, which will manage each of the characteristics of individual actors<br />

in the InvinciBagel game.<br />

Finally, you will modify your existing InvinciBagel.java Application subclass to implement a new splash screen<br />

and buttons for the game play screen and for the other three functional information screens needed to provide these<br />

top-level UI features and the foundational UI screen infrastructure for this InvinciBagel game application. This will<br />

ultimately get you into some <strong>Java</strong> and <strong>Java</strong>FX programming, as you create the foundation for the game.<br />

www.it-ebooks.info<br />

123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!