This repository contains the backend for the Tower Defense minigame.
It persists the game data (configurations, game results, etc.) in a database and communicates with other backend services.
- User documentation for the minigame can be found here.
- For the frontend, see the Gamify-IT/towerdefense repository.
- The installation manual and setup instructions can be found here.
Rest mappings are defined in
- Game result
controller:
src/main/java/de/unistuttgart/towerdefensebackend/controller/GameResultController.java - Config
controller:
src/main/java/de/unistuttgart/towerdefensebackend/controller/ConfigController.java
When the service is started (see Getting started), you can access the API documentation:
Open http://localhost/minigames/towerdefense/api/v1/swagger-ui/index.html#/ and
fill http://localhost/minigames/towerdefense/api/v1/v3/api-docs into the input field in the navbar.

Beginning of additions (that work)
Make sure you have the following installed:
- Java: JDK 1.17 or higher
- Maven: Maven 3.6.3
- Docker: Docker
- PostgreSQL: PostgreSQL
To build the project, run:
mvn installin the project folder. Then go to the target folder:
cd targetand run:
java -jar towerdefense-backend-0.0.1-SNAPSHOT.jarto start the application.
To run your local changes as a docker container, with all necessary dependencies, build the Docker container with:
docker compose up --buildYou can remove the containers with:
docker compose downTo run your local build within your IDE, but also have the dependencies running in docker, follow the steps to build the project, then run the dependencies in docker with the following:
docker compose -f docker-compose-dev.yaml up You can remove the containers with:
docker compose -f docker-compose-dev.yaml downEnd of additions
to setup a database with docker for testing you can use
docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres --rm --name towerdefense-database postgresTo stop and remove it simply type
docker stop towerdefense-databaseTo prevent incorrect or cheated data, all important values are checked for logic.
The field borders are configured in src/main/java/de/unistuttgart/towerdefensebackend/Constants.java.
MIN_QUESTION_COUNTminimal number of questions a player can answer correctlyMAX_QUESTION_COUNTmaximal number of questions a player can answer correctlyMIN/MAX_SCOREshould not be changed

