Ragnarök is Nigh.

Thrive games have been working on their lead game, Dragon of Legends with aspirations of delivering their game to the world via the Steam gaming platform. The game uncovers countless mysteries of the past as players battle across platforms in a vibrant 2D world inspired by Celtic and Norse mythology. The team at Thrive games also wishes to capitalize on the proprietary game engine to be utilized on multiple platforms (PC, OSX, Linux, iOS and Android) in order to stay committed to making our game accessible to everyone. With this in mind, Thrive Games needed help to address the Universal Windows Platform portion of their quest.

Technologies used in this project:

Java
Gradle
ProGuard 
Launch4j
Desktop Bridge

The team was compromised of developers from both the Microsoft community and Thrive Games which included:

Thrive Games

  • Andy Huynh, Software Engineer
  • Matt Paine, Software Engineer
  • Michael Huynh, Chief Technical Officer
  • Nathan Dworzak, project manager

Microsoft Canada

  • Mickey MacDonald, Technical Evangelist
  • Anthony Bartolo, Audience Evangelism Manager

Team

Customer profile

Thrive games is a small Hamilton Ontario based startup gaming design shop. The organization is comprised of a group of talented, like-minded individuals wishing to re-capture that sense of wonder and excitement that they first experienced as young gamers during the 1980s and 1990s. Thrive games goal is to revive the magic and complexity that was found in said timeless classics — while infusing them with modern technologies and innovative gameplay mechanics.

Problem statement

The Java app platform has been the platform of choice for Thrive Games to architect their Norse tale. While Java games could easily be deployed on other store platforms, such as Steam, the team was looking for a way to offer Dragon of Legends on other popular gaming platforms without incurring long development cycles. Being a Kickstarter funded start-up, Thrive Games needed a cost-effective way to reach gamers on other platforms like Windows.

“Our team at Thrive had an awesome time working with Anthony and Mickey from the Microsoft team to convert Dragon of Legends to UWP, and put a demo version up onto the Windows store.

At first we were initially concerned about the technical implications of having our code based in Java, but the conversion process worked quite well on its first attempt and the only thing required from our developers was to compile an executable .jar file.” - Nathan D, Chief Operating Officer at Thrive Games.

Solution, steps, and delivery

Project Objectives

The objective of this project was to capitalize on the time invested building the proprietary game engine written in Java to be enjoyed on the Universal Windows Platform via a multitude of devices. The following needed to be completed to accomplish this:

  1. Create the Java package file, the JAR, from the game engine’s build output.
  2. Use a wrapper to convert the JAR to a Win32 executable.
  3. Convert the created Win32 application to a UWP app
  4. Submit the completed UWP game to the Windows Marketplace

In addition to the above core goals, our stretch goal is to complete the conversation of the Dragon of Legends UWP game in a span of 1 day.

Execution

Tools and Technologies Used

  • Java
  • Gradle
  • ProGuard
  • Launch4j
  • Desktop Bridge

Desktop Bridge architecture diagram

Our 1st task was to build the JAR package file from the libGDX game engine’s output using Gradle. To do this we ran Gradle from the commandline with the command “gradlew desktop:dist”.

Next we preformed a few steps to obfuscate the project to help protect the game assets and code from being extracted from the final release. We accomplished this by using ProGuard, and performing the following steps.

  1. Construct a config file (config.pro) file. This file lists all the classes, fields, and methods, that need to be kept and/or that their names need to be kept (Refer to https://www.guardsquare.com/en/proguard/manual/ for more details on how this is accomplished.)

  2. Once the config file is created, we then ran ProGuard from the command line, using the command “java -jar proguard.jar @config.pro”.

Once the obfuscating process had completed we then had a JAR package that could be used for release. The next step was to the create a Win32 executable application. We did this by using a cross-platform Java executable wrapper, Launch4j. This wrapper allows a packaged Java application to be ran just like a native Win32 application, packaging all dependencies with it, including the JRE (Java Runtime Enviroment) needed.

Launch4j architecture diagram

*Image source http://launch4j.sourceforge.net

The steps taken to create the executable in Launch4j are as follows:

  1. Launch Launch4J and make sure you are on the “Basic” tab.
  2. On the “Output File*” input: Browse for the destination where you want your EXE file to be name via this “desktop/…../ProjectName.exe”
  3. On the “Jar*” input: Browse and locate the jar file you want to convert in your PC
  4. On the “Icon” input: Locate your “ico” file for the icon.
  5. Go to the “JRE” tab.
  6. On the “Min JRE version” input: type in “1.4.0”
  7. Click on the gear icon on the top and press save (destination preferably in output file destination, name - “ProjectName”).
  8. Press the “Play” button next to and the Jar file should be converted to EXE.

Once completed, we then had a Win32 executable that we could convert to a UWP application using the Desktop Bridge kit. The conversion process itself was done manually due to the game’s lack of installer and the developer’s knowledge of the files needed to operate the game. The following steps were completed to convert the Win32 app manually.

  1. Downloaded and installed the Window 10 Software Development Kit
  2. Create the appxmanifest.xml manually (detailed steps found here)
  3. Opened the Command Prompt in administrator mode
  4. Navigated to C:\Program Files (x86)\Windows Kits\10\bin\x86
  5. Entered the following command: MakeAppx pack /d “Path to Files” /p “Application Name”.appx

We then had an appx package of the game. In order for us to then install and test in on local machines, the following steps were then completed to sign and install the application.

  1. Opened the Command Prompt in administrator mode
  2. Navigated to C:\Program Files (x86)\Windows Kits\10\bin\x86
  3. Created a certificate to sign the appx (detailed steps found here)
  4. Used the SignTool to sign the application with the created certificate (detailed steps found here)
  5. The certificate was then installed on the testing computer, which allows applications signed with that certificate to then be installed
  6. The last step was to double click the appx and install the application, just as it would be if downloaded from the store.

Submitting the game

###Challenges

The biggest challenge faced was the process of embedding the dependencies, like the JRE in the final build. After some careful consideration and research, the team decided on using Launch4j. By using Launch4j the team was able to create a lightweight Windows native executable that allowed them to bundle the JRE and any other libraries or dependencies, with out the need to modify any existing code or infrastructure.

Release

The game is now available in the Windows Store for download on Windows 10 devices. Store Listing

Screenshot1 Screenshot2

Learnings

  • While not a large time consuming effort, it does take multiple steps and tools to convert a native Java application to a Win32 and ultimately a UWP application. Learning these steps is key for helping others in the future.
  • The team ran the manual desktop bridge process utilizing the makeappx command as a customer appmanifest.xml was created to address file asset placement
  • The Windows Store team needs to be notified when submitting a converted UWP app as they need to add “Run Full Trust access” as a function of the submitted app to run properly. This process can take sometime and should be started as soon as possible to allow submission to be completed.

Conclusion

Thrive Games was very impressed with quickness of adding Dragon of Legends to the Windows Store. The team at Thrive is now working on finalizing the game and adding the much anticipated multi-player features. The plan is to do a world wide launch on all platforms in the next few months with would be Norse gods battling it out on their Windows 10 devices.