This repository contains source code for group 19 collaboration on UM DKE 2022 semester project 1-2. The goal of the project is creation of a simplified putting game simulator, including simplified physics modeling using numerical function approximation, 3d representation, interface for human player, AI bot capable of winning the game and more details of lesser importance.
The project schedule contains three phases (iterations). First phase implies creation of the physics engine using the most basic approximation (basic Euler method for finding function value using its derivative and previous value), simple visualization and human player interface. Second phase implies complete visualization, advanced physics modeling methods and a couple of AI implementations capable of winning the game. Third and last phase implies introduction of obstacles and creating an AI that would be able to win the game in a maze-like environment
- Zijian Dong
- Ana Godorogea
- Julia Grassot
- Álvaro Menéndez Ros
- Anna Nowowiejska
- Agata Oskroba
- Arseny Trifonov
Source code is stored in src
directory using classic java conventions
(main/java
for source code, main/resources
for assets, test/java
for tests). Additional documentation about the inner working and design
choices is placed in doc
.
- Install Java 17 or above & IDEA (seriously, vscode won't suffice).
- Import the project in your IDEA.
- Set Java SDK to installed one in File -> Project Structure.
- Open gradle tab on the right and double-click Tasks -> other -> dist. If it successfully finishes, then it means your build environment is properly set.
- Open gradle tab on the right and double-click Tasks -> documentation
-> javadoc. After completion, right-click on
doc/generated
-> Mark directory as -> Excluded. - Copy
configuration.properties.dist
toconfiguration.properties
. The difference between them is that first goes into git, the latter does not. - If IDEA complaints about something that can't be found after git pull, check for gradle update icon in right corner and click it. If icon is missing, try doing it manually in gradle tab -> right-click on the project -> reload gradle project.
The project is built by gradle.
To build the project, simply invoke ./gradlew dist
. This will compile
the project and create an executable JAR file
build/libs/project12.group19.putting-1.0.0.jar
.
The built JAR contains all definitions for launch:
java -jar build/libs/project12.group19.putting-1.0.0.jar
For Apple computers, -XstartOnFirstThread
has to be set as well:
java -XstartOnFirstThread -jar build/libs/project12.group19.putting-1.0.0.jar
JAR supports an optional argument - path to configuration file, which by
default is just configuration.properties
. The configuration file is
mandatory, but one can be obtained just by copying
configuration.properties.dist
in the project directory.
After the launch GUI will be presented, where someone has to select solver and bot through the menu. For unknown reasons on Windows machines the menu is not displayed, so following selection has to be made:
- Press 1, 2 or 3 for Euler, RK2 or RK4 solvers accordingly
- Press R for rule-based or B for hill-climbing bot
- Press P to launch the configuration
The configuration is read as java properties file (sectionless .ini-style, if you wish), with key-value pairs separated by equals sign, for example:
prefix.option = value
Full reference is available in doc/configuration.md. Most used options are:
Key | Aliases | Default | Description |
---|---|---|---|
course.surface | heightProfile | Course surface function | |
course.friction.default.static | mus | 0.2 | Ground static friction coefficient |
course.friction.default.kinetic | muk | 0.1 | Ground kinetic friction coefficient |
course.friction.sand.static | muss | 0.3 | Sand static friction coefficient |
course.friction.sand.kinetic | muks | 0.25 | Sand kinetic friction coefficient |
course.target.x | xt | Position of the hole, x-axis component | |
course.target.y | yt | Position of the hole, y-axis component | |
course.target.radius | r | 0.1 | Radius of the hole |
course.ball.position.x | x0 | 0 | Initial ball position, x-axis component |
course.ball.position.y | y0 | 0 | Initial ball position, y-axis component |
engine.timing.step | 0.01 | Simulated timestep between two calculations, in seconds. | |
course.items.sandpits.instances.[identifier].x | Sandpit center x-axis component | ||
course.items.sandpits.instances.[identifier].y | Sandpit center y-axis component | ||
course.items.lakes.instances.[identifier].start.x | startingLakeX | Lake top-left x-axis component, to be deprecated in favor of center + radius style | |
course.items.lakes.instances.[identifier].start.y | endingLakeX | Lake top-left y-axis component, to be deprecated in favor of center + radius style | |
course.items.lakes.instances.[identifier].end.x | startingLakeY | Lake bottom-right x-axis component, to be deprecated in favor of center + radius style | |
course.items.lakes.instances.[identifier].end.y | endingLakeY | Lake bottom-right y-axis component, to be deprecated in favor of center + radius style |