Required dev tools:
/etc/environment
ANDROID_HOME="/opt/android"
(need to re-login for it to take effect)sudo ./sdkmanager "platforms;android-27"
sudo ./sdkmanager "platforms-tools"
sudo ./sdkmanager "build-tools;27.0.3"
IDEs are unreliable as shit breaks consistently between versions. We will rely purely on Gradle commands to build, run and test our code. Shortcuts to these Gradle commands can be added to your IDE but we should not rely on their build system at all. For more information see: https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#running-the-android-project
./gradlew desktop:run
./gradlew android:installDebug android:run
./gradlew core:cleanTest core:test
./gradlew desktop:dist
./gradlew android:assembleRelease
The game code is designed so that new levels can be added without the need to change any Java code.
Level data are located within android/assets/data/{#}/
and android/assets/i18n/model/script/dialogue/Level{#}
.
Levels are composed of four data files: script.conf, world.conf, terrains.json and Level#.properties
.
script.conf
contains the win/lose conditions and various ship spawn/removal events. See
com.jingyuyao.tactical.model.script
package for all the available script logic. world.conf
contains
the initial ship data and their position in the level, player spawn coordinates, and any inactive
ships that can be spawned by the script later. terrains.json
is generated by Tiled and contains a
grid map of the level. Level#.properties
contains a turn by turn dialogue trigger. See
com.jingyuyao.tactical.data.DialogueLoader
on how the keys are parsed.
The game contains two primary graphic assets: tilesets and textures. Tilesets are used to render
terrains and textures are used to render everything else (e.g. animations and overlays). Textures
are created from numerically labelled image files in the assets_raw
folder. These texture/animation
files can be generated from a tool such as Piskel. After these "raw" assets are generated and placed
in the assets_raw
folder they need to be packed using the TexturePackerRunner
class into a
format used by libGdx.
The game follows MVC and uses Guice to share objects between components. We follow Google's Java style guide for all Java files.
android/
: Android launcher + packed and unpacked assetsdesktop/
: Desktop launchercore/
: Game codeAvoid using Guava's collection classes since they cannot be serialized by Kryo (without additional work).
We use EventBus to communicate model events to the view. We should NOT use EventBus to communicate between model components. This is due to the order sensitive nature of model logic. We also should not use EventBus for things that can be cheaply polled per frame by the view.
Our initial game data are saved in the Hocon format: https://github.com/lightbend/config/blob/master/HOCON.md
These data files are deserialized using Gson to create the initial game objects. We make use of the
runtime type adapter from gson/extra to add type information to any generic list of objects. Each
concrete classes of the generic types should be registered to in a RuntimeTypeAdapterFactory
.
Nulls are checked during deserialization of Json objects. See NullCheckAdapterFactory
for more
information. Kryo is used to serialize game state after initial data is loaded.
We currently use a library called VisUI for development. It comes with its own skin files that are loaded from classpath by invoking a static method. This means we need to enable headless environment to be able to call that method during test.