aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-09-13 20:40:35 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-09-13 20:40:35 +0200
commit380a1d8f4e977298e7d046b66ee874d1738b8672 (patch)
treedd3ead7808d28950c0556a1f17427f3a1e590db4 /web
parent7f1b6c06b6ccec7f61adb8d20d32731da67f644f (diff)
downloadplanetwars.dev-380a1d8f4e977298e7d046b66ee874d1738b8672.tar.xz
planetwars.dev-380a1d8f4e977298e7d046b66ee874d1738b8672.zip
add local development doc page
Diffstat (limited to 'web')
-rw-r--r--web/pw-server/src/routes/docs/__layout.svelte2
-rw-r--r--web/pw-server/src/routes/docs/doc.svelte6
-rw-r--r--web/pw-server/src/routes/docs/local-development.md49
3 files changed, 57 insertions, 0 deletions
diff --git a/web/pw-server/src/routes/docs/__layout.svelte b/web/pw-server/src/routes/docs/__layout.svelte
index 40c4317..eaf363a 100644
--- a/web/pw-server/src/routes/docs/__layout.svelte
+++ b/web/pw-server/src/routes/docs/__layout.svelte
@@ -8,6 +8,7 @@
<h2>Docs</h2>
<div class="sidebar-nav-group">
<TocEntry href="/docs/rules" text="Rules" />
+ <TocEntry href="/docs/local-development" text="Local development" />
</div>
</div>
</div>
@@ -25,6 +26,7 @@
display: flex;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
"Open Sans", "Helvetica Neue", sans-serif;
+ flex-grow: 1;
}
.sidebar {
diff --git a/web/pw-server/src/routes/docs/doc.svelte b/web/pw-server/src/routes/docs/doc.svelte
index 00431b3..ed08270 100644
--- a/web/pw-server/src/routes/docs/doc.svelte
+++ b/web/pw-server/src/routes/docs/doc.svelte
@@ -3,7 +3,13 @@
</div>
<style scoped lang="scss">
+ @use "src/styles/variables";
.container {
max-width: 800px;
+ color: rgb(36, 41, 47);
+ }
+
+ .container a {
+ color: variables.$blue-primary;
}
</style>
diff --git a/web/pw-server/src/routes/docs/local-development.md b/web/pw-server/src/routes/docs/local-development.md
new file mode 100644
index 0000000..0a2c0e3
--- /dev/null
+++ b/web/pw-server/src/routes/docs/local-development.md
@@ -0,0 +1,49 @@
+## Local development
+
+Besides using the web editor, it is also possible to develop a bot in your own development environment.
+Using the `planetwars-client` you can play test matches remotely, with your bot running on your computer.
+You can then submit your bot to the server as a docker container.
+
+### Playing matches with a local bot
+
+You can use the `planetwars-client` to play matches locally.
+
+Currently, no binaries are available, so you'll have to build the client from source.
+
+#### Building the binary
+If you do not have a rust compiler installed already, obtain one through https://rustup.rs/.
+1. Clone the repository:
+ `git clone https://github.com/iasoon/planetwars.dev.git`
+2. Build and install the client:
+ `cargo install --path planetwars.dev/planetwars-client`
+
+#### Create a bot config
+The bot config file specifies how to run your bot. Create a file `mybot.toml` with contents like so:
+
+```toml
+# Comand to run when starting the bot.
+# Argv style also supported: ["python", "simplebot.py"]
+command = "python simplebot.py"
+
+# Directory in which to run the command.
+# It is recommended to use an absolute path here.
+working_directory = "/home/user/simplebot"
+```
+
+#### Playing a match
+Run `planetwars-client /path/to/mybot.toml opponent_name`
+
+Try `planetwars-client --help` for more options.
+
+
+### Publishing your bot as a docker container
+Once you are happy with your bot, you can push it to the planetwars server as a docker container.
+
+1. **Create a bot.**
+ Before you can publish a new bot version, you will first need a registered bot name.
+ You can use an existing name, or you can create one by using the "New bot" button on your user profile page (you can get there by clicking your name in the navbar).
+2. Log in to the planetwars docker registry:
+ `docker login registry.planetwars.dev`
+3. Tag and push your bot to `registry.planetwars.dev/my-bot-name:latest`.
+4. Your bot should be up and running now! Feel free to launch a game against it to test whether all is working well.
+ Shortly, your bot should show up in the rankings.