Casual Online War Simulator
This is a project for TDT4240 - Software Architecture at NTNU.
- 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 :)
- 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_API_BASE=https://api.winthermoen.no/cows and WS_API_BASE=wss://api.winthermoen.no/ws-cows).
- 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.
- 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.
- 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) orgradlew.bat shadowJar
(Windows), and then running the compiled .jar file located in build/libs withjava -jar server-0.0.1-all.jar
. - 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.
Overview of the folder structure.
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.
- controllers
- enums
- gameState
- hud
- map
- models
- roundSimulation
- serverConnection
- views
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.
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.