- src/xm.rs: FastTracker 2 XM and ProTracker MOD replayer (verified against libopenmpt) - src/audio.rs: music players with crossfade + effect voices, rendered on demand - src/sfx.rs: 29 synthesised chip sound effects - www/dc_plugin.js: AudioContext started on first input, streams samples from WASM - music follows the game: title, rotating build tracks, battle, gate assault, jingles - macroquad audio removed; all tests run natively with cargo test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
2.9 KiB
Markdown
74 lines
2.9 KiB
Markdown
# DungeonCraft
|
||
|
||
An original dungeon building & defence game that runs in the browser (Rust + [macroquad](https://github.com/not-fl3/macroquad), compiled to WebAssembly).
|
||
|
||
Dig out your underground realm, claim the portal to attract creatures, keep them fed, rested and paid, fend off endless hero waves that adapt to your army – and finally destroy the Hero Gate.
|
||
|
||
- 3D isometric view with a freely rotatable and tiltable camera
|
||
- Procedural pixel art, irregular cave walls, flickering torch light
|
||
- CP437 text-mode style interface with the DINOBYTE bitmap font
|
||
- English and German (language files in `lang/`, easy to extend)
|
||
|
||
See [DESIGN.md](DESIGN.md) for all design decisions and [CREDITS.md](CREDITS.md) for third-party assets.
|
||
|
||
## Running
|
||
|
||
The easiest way is Docker; the image builds the WASM file and serves it with nginx:
|
||
|
||
```sh
|
||
docker compose up -d --build
|
||
# open http://localhost:18093
|
||
```
|
||
|
||
### Building without Docker
|
||
|
||
Requirements: Rust with the `wasm32-unknown-unknown` target.
|
||
|
||
```sh
|
||
rustup target add wasm32-unknown-unknown
|
||
cargo build --release --target wasm32-unknown-unknown
|
||
cp target/wasm32-unknown-unknown/release/dungeoncraft.wasm www/
|
||
cp ~/.cargo/registry/src/*/macroquad-*/js/mq_js_bundle.js www/
|
||
python3 -m http.server 8080 -d www # open http://localhost:8080
|
||
```
|
||
|
||
### Testing the game logic
|
||
|
||
The tests run natively: a headless simulation of whole games, a savegame round trip, rendering of all music modules and the audio engine:
|
||
|
||
```sh
|
||
cargo test --release
|
||
```
|
||
|
||
## Music
|
||
|
||
The soundtrack consists of FastTracker 2 modules in `assets/music/`, generated by `tools/compose_music.py` (`python3 tools/compose_music.py`). They can be opened and edited in MilkyTracker. The game plays them with its own XM/MOD replayer (`src/xm.rs`); sound effects are synthesised chip sounds (`src/sfx.rs`). Both are mixed in `src/audio.rs` and streamed to the browser by `www/dc_plugin.js`.
|
||
|
||
## Controls
|
||
|
||
| Input | Action |
|
||
|---|---|
|
||
| Esc | Pause menu (save, load, settings) |
|
||
| Left click / drag | Use the active tool (dig and rooms: drag a rectangle) |
|
||
| Right click | Drop a unit from your hand |
|
||
| Right drag, WASD, arrows, screen edge | Move the camera |
|
||
| Middle drag, Q/E, R/F | Rotate / tilt the camera |
|
||
| Mouse wheel | Zoom |
|
||
| 1–9, 0, X, V | Select a tool or spell |
|
||
| P / Space | Pause |
|
||
| M, +/- | Sound on/off, volume |
|
||
| G | Tile outlines on/off |
|
||
| H | Help |
|
||
|
||
All keys except Esc and the arrow keys can be changed in Settings → Keys.
|
||
|
||
## Savegames
|
||
|
||
Use *Save Game* in the pause menu to download a `.dcsave` file (JSON). Load it again via *Load Game* or by dropping the file onto the game window. The game also autosaves into the browser every two minutes and when the tab is closed; *Continue* on the title screen resumes from there.
|
||
|
||
## Adding a language
|
||
|
||
1. Copy `lang/en.lang` to `lang/<code>.lang` and translate the texts (placeholders `{0}`, `{1}` stay as they are).
|
||
2. Add the file to `SOURCES` in `src/i18n.rs`.
|
||
3. Note: the DINOBYTE font only covers the CP437 character set.
|