mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-31 02:14:09 +03:00
Seed with frame counter instead of SDL_GetTicks
Using SDL_GetTicks() to seed the Gravitron RNG caused many reproducibility issues while syncing https://tasvideos.org/7575S . To fix this, add a frame counter, which is a number that is incremented every frame and never resets, and use it instead. If someone needs to switch back to SDL_GetTicks() for old TASes, then provide the -seed-use-sdl-getticks command-line option for them.
This commit is contained in:
@@ -3094,8 +3094,15 @@ void scriptclass::hardreset(void)
|
||||
{
|
||||
const bool version2_2 = GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2);
|
||||
|
||||
/* The RNG is 32-bit. We don't _really_ need 64-bit... */
|
||||
xoshiro_seed((Uint32) SDL_GetTicks64());
|
||||
if (game.seed_use_sdl_getticks)
|
||||
{
|
||||
/* The RNG is 32-bit. We don't _really_ need 64-bit... */
|
||||
xoshiro_seed((Uint32) SDL_GetTicks64());
|
||||
}
|
||||
else
|
||||
{
|
||||
xoshiro_seed(game.framecounter);
|
||||
}
|
||||
|
||||
//Game:
|
||||
game.hascontrol = true;
|
||||
|
||||
Reference in New Issue
Block a user