Java Game Development Using jMonkeyEngine

javagamedevelopmentJava has been around for years as a fully capable gaming platform that never really took off. The introduction of Adobe Flash quickly dominated the online gaming market. Many people do not realize that proponents of Java gaming have been quietly making powerful game development tools in the background that can produce some truly impressive results.

Java was created on the premise of “code once, run everywhere” and it has certainly fulfill that purpose in many other aspects of online computing. Another great thing about Java is that the very popular Android OS is based entirely on this programming language. This means your desktop or web browser-based Java games can easily be migrated to Android for even more exposure and success. Introduction to Mobile Games Development provides additional insight into the highly-profitable world of mobile gaming platforms.

One of the other reasons why Java games haven’t taken off when compared to other programming languages is because there has historically been a lack of powerful game development engines available for Java.  Games engines such as Unity 3D (written in C++) have dominated the market.

In recent years, this has changed dramatically as engines such as jMonkeyEngine have been introduced. Now it is possible for just about anyone to start creating powerful 3-D games on their home computer which can then be played by gamers around the world.

What is jMonkeyEngine?

Unfortunately, many programmers have dismissed Java as nothing more than a basic platform for 2-D games. The introduction of powerful 3-D game engines such as jMonkeyEngine has completely torn down this inaccurate perception. Using these powerful game engines, you can create stunning 3-D worlds for games that can be played across multiple platforms with performance that rivals lower-level languages such as C++.

JMonkeyEngine is an open source 3-D game development engine written entirely in Java. Game developers are able to maximize Java’s capabilities for all modern operating systems and for the Android mobile platform.

Although there are other powerful 3-D Java game development engines available, jMonkeyEngine offers some key benefits including:

  • jMonkeyEngine is both free and open source. Originally created in 2009, this has helped to foster an entire community of developers that are constantly creating bug fixes and implementing new features. Developers can also download numerous plug-ins directly from the IDE.

  • The flexibility of jMonkeyEngine means that you do not have to use the built-in IDE (although it is easy to use and powerful) and instead opt for more popular IDE such as NetBeans or Eclipse. JMonkeyEngine offers step-by-step tutorials that teach you how to set up the jMonkeyEngine environment within these IDEs.

  • JMonkeyEngine is written in Java. This is great news for you because you do not have to learn a separate language to modify the game engine as you see fit. Many Java game development engines are actually written in in C++ or another low-level language; requiring developers to learn at least basic commands in these languages to successfully manipulate the development environment. Since the engine is based entirely on Java, games developed using jMonkeyEngine can easily be ported to OS X, Windows, Linux, and Android.  Support for iOS is also anticipated in coming months.

  • Based on OpenGL, jMonkeyEngine also offers support for shaders. In fact, new updates provide a Shader Editor making it easy for you to create your own shaders.

  • Even though jMonkeyEngine is best suited for creating 3-D games, there are open source shaders available that make 2-D game creation not only possible, but relatively easy.

Using jMonkeyEngine

Now that you’re sold on the powerful opportunities available to you as a Java game developer when using jMonkeyEngine as the basis for your creations, it’s time to learn how to use the engine properly.

As previously mentioned, jMonkeyEngine is written entirely in Java. A Java background is a requirement for successfully creating games with this tool. You can get a solid Java foundation from Java Fundamentals I and II.

In addition to installing the jMonkeyEngine SDK, you also need to install Blender. Blender is another free and open source program used for creating 3-D graphics. You will use Blender to create characters and other objects within the game environment. Fortunately, importing Blender creations into jMonkeyEngine is extremely simple and only takes a couple of minutes to configure. Create a Character in Blender 3D is a great way to learn 3D modeling techniques.

The development team of jMonkeyEngine states that it is always easier to correctly program in Java compared to lower-level languages such as C++. Combined with the cross-platform support and integration with Android, jMonkeyEngine is a powerful solution for any game you decide to create.

The great thing about developing games is that it has often been recognized as an excellent way to learn a programming language. By taking some time to understand basic Java commands and syntax, you can learn the rest as you start creating your own game.  As your knowledge improves, Advanced Java Programming can take your programming skills to the next level.

This is made even easier with jMonkeyEngine because of the extensive documentation provided with the program. There are also quite a few example projects packaged with the SDK that can be used to learn basic and advanced gaming concepts.

The key thing to remember about using jMonkeyEngine to create 3-D games is that it is not a drag-and-drop solution. The development team has done an excellent job of making it very easy to use, but some programming knowledge is still required. This requirement is even more significant as you get into some of the advanced game features that may require that you edit jMonkeyEngine itself for proper rendering of your various game assets.

Are there other ways to create powerful 3-D games in Java? Absolutely. The difference is that jMonkeyEngine is a fully functional solution that grows with you as your experience and knowledge in 3-D gaming increases. Leveraging the well documented tutorials that come with the SDK, you can be creating impressive 3-D worlds on your own in no time at all.