AndreasWintherMoen / project-cows

Pokemon Tower Defense - A project for TDT4240 (Software Architecture) at NTNU
6 stars 0 forks source link

Project COWS

Casual Online War Simulator

AKA Pokemon Tower Defence

This is a project for TDT4240 - Software Architecture at NTNU.

How to run

  1. The project is developed with Android Studio Bumblebee using JDK 17 and Android SDK version 32. It may run with other programs and versions, but try using the same as us if you have any issues :)
  2. Configure environment variables in the Client. Create an environment file named env in the assets folder. A template file is provided, named env.example, so just copy this file and rename the copy env. By default, it connects to a local server, but you can replace 127.0.0.1:PORT with our public server at api.winthermoen.no (i.e. _HTTP_APIBASE=https://api.winthermoen.no/cows and _WS_APIBASE=wss://api.winthermoen.no/ws-cows).
  3. Run the client (twice, as it's a 2-player online game). While you can build a JAR file, we recommend running it directly from Android Studio in either a desktop or Android configuration. Note, we have had some issues running it on Windows. If you encounter issues, try upgrading buildToolsVersion to "30.0.3", located in build.gradle in the android folder.
  4. Configure environment variables on the Game State Server (located in the folder named server). Similar to the client, a sample file named env.example is provided, located in src/main/resources. If you want to use our public API, use the endpoint https://api.winthermoen.no/ss-cows.
  5. Run the Game State Server. This one can either be run in Android studio with a default Kotlin configuration and Application.Kt as the main class, or by building the project using ./gradlew shadowJar (Mac & Linux) or gradlew.bat shadowJar (Windows), and then running the compiled .jar file located in build/libs with java -jar server-0.0.1-all.jar.
  6. Run the Simulation Server. This one doesn't need environment variables, and can also be run either as a default Kotlin configuration in the IDE with Application.Kt as the main class, or as a built version using the same commands as the Game State Server. The built jar file is named simulationserver-0.0.1-all.jar.

Folder Structure

Overview of the folder structure.

client

Contains the "frontend" of the application. The main functionallity is found in /core/src/com/cows/game. This folder then consists of the sub-folders who are named according to what functionallity they introduce.

server

Contains overview of current games,functionnality for creating new games and connecting two players together. Key files are /plugins/Routing.kt , which brings end-points for the client to connect to, and classes found inside /services/shared and /services/simulation that serialise and deserialise data.

simulation_server

Contains the server that is responsible for simulating each round. Important files include /simulationModels/RoundSimulator.kt that simulates the entire round, using /simulationModels/TowerSimulationModel.kt and simulationModels/TowerSimulationModel.kt to simulate the more specific actions of Units and Towers.