diff --git a/README.md b/README.md index 1ac393e..77ca112 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@

Seekers Server

+ + Jitpack + CodeQL @@ -17,17 +20,67 @@ In seekers, AIs compete against each other with the aim of scoring as many points as possible. This project is competition-oriented for students. -## Setup +## Getting started -| Folder | Purpose | -|:---------:|---------------------------------------| -| `dist` | Distribution binaries for the clients | -| `players` | Bot files from the players | -| `plugins` | Loading plugin jar files | -| `results` | Save tournament results | +Please note that at least java 11 is required. + +### Installation + +Get a jar file from the release or build it on your own. + +#### From release + +There is currently no official release available, however you can check out [Jitpack](https://jitpack.io/#seekers-dev/seekers-server) +for snapshot builds. + +#### Build it on your own + +First get this repo locally. You can download the zip file or fork and clone it. You can build the jar with the following command: + +```shell +bash mvnw install +``` + +That's it! You can find the jar file in the `target` folder. Please note that for execution you will need the file with +the uber classifier. + +### Run it + +You can run the jar file with the following command: + +```shell +java -jar seekers-server-*.*.*.jar +``` + +If you start the server for the first time, the following file and folders will be created: + +| Folder | Purpose | +|:------------:|---------------------------------------| +| `config.ini` | Config file for changing the settings | +| `players` | Bot files from the players | +| `plugins` | Loading plugin jar files | +| `results` | Save tournament results | + +Before the server starts, the app checks first if all listed paths exist. If a path does not exist, it will be created. +Then it will launch all plugins. + +## Config + +In the `config.ini`, you can set properties for the game and your plugins. Note that all plugins have their own section. +For example, the section of the python plugin is `[python-plugin]`. The name of the section is equivalent to the id of +the plugin. Please note that the config file of the seekers-py repo and this config file are interchangeable. If you +have already altered your config file for python, you can simply reuse it for the server. + +## Players + +## Plugins + +## Results ## Structure +This is the class diagram of important types in this program: + ```mermaid classDiagram Entity: update() diff --git a/pom.xml b/pom.xml index cbb3bca..c24a3b7 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,7 @@ Server for the seekers game. 2022 0.0.1 + UTF-8 org.seekers.Launcher @@ -15,6 +16,19 @@ ${project.javaVersion} ${project.javaVersion} + + + + Karl Zschiebsch + + + Jonas Endter + + + Martin Wille + + + @@ -22,6 +36,7 @@ https://jitpack.io + @@ -76,8 +91,26 @@ test + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.2 + + + package + + shade + + + true + uber + + + + org.apache.maven.plugins maven-wrapper-plugin @@ -93,27 +126,6 @@ ${project.javaVersion} - - org.apache.maven.plugins - maven-resources-plugin - 3.3.1 - - - org.apache.maven.plugins - maven-dependency-plugin - 3.6.1 - - - prepare-package - - copy-dependencies - - - ${project.build.directory}/lib - - - - org.apache.maven.plugins maven-jar-plugin @@ -122,7 +134,6 @@ true - lib/ ${project.mainClass} seekers diff --git a/src/main/java/org/seekers/App.java b/src/main/java/org/seekers/App.java index fd0cb39..70c53f1 100755 --- a/src/main/java/org/seekers/App.java +++ b/src/main/java/org/seekers/App.java @@ -36,6 +36,7 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * Creates the server and application for the {@code SeekersServer}. Loads and unloads plugins. Loads the If the stage is closed, @@ -63,10 +64,12 @@ public class App extends Application { */ @Override public void init() throws IOException { - config.load(new File("config.ini")); - - for (String folder : List.of("players", "plugins", "results")) { - Path path = Path.of(folder); + Path path = Path.of("config.ini"); + if (!Files.exists(path)) { + Files.copy(Objects.requireNonNull(getClass().getResourceAsStream("config.ini")), path); + } + for (String folder : new String[] {"players", "plugins", "results"}) { + path = Path.of(folder); if (!Files.exists(path)) { try { Files.createDirectory(path); @@ -76,6 +79,7 @@ public void init() throws IOException { } } + config.load(new File("config.ini")); manager.loadPlugins(); manager.startPlugins(); diff --git a/src/main/resources/org/seekers/config.ini b/src/main/resources/org/seekers/config.ini new file mode 100644 index 0000000..73dead0 --- /dev/null +++ b/src/main/resources/org/seekers/config.ini @@ -0,0 +1,29 @@ +[global] +auto-play=false +playtime=2000 +players=2 +seekers=5 +goals=5 + +[map] +width=768 +height=768 + +[camp] +width=55.0 +height=55.0 + +[seeker] +magnet-slowdown=0.2 +disabled-time=250.0 +radius=10.0 +mass=1.0 +thrust=0.1 +friction=0.02 + +[goal] +scoring-time=100.0 +radius=6.0 +mass=0.5 +thrust=0.1 +friction=0.02