Commit Graph

10 Commits

Author SHA1 Message Date
Steve Biedermann 63c72f5df7 refactor(sim): resolve clippy pedantic lints
- Replace signed coordinate round-trips with checked offset helpers
- Use From/try_from conversions and clamp helpers in the edit parser
- Isolate exact RNG, noise and day-fraction float casts in documented helpers
- Split long functions (validate, world creation, apply, state_json, tick_person)
- Pass run_sim shared state by reference and tidy remaining style lints

Simulation behaviour and RNG sequences are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-11 21:23:50 +02:00
Steve Biedermann 9285df4d7b feat(sim)!: move simulation settings and behaviours into config.rn
Starting values and tuning constants are now `pub const` items in a
single Rune file, config.rn, alongside the `person`, `rabbit` and `wolf`
behaviour functions. The behaviours read the constants directly. At
startup the server loads the file from SIM_CONFIG (default: config.rn),
reads and checks every constant, and test-runs each behaviour, so a bad
or missing value stops startup with an error that names it.

- Map width and height can now be configured and are stored in
  snapshots.
- The UI's edit limits (max speed, stock, inventory, hunger, energy,
  resource amounts) come from the config.
- The in-browser script editor now edits config.rn. Applied edits update
  behaviours and tuning values immediately; map size, initial population
  and calendar defaults apply on reset.
- The Docker image includes config.rn, and Compose mounts the
  repository's copy read-only.
- Documents the config file and how it works in the README.

BREAKING CHANGE: src/behavior.rn has been removed; behaviours now live
in config.rn. The server will not start without a valid config file.
Snapshots no longer store the behaviour script: on restart, config.rn
from disk replaces any edits made in the browser editor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-11 20:42:29 +02:00
Steve Biedermann b6bab90503 feat(sim): expose Picard runtime stats and tracing
Enable Picard's stats and tracing features, publish actor counters to the UI, and initialize configurable tracing output.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-11 18:58:07 +02:00
Steve Biedermann 238de74f5b feat: add same-seed reset and world regeneration 2026-10-08 09:10:42 +02:00
Steve Biedermann c58c590b5d feat: add database persistence and Docker setup 2026-10-08 09:10:42 +02:00
Steve Biedermann 2daf8f30f2 build: bundle the Leptos UI during Cargo builds 2026-10-08 09:10:42 +02:00
Steve Biedermann ef47209c79 refactor: stream simulation state over WebSockets 2026-10-08 09:10:42 +02:00
Steve Biedermann e4a4cb0190 feat: build the frontend with Leptos and WebAssembly 2026-10-08 09:10:42 +02:00
Steve Biedermann dd02a16d36 feat: drive agent behavior with Rune scripts 2026-10-08 09:10:42 +02:00
Steve Biedermann 5760d097f7 feat: create the world simulation server 2026-10-08 09:10:42 +02:00