A cross-platform 3D real-time strategy (RTS) game built in Rust using Vulkan (ash + naga), Lua 5.4 scripting, and SDL3 gamepad support, designed to build and run cleanly on Linux, FreeBSD, and MidnightBSD (as well as Steam / Steam Deck).
- 3D Vulkan Isometric Renderer: Procedural 3D low-poly Cat units (Worker Cat, Soldier Cat, Sniper Cat) and base structures (Command Center, House, Resource Mine, Barracks), terrain, crystal mineral nodes, selection rings, interactive minimap, and real-time Fog of War shader.
- AMD FidelityFX Super Resolution (FSR 1.0): Built-in EASU (Edge-Adaptive Spatial Upsampling) + RCAS (Robust Contrast-Adaptive Sharpening) pass with
Off,Ultra Quality (1.3x),Quality (1.5x),Balanced (1.7x), andPerformance (2.0x)presets ([F]key). - SDL3 Gamepad & Steam Deck Support: Full controller support via
libSDL3(SDL_GamepadAPI) for cursor control, box-selection, camera panning/zooming, building construction, and unit commands. - Top-Right FPS & Time Counter: Live
FPSandTIME (MM:SS)overlay in the top-right corner of the window. - Synchronized Two-Player Pause: Press
[P](orStarton a gamepad) or clickPAUSE [P]in the top bar to pause/resume the game for both players in Singleplayer or LAN multiplayer. - Cat Meow Task Acknowledgments: Assigning tasks to Worker Cats or Soldier Cats triggers synthesized cat meows (
"Meow!"/"Mrow!") and floating on-screen speech callouts. - Optional Public-Domain Jazz & Blues Background Music: Cycle between
Off, St. Louis Blues (1914 PD Blues), Midnight Cool Jazz (PD Swing), and 12-Bar Blues Shuffle (PD Blues) anytime with[J]or load a custom.wavfile with--music <path>. - Three Battle Maps (3–6 Mines per Side):
- Midnight Valley (
midnight_valley.lua): 4 resource nodes per side (8 total) - Twin Iron Ridge (
twin_iron_ridge.lua): 3 resource nodes per side (6 total) - Shattered Basin (
shattered_basin.lua): 6 resource nodes per side (12 total)
- Midnight Valley (
- Three Lua AI Difficulty Levels:
Easy,Medium, andHardscripted inassets/scripts/ai.lua. - Two-Player LAN Multiplayer: Deterministic 20 Hz lockstep UDP networking with Multicast DNS (mDNS) auto-discovery (
224.0.0.251:5353,_mbz-rts._udp.local.) and Direct IP:Port connection.
Because Midnight Battle Zone compiles Lua 5.4 from vendored ANSI C source (mlua) and compiles WGSL shaders to SPIR-V in pure Rust (naga), you do not need external glslc, shaderc, or liblua-dev packages to build it.
- Rust Toolchain (
rustc >= 1.75,cargo) - C Compiler & Linker (
cc/gcc/clangandpkg-config) — used by Cargo to compile the bundled Lua 5.4 library - X11 Development Library (
libX11) — linked for window creation - Vulkan Loader & GPU Driver (
libvulkan.so.1/vulkan-loader+ Mesa/proprietary ICD) — dynamically loaded at runtime
- SDL3 Shared Library (
libSDL3.so.0/libSDL3.so) — automatically detected and loaded at runtime for Gamepad / Steam Controller / Steam Deck support - System Audio Player (
pw-play,paplay,aplayon Linux;paplayoraucaton FreeBSD/MidnightBSD) — used for non-blocking Cat Meow sound effects and Jazz/Blues background music
sudo apt update
sudo apt install build-essential pkg-config libx11-dev libvulkan1 mesa-vulkan-drivers libsdl3-0 pulseaudio-utils(If Rust is not installed yet: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
sudo dnf install gcc make pkgconf-pkg-config libX11-devel vulkan-loader mesa-vulkan-drivers SDL3 pulseaudio-utilssudo pkg install rust pkgconf libX11 vulkan-loader mesa-dri sdl3 pulseaudiosudo mport install rust pkgconf libX11 vulkan-loader mesa-dri sdl3Note for MidnightBSD:
build.rsautomatically adds/usr/local/libto the native linker search path for bothfreebsdandmidnightbsdtarget configurations. If building with an upstream Rust toolchain on MidnightBSD, targetx86_64-unknown-freebsd.
git clone <repo-url> midnight-battle-zone
cd midnight-battle-zone
cargo build --releasecargo testTo install the binary and assets into /usr/local/share/midnight-battle-zone (or ~/.local/share/midnight-battle-zone):
mkdir -p ~/.local/share/midnight-battle-zone ~/.local/bin
cp target/release/midnight-battle-zone ~/.local/share/midnight-battle-zone/
cp -r assets ~/.local/share/midnight-battle-zone/
cat << 'EOF' > ~/.local/bin/midnight-battle-zone
#!/bin/sh
cd "$HOME/.local/share/midnight-battle-zone" && exec ./midnight-battle-zone "$@"
EOF
chmod +x ~/.local/bin/midnight-battle-zone# Launch into the interactive Main Menu
cargo run --release
# Start immediately on Shattered Basin against Hard AI with AMD FSR Quality and Cool Jazz music
cargo run --release -- --map shattered_basin --ai hard --fsr quality --music jazz
# Host a 2-player LAN game on port 28765 (advertised via mDNS)
cargo run --release -- --host 28765 --map midnight_valley
# Connect to a LAN host by direct IP:Port
cargo run --release -- --connect 192.168.1.42:28765
# Run a headless deterministic simulation (for testing/CI)
cargo run --release -- --headless --ticks 300 --map twin_iron_ridge --ai hard| Action | Keyboard & Mouse | SDL3 Gamepad / Steam Deck |
|---|---|---|
| Move Cursor | Mouse Move | Left Stick |
| Select / Box-Select / Click UI | Left Click (Hold & Drag to box-select) | South Button (A / Cross) (Hold & Move Left Stick to box-select) |
| Context Order (Move / Attack / Mine / Repair) | Right Click | East Button (B / Circle) |
| Pan 3D Camera | Arrow Keys | Right Stick |
| Zoom 3D Camera | Mouse Scroll Wheel | Left / Right Shoulders (LB / RB) or Triggers (LT / RT) |
| Train Worker Cat / Soldier Cat / Attack-Move | [W] / [S] / [A] |
West Button (X / Square) |
| Build Mine / Train Sniper Cat | [M] / [N] |
North Button (Y / Triangle) |
| Build House | [H] |
D-Pad Up |
| Build Barracks | [B] |
D-Pad Right |
| Repair Building | [R] |
D-Pad Down |
| Stop Selected Units | [X] |
D-Pad Left |
| Pause / Resume (Both Players) | [P] |
Start Button |
| Cycle AMD FSR 1.0 Mode | [F] |
Back / Select Button |
| Cycle Public-Domain Jazz & Blues Music | [J] |
Guide / Home Button |
All units and buildings are data-driven via assets/scripts/units.lua and assets/scripts/buildings.lua. To add a new unit type, append a table entry to assets/scripts/units.lua and add its id to trainable_units in assets/scripts/buildings.lua.
Midnight Battle Zone is licensed under the BSD 2-Clause License — see LICENSE for full details. Built-in background music tracks (St. Louis Blues [1914], Midnight Cool Jazz, and 12-Bar Blues Shuffle) are in the public domain (CC0).