td

GettingStarted
Login

GettingStarted

Home · Architecture · Combat · Extensions · Known gaps · Source index

Getting Started

Prerequisites and build

The crate is a Rust 2024 binary. Macroquad opens a native fixed-size window; no external assets, database, build script, or Lua files are required by the current source.

cd /path/to/td
cargo check
cargo run

At baseline check-in 1c4f2f89ebf6c70e81dccb412394be06a69fa932, cargo check passes with three unused imports across src/main.rs and src/animations.rs. See Cargo.toml for the dependency declarations.

What happens on launch

World::new constructs registries in dependency order, equips the tower with Impact and Poison Coating at tier 1, seeds deterministic RNG with 1, and starts with empty entity vectors. The first simulation step immediately spawns a tier-1 blob because wave_timer starts at zero.

World::new
  DamageRegistry
  -> WeaponRegistry(damage IDs)
  -> EnemyRegistry
  -> StatusRegistry(damage IDs)
  -> Tower(default weapon IDs)
  -> empty simulation

The setup lives in src/world.rs, src/registry.rs, and src/tower.rs.

Controls

Key Live behavior
Left / Right Move the selection cursor among three crate cards
Enter Equip or upgrade the selected weapon and spend one pending level-up
Space In a crate, close without spending the level-up; while playing, reopen if a level-up is pending
Q Exit the process with status code 1

There is no start menu, mouse interaction, pause key, save/load, or game-over state. A crate overlay does not pause simulation: src/main.rs calls step_world before handling every screen state. Comments in src/context.rs that describe a paused simulation clock are aspirational, not current behavior.

Expected visible behavior

Blobs spawn from (0, arena_height/2), seek the tower center, and disappear on reaching it. The tower rotates toward the nearest enemy and fires yellow projectiles at 4.2 shots/second. Hits add physical damage and apply independent poison statuses. Deaths create a fading circle animation, grant XP, and may replicate enemies through SplitOnDeath. The HUD reports FPS and trailing three-second hit, DoT, and combined DPS.

Progression thresholds are round(10 × 1.6^level). Reaching one or more levels queues the same number of crate picks. The crate catalog currently has only two weapons, so its three offers may repeat by design.

Recommended source-reading order

  1. src/main.rs — window and frame loop.
  2. src/systems.rs — live phase order, simulation, rendering, UI.
  3. src/world.rs — owned state, command application, event delivery.
  4. src/command.rs and src/context.rs — write and read capabilities given to behaviors.
  5. src/behavior/ — trait kernels and dispatch.
  6. src/registry.rs — content factories and typed IDs.
  7. src/weapons/, src/enemies/, and src/pools/ — concrete content.

Development cautions

The crate root globally allows dead code, so successful compilation does not prove a subsystem is connected. In particular, pool ticking, projectile on_fire, tower behavior hooks, and registered DamageBehavior::compute are currently unwired. Consult Behavior System and Incomplete Systems before extending those paths.

Home · Architecture · Combat · Extensions · Known gaps · Source index