Skip to content

A cross-platform template game for jMonkeyEngine providing compatibility for both desktop and android environments.

License

Notifications You must be signed in to change notification settings

Electrostat-Lab/Cross-platform-template

Repository files navigation

Cross-platform-template

Codacy Badge

A cross platform template for jMonkeyEngine games supporting both common-platform and platform-specific environment using gradle sub-projects.

Modules:

  1. Game module :game : holds build.gradle dependencies for the game code & should hold your code.
  2. Game-assets module :game-assets: holds game assets at ./game-assets/src/main/resources and supports java code specific to loading assets which is also a cross-platform module.
  3. Desktop module :desktop : holds build.gradle for desktop dependencies and implements the :game module and the game-assets module, this module can hold the desktop dependent gui and hardware code.
  4. Android module :android : holds build.gradle for the android dependencies and implements the :game module and the game-assets module, this module can hold android dependent gui and hardware code.

Features:

  • A platform independent assets module :game-assets for game assets.
  • A platform independent game module :game for game logic.
  • Android Support via :android module.
  • Desktop Support via :desktop module.
  • Desktop executable jar building task.
  • Automate game building using gradle tasks via GitHub CI.
  • Automate game releasing on-release via GitHub CI on-release action.
  • Android emulator and adb helper tasks (wip).

Running Game:

On Desktop:

./gradlew run

On Android:

Install the app on a connected device via adb.

┌─[✗]─[twisted@parrot]─[~/AndroidStudioProjects/CrossPlatformModule]
└──╼ $./gradlew :android:installDebug

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Redmi Note 6 Pro - 10' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 4s
33 actionable tasks: 1 executed, 32 up-to-date

Building Game:

Desktop:

$./gradlew :desktop:clean &&
 ./gradlew :desktop:build && 
 ./gradlew :desktop:copyJars && 
 ./gradlew :desktop:releaseJar 

Android:

$./gradlew :android:clean &&
 ./gradlew :android:build && 
 ./gradlew :android:assemble

Appendix:

Credits:

=> Thanks Ali_RS for the suggestion of separating game and game-assets module from desktop and android ones.
=> Thanks wizzardo for fixing creating jar from desktop issue.

References:

=> Android studio-AGP-Gradle release notes

=> Gradle wrapper for android

=> Gradle DSL

=> Gradle multi-project-builds

=> Gradle/Groovy Udacity course by google

=> See JMonkeyEngine Android Examples:

=> See JMonkeyEngine RPI armhf Desktop Example:

Releases

No releases published

Packages

No packages published

Languages