add local development doc page
This commit is contained in:
parent
7f1b6c06b6
commit
380a1d8f4e
3 changed files with 57 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -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>
|
||||
|
|
49
web/pw-server/src/routes/docs/local-development.md
Normal file
49
web/pw-server/src/routes/docs/local-development.md
Normal file
|
@ -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.
|
Loading…
Reference in a new issue