Home · Architecture · Combat · Extensions · Known gaps · Source index
Tower Defense Rust Wiki
This wiki documents the Rust implementation at Fossil check-in 1c4f2f89ebf6c70e81dccb412394be06a69fa932 on trunk. The authority is Cargo.toml and src/, not planning or prose documents.
Current state
The project is a single Macroquad binary: an 800×800 arena drawn in a fixed 900×900 window, with a central auto-firing tower, periodically spawned blob enemies, physical impact damage, poison damage-over-time, XP-based level-ups, and a keyboard-operated weapon crate. Its architecture is a hand-built entity model using vectors and trait objects; the declared hecs dependency is not used by current source.
Status vocabulary used throughout:
| Status | Meaning |
|---|---|
| Live | Called from the main frame loop and affects current play |
| Partial | Implemented and sometimes callable, but incomplete or behaviorally inconsistent |
| Unwired | Compiles but has no path from the live frame loop |
Page index
All 16 source-grounded wiki pages are indexed here.
| Page | Scope |
|---|---|
| Home | Project snapshot, status, and full index |
| Getting Started | Build, run, controls, and first code-reading route |
| Architecture Overview | Modules, ownership, read/write split, live boundaries |
| Frame Lifecycle | Exact per-frame ordering and deferred effects |
| World and Entities | World, tower, enemy, projectile, pool, animation, player |
| Commands and Events | Deferred mutation and bounded event cascades |
| Behavior System | Behavior traits, contexts, dispatch, priorities |
| Registries and Content | Typed IDs, factories, seeded content |
| Combat Pipeline | Hit, status, damage, resistance, death, attribution |
| Enemies and Waves | Blob construction, scaling, movement, splitting, spawning |
| Towers, Weapons, Progression | Loadout, weapon crate, XP, DPS meters |
| Spatial, Geometry, RNG | Grid snapshots, collisions, normals, deterministic streams |
| Rendering and UI | Macroquad drawing and crate interaction |
| Incomplete Systems | Explicit partial and unwired inventory |
| Extension Guides | Patterns for adding content and behavior |
| Source Index and Glossary | File map and terminology |
Runtime at a glance
Macroquad frame
-> step_world(dt)
-> waves -> enemies/statuses -> tower -> projectiles -> deaths -> animations
-> draw_simulation()
-> weapon-crate UI/input
-> apply UI action
-> next_frame()
World-changing behavior is normally deferred:
behavior hook -> CommandBuffer -> apply_commands -> GameEvent waves
See src/main.rs, src/systems.rs, and src/world.rs.
Verified baseline
cargo check succeeds at the stated check-in. It reports only unused imports: PlayerStatus in src/main.rs, plus RED and draw_text in src/animations.rs. The package uses Rust edition 2024 and directly depends on macroquad, hecs, mlua with vendored Lua 5.4, serde, serde_json, and strum; only Macroquad is materially used in the current live path.
Home · Architecture · Combat · Extensions · Known gaps · Source index