Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Save/load is where this bit me hardest too. What helped most was making the sim deterministic (fixed tick, one seeded RNG) so I could hash the whole state and compare runs.

For your case the test I'd add: run 2000 ticks straight, vs run 1000, save, load, run 1000 more, then compare the hashes. If they differ, something on load is re-running logic it shouldn't, and your staff doubling at handover would show up on the first try.

The other rule that saved me: load only restores state, it never calls the "on enter" code. A patient mid-pathway just gets put back on their step. Anything that fires on a transition (requests, referrals, adding staff) goes through one function that checks the current step first, so calling it twice does nothing.

Cheap invariant checks every tick in debug builds also caught a ton. No patient queued for a closed area, staff count matches the roster, that kind of thing. They fail right when the bug happens instead of three sim-days later.