Summary
World::grid.ticks advances by 2 for every logical tick, not 1.
This is long-standing behaviour, not introduced by the multithreading work. The original World::tick() incremented grid.ticks at both its start and end:
pub fn tick(&mut self) {
self.grid.ticks += 1; // start
// ... think + grass ...
self.apply_updates();
self.grid.ticks += 1; // end
}
The think/resolve refactor (PR #5) preserved this exactly: one increment now lives in think_phase() and one in resolve_phase(), so tick() still yields +2.
Why it matters
grid.ticks is used by:
- Grass-growth scheduling —
next_grass_tick is compared against grid.ticks, so grass effectively grows on a tick scale that is 2× the logical tick count (and ticks_per_grass() is implicitly calibrated to the +2 cadence).
- The GUI tick readout and ticks/sec display.
- Saved-world tick counts (serialized in
WorldGrid).
Decision needed
Changing it to +1 is a one-line removal of the resolve_phase() increment, but it shifts grass cadence and the meaning of ticks, and would want the grass timing / benchmarks re-checked. Filing this so the change can be made deliberately rather than bundled into the threading PR.
Flagged by CodeRabbit on PR #5.
Summary
World::grid.ticksadvances by 2 for every logical tick, not 1.This is long-standing behaviour, not introduced by the multithreading work. The original
World::tick()incrementedgrid.ticksat both its start and end:The think/resolve refactor (PR #5) preserved this exactly: one increment now lives in
think_phase()and one inresolve_phase(), sotick()still yields +2.Why it matters
grid.ticksis used by:next_grass_tickis compared againstgrid.ticks, so grass effectively grows on a tick scale that is 2× the logical tick count (andticks_per_grass()is implicitly calibrated to the +2 cadence).WorldGrid).Decision needed
Changing it to +1 is a one-line removal of the
resolve_phase()increment, but it shifts grass cadence and the meaning ofticks, and would want the grass timing / benchmarks re-checked. Filing this so the change can be made deliberately rather than bundled into the threading PR.Flagged by CodeRabbit on PR #5.