From dd4bb75b24fa567b910132adfc97b3e42fb4f676 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 4 Nov 2026 09:57:10 +0100 Subject: [PATCH] Game version in the menu: VERSION holds vYYYYMM-NNNNN, shown on the title screen and in the pause menu, tools/bump_version.py raises it with every change --- .gitignore | 3 +++ Dockerfile | 1 + INSTALL.md | 11 +++++++++++ VERSION | 1 + lang/de.lang | 1 + lang/en.lang | 1 + play/DungeonCraft.html | 2 +- src/menu.rs | 27 +++++++++++++++++++++++++++ tools/bump_version.py | 40 ++++++++++++++++++++++++++++++++++++++++ 9 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 VERSION create mode 100644 tools/bump_version.py diff --git a/.gitignore b/.gitignore index 407892e..8f1cd22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ target/ Cargo.lock.bak +# WASM build outputs copied into www/ for the standalone file (the Docker image builds its own) +www/dungeoncraft.wasm +www/mq_js_bundle.js diff --git a/Dockerfile b/Dockerfile index f9e7e6d..ce5aa5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ RUN rustup target add wasm32-unknown-unknown WORKDIR /src COPY Cargo.toml Cargo.lock ./ COPY .cargo .cargo +COPY VERSION ./ # build dependencies first (Docker layer cache) RUN mkdir src && echo "fn main() {}" > src/main.rs \ && cargo build --release --target wasm32-unknown-unknown \ diff --git a/INSTALL.md b/INSTALL.md index 53b8424..3b76d5d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -116,6 +116,16 @@ A forgotten password is set again on the server with `docker compose stop saves All requests except health and login need `Authorization: Bearer `. Limits: 1 MB per savegame, 500 MB in total, 30 write requests and 20 login attempts per minute. Settings: `SAVE_DIR` (default `/data`), `LISTEN` (default `0.0.0.0:8080`). +## Version + +`VERSION` holds the game version as `vYYYYMM-NNNNN`: year and month of the change, then the number of +changes in that month (`v202611-00001`). The title screen and the pause menu show it, `src/menu.rs` +reads the file with `include_str!`, and a test checks the scheme. + +**With every change to the game** run `python3 tools/bump_version.py` before committing: it raises the +number by one (a new month starts again at `00001`) and prints the old and the new version. Do not edit +`VERSION` by hand. + ## Adding a language 1. Copy `lang/en.lang` to `lang/.lang` and translate the texts (placeholders `{0}`, `{1}` stay as they are). @@ -129,3 +139,4 @@ All requests except health and login need `Authorization: Bearer `. Limit | `play/DungeonCraft.html` | build the WASM file, then `python3 tools/make_standalone.py play/DungeonCraft.html` (the Docker image builds the same file under `/standalone/`) | | `docs/img/units`, `docs/img/icons` | `cargo test --release export_doc_images -- --ignored` | | `BESTIARY.md` | `python3 tools/make_bestiary.py` | +| `VERSION` | `python3 tools/bump_version.py` - with every change to the game | diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..a91e939 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v202611-00002 diff --git a/lang/de.lang b/lang/de.lang index eadaa1a..8542a37 100644 --- a/lang/de.lang +++ b/lang/de.lang @@ -201,6 +201,7 @@ langsel.hint = Klicke eine Sprache an. Du kannst sie später in den Einstellunge # ---- Menüs menu.subtitle = Graben. Bauen. Verteidigen. Erobern. +menu.version = Version menu.continue = Fortsetzen menu.new = Neues Spiel menu.load = Spiel laden diff --git a/lang/en.lang b/lang/en.lang index 505376b..499436f 100644 --- a/lang/en.lang +++ b/lang/en.lang @@ -202,6 +202,7 @@ langsel.hint = Click a language. You can change it later in the settings. # ---- menus menu.subtitle = Dig. Build. Defend. Conquer. +menu.version = Version menu.continue = Continue menu.new = New Game menu.load = Load Game diff --git a/play/DungeonCraft.html b/play/DungeonCraft.html index ad120d0..aac61b2 100644 --- a/play/DungeonCraft.html +++ b/play/DungeonCraft.html @@ -17,7 +17,7 @@