This file defines project-specific guidance for coding agents working in this repository.
- Project:
rust-in-space - Language: Rust (edition 2021)
- Framework:
macroquad - Entry point:
src/main.rs - Goal: mission-based 2D space shooter with gameplay updates in
src/game.rs, rendering insrc/draw.rs, and data models insrc/components.rs.
src/main.rs: main loop and game state transitionssrc/game.rs: gameplay update systems and high-level rendering entrypointssrc/components.rs: core structs/enums (game entities and state)src/draw.rs: drawing/render helperssrc/systems.rs: utility systems (save/load, generation, wrapping, etc.)src/resources.rs: asset/resource loadingsrc/localization.rs: language and stringsassets/: textures/fontshighscore.json: persisted score data
- Keep changes minimal and focused on the requested behavior.
- Prefer extending existing systems/functions over adding new architecture.
- Do not silently change gameplay balance unless explicitly requested.
- Preserve existing keyboard controls and game state flow unless task requires changes.
- Keep code warnings-free under clippy settings (
-D warningsin Makefile).
Use these commands (via Makefile) after code changes:
make fmtmake clippymake buildmake test
For full local parity with CI: make ci.
- Follow idiomatic Rust and current module organization.
- Keep functions small and readable; extract helpers when logic gets dense.
- Avoid
unwrap/expectin runtime gameplay code unless there is a clear invariant. - Prefer explicit names for gameplay constants; avoid unexplained magic numbers.
- Add short comments only for non-obvious logic (physics tuning, spawn math, timing edge cases).
When changing gameplay logic, verify:
- Mission progression still works (
Briefing -> Playing -> MissionSuccess/GameOver). - Pause/resume behavior remains intact.
- Collision paths still compile and run for ship/enemy/loot/projectiles.
- Score and high score persistence still behave correctly.
- Localization-dependent UI text still renders.
- Reuse already-loaded textures/resources from
Resourcesinstead of loading ad hoc. - Keep draw code in rendering modules (
draw.rs/ render helpers), not in update systems. - Respect existing coordinate and camera assumptions used by Macroquad draw calls.
A change is complete when:
- Requested behavior is implemented.
- Formatting/lint/build/tests pass (or failures are documented with reason).
- No unrelated files are modified.
- Any gameplay-affecting tradeoffs are stated clearly in the final summary.