jonese1234 / PokeBotBad

The automated Pokémon speedrunning machine
http://www.twitch.tv/pokespeedrunbots
MIT License
26 stars 7 forks source link

Problems with determinism #13

Open kevsgrove opened 7 years ago

kevsgrove commented 7 years ago

Running a set seed yields similar, but not quite identical runs.

For example, I used the 1470511779 seed that was run 22 in today's stream. About 2/3 times, the nido had perfect stats, but 1/3 times, the special was too low.

Each time shorts guy would trigger a heal loop, we'd risk it, and survive. Similarly, we'd switch out after Rival's Pidgeotto Sand-attacked too much before the bridge.

However, over several dozen attempts (if we made it to her), Misty's Starmie hit a critical and KO nido. In the stream, Starmie did not crit.

My guess is that the PRNG is sensitive to sub-second times, and so the current seed system is not accurate enough. I'm thinking that a millisecond-accurate timestamp would work fine, as 1 millisecond is 16-17 frames.

Edit: Here's the console output after running ~5 times. I didn't think to attach it til I had already cleared most of the trials that I ran.

Edit2: Oops. I'm running v2.4.8, while the stream is on v2.4.6. That explains the Misty block. But I'm still not sure about the low special nido ocasionally cropping up...

bm01 commented 7 years ago

The stream is on v2.4.8 too according to the output window.

Anyway I noticed this behavior a few times myself and told FilthyPeasant about it. According to him only the first rerun is valid because the bot doesn't reset properly or something like that, and you can get two different results. There seems to be a problem with that, definitely.

From my experience, it's not even necessarily possible to get the original run result on a rerun, but since I'm running a modified version it's possible that I "inadvertently" changed the logic between an original run and a rerun.

jonese1234 commented 7 years ago

With the original code, it uses the emulator.reboot() however that only worked on the old version of bizhawk, the only way i found to get around it with this newer versions is emulate a power button press.