Game development with Java, Kotlin and JavaFX

FXGL — a JavaFX library for game developers

Almas Baimagambetov

Retro old computer video game image via Shutterstock

Let’s be honest: Deep into the heart of every developer there’s a craving to create a game. You can now learn to do it in JavaFX with the help of the new FX gaming library (FXGL). The comprehensive list of features, along with the extensive documentation will allow you to start using it right away.

FXGL (FX Game Library) is a game development library based on JavaFX 8. It uses JavaFX as the graphics framework and application management system. The rest of the functionality is provided by other libraries that have been tightly integrated into the FXGL environment. For instance, physics simulations are done by JBox2D, while entity management is provided by Ents. The source code and guide on how to use FXGL are available on GitHub.

Screen Shot 2016-07-19 at 10.59.00 AM


FXGL use case

FXGL is primarily targeted at students who want to learn and practice game development. The framework is perfect for assignments where one needs to write a simple game or a demo. It is, however, important to ensure that the use of external libraries is allowed in the assignment brief.

The library is also a good fit for programmers who develop games as a hobby, since these tend to be graphically simple and focused on the gameplay instead. One of the main reasons why FXGL is unsuitable for commercial projects is the fact that the underlying graphics framework has limited support for 3D, mobile and web. Hence, if you want to become a full-time game developer, you might as well focus on libraries that can produce high quality games, such as libGDX, JMonkey (Note: only Java libraries are given).

On the other hand, FXGL can be used for fast prototyping and the fact that no native libraries are required may also be considered an advantage. In other words, there is nothing stopping you from packaging the Java Runtime Environment with your game and targeting the desktop market.

Development and usage

Although FXGL is currently under development, most of the required functionality has already been implemented. Java is used for top level interfaces, while Kotlin, being more pragmatic, takes care of the implementation. The library itself can be used with both Java and Kotlin, depending on which language you prefer to use.


Almas Baimagambetov

Almas is engaged with research in the field of Automated Diagram Generation. He also teaches Computer Science. In his spare time, he enjoys playing video games as well as designing and developing them.

comments powered by Disqus