Skip to content

Creating a new Project

Sri Harsha Chilakapati edited this page Aug 20, 2016 · 3 revisions

Due to the cross platform nature of SilenceEngine and it's goal to compile to multiple platforms from a single code base, setting up a project is a bit difficult and involves writing build scripts for each launcher modules.

Project Creator

To make the process easier, SilenceEngine provides a project creator utility, which takes configuration options from you, and creates a project in just a few steps. Before you can proceed, there are some system requirements to be satisfied.

  • Java Development Kit 8 and above (preferrably Oracle JDK).
  • The Gradle 2.13 build system. You are going to use it to compile your game.
  • 4 GB of RAM (recommended as GWT is RAM hungry compiler, but 1GB works too).
  • OpenGL 3.2 capable graphics card (should support Core profile OpenGL).
  • Latest Android SDK with API level 22 or greater.
  • A real Lollipop or later Android device (phone, tablet, tv or anything) which supports OpenGL ES 3.0.
  • A modern web browser supporting HTML5 and WebGL (Chrome, Firefox and Opera works).

Once you are sure you have these requirements met, you can download the project creator tool from this repo. It is a runnable JAR which you can double click to run and see the above dialog where you can select your options.

Note:

You don't need the Android SDK if you are not going to build for Android. Similarly, a WebGL based browser is not needed in case you are not building for HTML5.

They are only necessary to compile to the target platforms. If that platform is of no interest to you, you can omit them.

These options are self explanatory, so once you have configured them and selected the required modules, you can proceed with generating the project.

Once you have generated the project, go to the folder. You will find different module directories (one core game module, and remaining are launcher modules) along with gradle build scripts. From here, you have to install the gradle wrapper in this project and build it.

$ gradle wrapper --gradle-version=2.13

That will generate the gradle wrapper, which you can call from the project directory. If you distribute this project to others who doesn't have gradle can use the wrapper to build your project.

$ ./gradlew clean build

This command will clean the sources and builds the project. Issuing this command will build all the targets that you have selected in the project creator. You will find the binaries in the respective module directories.

Target Binary
Html5 MyGameHtml5\build\libs\MyGameHtml5.war
Desktop MyGameDesktop\build\libs\MyGameDesktop.jar
Android MyGameAndroid\build\outputs\apk\MyGameAndroid-release-unsigned.apk

The HTML5 project is compiled to be a Web archive, which can be extracted to any server (it cannot be run from filesystem). The desktop project is compiled to be a runnable fat jar, which you can double click to run. The android project is compiled into debug and release apk files which you can install on the device.

To run the HTML5 game in the browser, you can issue the command superDev and play it from localhost.

$ ./gradlew superDev

Now go to localhost:8080/MyGameHtml5/ in your browser and play the game. Enjoy programming with SilenceEngine!!

Clone this wiki locally