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

JMonkey is also a free, open source game engine targeted at Java game developers who want to create
i3D games (Figure 4-2). This software is programmed entirely in Java and is intended to provide wide
accessibility and rapid deployment.


It’s important to note that I’m going to show you how to create games using only Java (8 or 9) and
JavaFX 8 or 9 because that is what this book is about: using and learning about the native Java APIs
(of which one is JavaFX) to make games or IoT applications. I just wanted to make you aware of the two
leading Java games platforms before we start.


Physics and Collision Engines: Jbox2D, JBullet, Dyn4j, Jinngine


There are a large number of third-party physics engines that also include support for collision detection, so
you can add collision and physics at the same time to your game using any one of these collision physics
code libraries to your pro Java games or IoT application projects simply by importing a JAR file into your
project and calling the proper APIs.
Jbox2D is a “port” or recoding for use in Java of the Box2D C++ physics engine. Box2D is an open
source, C++-based physics and collision engine for simulating rigid body dynamics in i2D (X,Y) space.
Box2D was developed by Erin Catto and was released under the zlib license, which does not require formal
acknowledgment of usage; however, it is encouraged that you give credit to Box2D in your pro Java game if
you use the Jbox2D API port from C++ Box2D.
JBullet is a partial port of the Bullet 2.7 3D C++ physics engine for use in Java. Bullet 2.87 is an open
source, C++ physics and collision engine for simulating rigid body dynamics in 3D (X,Y,Z) space. The Bullet
collision detection and physics library was developed by Advanced Micro Devices, otherwise known as
AMD. It can be found at http://bulletphysics.org if you want more information. JBullet was released
under the zlib license, which does not require formal acknowledgment of usage. However, it is encouraged
that you to give credit to JBullet in your pro Java game if you use the JBullet API partial port from the Bullet
2.7 C++ physics engine.
The dyn4j engine shown in Figure 4-3 is a 2D collision detection and physics engine compatible with
Java 6 and 7, meaning that it works with the Java 8 and 9 versions we are covering in this book. Dyn4j was
designed to be stable, extensible, optimized (fast), and relatively easy to use. Dyn4j is free for commercial
use, as well as for use in noncommercial applications. It is licensed by its author, William Bittle, under the
BSD licensing model.


Figure 4-2. jMonkeyEngine 3.0 is an open source cross-platform game engine compatible with Java and
JavaFX

Free download pdf