How Emulators 'Rewind' Games | MVG

erek

Supreme [H]ardness
Joined
Dec 19, 2005
Messages
7,949
Yeah!

"Ever wondered how emulators work? In this episode we perform a technical deep dive on how emulators can Rewind games and how Save States work. We demonstrate these features with the Nintendo Game Boy as the target emulation device."


 

Armenius

Fully [H]
Joined
Jan 28, 2014
Messages
32,364
Was expecting video to appeal to normies, instead got a nice short technical explanation. Pleasantly surprised. Gameboy is a nice simple device to delve into if you're interested in this kind of stuff. My first foray into emulation programming was the Gameboy Advance and it actually isn't much more complicated. I never heard of this channel before, but will check out more of their videos.
 

efishta

Limp Gawd
Joined
Oct 12, 2004
Messages
184
Was expecting video to appeal to normies, instead got a nice short technical explanation. Pleasantly surprised. Gameboy is a nice simple device to delve into if you're interested in this kind of stuff. My first foray into emulation programming was the Gameboy Advance and it actually isn't much more complicated. I never heard of this channel before, but will check out more of their videos.

Modern Vintage Gamer (MVG) is famous for his in-depth videos, and was responsible for the recent Diablo 1 port to the Switch homebrew. His content is some of the highest quality youtube offers. Definitely check them out.
 

sfsuphysics

[H]F Junkie
Joined
Jan 14, 2007
Messages
15,256
That rewind feature is something I never heard of, quite cool that they can do that now. I do wonder though how effective it'll be in some games, for instance something like and RPG might choose the RNG seed at the beginning of the battle, so rewinding to try and not have character X get hit/die/whatever may not work at all, I have noticed with some save states this is true, I guess it all depends when that seed is generated.
 

auntjemima

[H]ard DCOTM x2
Joined
Mar 1, 2014
Messages
9,952
Was expecting video to appeal to normies, instead got a nice short technical explanation. Pleasantly surprised. Gameboy is a nice simple device to delve into if you're interested in this kind of stuff. My first foray into emulation programming was the Gameboy Advance and it actually isn't much more complicated. I never heard of this channel before, but will check out more of their videos.

If you want in depth stuff explained during reviews or tear downs or repairs, look at 8-bit Guy.
 

Armenius

Fully [H]
Joined
Jan 28, 2014
Messages
32,364
That rewind feature is something I never heard of, quite cool that they can do that now. I do wonder though how effective it'll be in some games, for instance something like and RPG might choose the RNG seed at the beginning of the battle, so rewinding to try and not have character X get hit/die/whatever may not work at all, I have noticed with some save states this is true, I guess it all depends when that seed is generated.
Most older games don't use a seed, they use a pre-generated table from which a starting position is decided and then it is simply iterated through. The starting position in the table is usually determined at power on. Some emulators will reroll the starting position in the table on a save state load as if emulating a power cycle just to give you options. Of course, this is undesirable for a tool assisted speedrun so the behavior can be toggled. It gets more complicated as you move further through time, of course. There are some games that use a true random algorithm instead of referencing a table or multiple tables of numbers. It gets hard to give a real feeling of randomness when you need to account for outcomes you want to happen at a fixed rate.
 

Youn

Supreme [H]ardness
Joined
Jan 22, 2007
Messages
5,940
let the 7 year-olds explain it:


...sorry, couldn't make past 20 second mark, but good on him/her, the stuff is neat for sure...
 

socK

Supreme [H]ardness
Joined
Jan 25, 2004
Messages
4,229
That rewind feature is something I never heard of, quite cool that they can do that now. I do wonder though how effective it'll be in some games, for instance something like and RPG might choose the RNG seed at the beginning of the battle, so rewinding to try and not have character X get hit/die/whatever may not work at all, I have noticed with some save states this is true, I guess it all depends when that seed is generated.

Depends on the game. Some speedruns for certain games can abuse/manipulate this and doing XYZ action can fudge the RNG in such a way that you wind up not running into a random battle, etc.

Emulation also opens you up to some wonky oddities, like sometimes you can get a game to start despite not having some functionality emulated. In Tetris on the GB, if I remember right, you can get in game despite missing the divide function, which has the side effect of breaking the RNG, so you just get the same block repeatedly.

It's also, interestingly, how modern lag compensation in shooters tends to work. The server keeps a rolling buffer of game state, maybe half a second or so. The client sends the time that the shot happened, so even though the server gets the message late, it knows where to look back in time to so it can run the hit trace.
 

defaultluser

[H]F Junkie
Joined
Jan 14, 2006
Messages
14,399
It works by continuously saving state to ram in a rolling buffer. If the player rewinds, stop playing the game, and instead go to the previous state in the buffer, and draw onscreen.

My first experience with smooth rewind in an emulator was the NesDS emulator on the R4 card. It was a fucking revolution for me!

http://www.racketboy.com/retro/best-nes-emulator-for-nintendo-ds-nesds

I've been so spoiled by that experience, I've switched entirely to using an emulator front-end with well-designed rewind/fast-forward plus rapid fire: Bizhawk.

https://github.com/TASVideos/BizHawk/releases

But making sure your emulator can keep up while enabling rewind means you have to tweak the update rate: ideally, you would just run everything at full-speed, but for anything modern that's going to take way more processing power than you have available. So you make the rewind famerate run at a fraction of real-time (at the cost of smoothness).
 
Last edited:
Top