authorblues / bizhawk-shuffler-2

A script to randomly shuffle between games played in Bizhawk, with plugins to enhance the experience
MIT License
58 stars 21 forks source link

Base game swap timer on realtime #31

Open Michael4d45 opened 3 years ago

Michael4d45 commented 3 years ago

When playing with my friends, the games would desync. This is cause by two issues. 1 the shuffler counts frames and our computers would fun the games at a wide variety of frame-rates. For example, I would run Oot at 60 fps and theirs would run at 30 fps, causing my game to count to the frame limit faster. The second cause is load times. My computer loads Spyro age of Dragon on the PlayStation significantly faster than my friend's laptops. Thus my game would start earlier each time the game loads.

This fix starts a timer when the shuffler starts and switches when the timer has been reached. The time limit is increased before the next game is launched, causing no time loss between each computer.

Michael4d45 commented 3 years ago

Note: This commit also changes the total-time.txt to output total play time, rather than total running time.

authorblues commented 3 years ago

Planning to pull this. The only thing I want to work out is whether there is an easy solution for pausing the shuffler like currently exists (pausing the emulator stops the frameadvance, so that works well). Not a necessary feature, just considering it carefully.

Michael4d45 commented 3 years ago

The only thing I want to work out is whether there is an easy solution for pausing the shuffler like currently exists (pausing the emulator stops the frameadvance, so that works well). Not a necessary feature, just considering it carefully.

I've gotten it to work with the pause button on the keyboard. Otherwise, I couldn't find anyway for lua to know the game was paused. Also not in this branch, but I also implemented key bindings to move the timer backward and forward if people wanted to have control over the timer.