Skip to content

Latest commit

 

History

History
170 lines (108 loc) · 5.37 KB

README.md

File metadata and controls

170 lines (108 loc) · 5.37 KB

Developer Setup Guide

Before Getting Started

  • Install JDK 11 (project is using this Java version)
  • Install IDE (IDEA is better supported, YMMV with Eclipse)
    • Create as a gradle project (file > open project > select the build.gradle file))

Mac

Windows

Set up WSL, this will give you a command line that can be used to run docker, gradle and the code check scripts.

Getting Started

If you are new to Open Source & Github:

Compile and launch TripleA (CLI)

"./gradlew :game-app:game-headed:run"

For more detailed steps on building the project with CLI, see:

Compile and launch TripleA (IDEA)

IDE setup has the needed configurations for the project to compile. There are checked in launchers that IDEA should automatically find. Look in 'run configurations' to launch the game-client.

Running build checks locally (CLI)

Verify will run all checks (including additional custom checks):

./verify

Tests are split between those that need a database (which runs on docker), vs those that do not.

  • ./gradlew test: Runs all tests that do not require database
  • ./gradlew testWithDatabase: Runs tests that require a local database
  • ./gradlew allTest: Runs all tests

Run Formatting

We use 'google java format', be sure to install the plugin in your IDE to properly format from IDE. Everything can also be formatted from CLI:

./gradew spotlessApply

PR builds will fail if the code is not formatted.

Code Conventions (Style Guide)

Full list of coding conventions can be found at: reference/code-conventions

Please be sure to check these out so that you can fit the general style of the project.

Lobby Development

Launch Local Database

Local database is needed to run the servers (lobby).

## start database
./gradlew composeUp

Launch local lobby

Lobby can be launched via the checked-in run configurations from IDE, or from CLI:

./gradlew :spitfire-server:dropwizard-server:run

To connect to local lobby, from the game client:

  • 'settings > testing > local lobby'
  • play online
  • use 'test:test' to login to local lobby as a moderator

Working with database

## connect to database to bring up a SQL CLI
./spitfire-server/database/connect_to_docker_db

## connect to lobby database
\c lobby_db

## list tables
\d

## exit SQL CLI
\q

## erase database and recreate with sampledrop database schema & data and recreate
./spitfire-server/database/reset_docker_db

Deployment & Infrastructure Development

The deployment code is inside of the '/infrastructure' folder.

We use ansible to execute deployments.

You can test out deployment code by first launching a virtual machine and then running a deployment against that virtual machine. See 'infrastructure/vagrant/REAMDE.md' for more information.

Pitfalls and Pain Points to be aware of

Save-Game Compatibility

  • Do not rename private fields or delete private fields of anything that extends GameDataComponent
  • Do not move class files (change package) of anything that extends GameDataComponent

The above are to protect save game compatibility. Game saves are done via Java object serialization. The serialized data is binary and written to file. Changing any object that was serialized to a game data file will prevent the save games from loading.

Network Compatibility

'@RemoteMethod' indicates methods invoked over network. The API of these methods may not change.

Lots of Manual Testing Required

A lot of code is not automatically verified via tests. If reasonable tests can be added, do so! Generally though even the smallest of changes will need to be manually and thoroughly tested in a variety of maps and scenarios.

FAQ - common problems

Assets folder not found

This is going to be typically because the working directory is not set properly. The 'run' gradle task for game-headed will download game assets into the 'root' directory. When the game starts it expects to find the assets folder in that root directory. If launching from IDE, chances are good the working directory is not set.

Ideally the IDE launcher is checked in and pre-configured. This could be broken and needs to be 're-checked' back in properly.

In short:

  • check working directory is 'game-app/game-headed'
  • chect that ./gradlew downloadAssets has been run and there is an 'assets' folder in the working directory

Google formatter does not work

IDEA needs a tweak to overcome a JDk9 problem. The google java format plugin should show a warning dialog about this if it is a problem.