Save random state and refactor usage of generators

  1. Introduces a new generator where we can easily access its current state, unfortunately std::mt19937 state is pretty big so I decided to write a small custom PRNG, its just to get things going.
  2. Separates world prng and global prng, the simulation must now use the generator of World and not the global in order to be deterministic, as for visual effects and other things that dont influence the simulation state the global prng will be still used, unfortunately most things can change the simulation so not a lot is left using the global one.

I should note that this is not the magic bullet to make everything deterministic just yet, some things are still mapped with pointer value as a key so the order depends on the memory address which depends on the systems allocator so the next value of the prng may be used for something else. It does feel like there is some improvement already however, when reloading a save file the next dialogue line will be about 80 to 90% of the time the same now, it deviates less since its now dependent on order of actors in memory which is often still the same.

Edited by Matt

Merge request reports

Loading