Input Lag Compensation to compensate for game's internal lag?

Just made a big pull request for Genesis Plus GX, looks like it was accepted. I’d like to see how this one performs on the PS3.

3 Likes

Thanks for the GPGX fixes! I found some issues though. If secondary instance is disabled when CD audio is playing for a minute or so RetroArch will freeze. Found this happening in Lunar when just walking around Burg and during a voiced cutscene in Snatcher. Disabling run ahead or enabling secondary instance fixes it. Genesis TMSS bootrom is fixed, but Game Gear and Master System bootroms are still not working with run ahead.

Weird, Sonic CD ran fine for extended times, even got the 3 minute game over.

edit: Please provide an exact game title, save file, and an exact list of steps to trigger the bug, I can’t see any crashes or freezes at the beginning of either game.

I tried to replicate the crash again and couldn’t. I realized I turned off the system bootrom option, so I tried turning that back on. Doing that while running any CD game will cause RA to crash as soon as you try to go back to the game. So it seems enabling the bootrom option along with secondary instance off causes the Sega CD freezes/crashing. Odd, since Sega CD shows the BIOS whether it’s enabled or not.

Edit: Hmm, well I can’t replicate the freeze during gameplay anymore even if bootrom is enabled at startup. Only the crash if I turn bootrom on or off while content is loaded and then dismiss XMB.

Got a chance to try this with Mednafen Saturn today and to my surprise it works (I didn’t even know Saturn had savestates!). But performance is very poor. I am getting about 90fps without any runahead, and 50-55fps with 1 frame runahead. This game appears to have 5 frames of internal lag so there definitely is a ton to be gained if this could be somehow optimized!

BTW thank you to Dwedit and all who worked on this feature. Amazing! :smile:

edit: forgot to mention I was testing Guardian Heroes U-NTSC

Which game is that?

I don’t think it’s internal game lag. The core itself is very laggy, adding at least 3 frames of lag in all games, from what i can tell. Can’t prove it though. But i’m sure it does.

They added a new core option to combat lag. Well, it doesn’t do anything for the internal lag, still measured 5 frames whether that settings was on/off.

When I tried running Smash Tennis / Super Family Tennis in RetroArch 1.73 with Snes9x Core and runahead enabled, everything came to a crawl during the namco-logo or while in the menus. I suppose this is happening because the game uses interlaced hi-res-output. When I disabled runahead, everything went back to normal. Is this a known issue?

The problem with this feature is that now it’s going to make it very hard to use other emulators. This feature has completely eliminated my input lag on my HTPC set up and is IMO a milestone in emulation history, so thank you!

I’m very curious if this helps Input lag with MAME even better than Groovymame on non CRT displays? Galaga ‘88 has the worst driver input lag.

Additionally now that this feature is implemented, focus work should be done on porting/updating/ and fixing bugs in cores so RA can be the most compatible, mainstream program for retro gaming.

1 Like

I don’t think it works with MAME currently, but it should work mostly okay with FBA.

As for comparing with GroovyMAME, AFAIK their options are all about getting the input polling and the image rendering/display as close as possible (including the new beam-racing/raster-slicing method). Most of our latency options take this same approach. Runahead, though, is completely different and is more akin to how online games try to hide latency.

Unfortunately when I tested FBA it had some odd bugs with Runahead turned on, regardless of whether Secondary Core was activated and irrespective of the number of frames.

Some games in particular (like Battle Garegga and Gunbird) had some strange audio issues, with the music or sound effects being noticeably sped up.

Enable “Runahead Use Second Instance”. Then you get full frames in Snes9x for Smash Tennis in the hires game menu. Of course only if your PC is fast enough for it.

Does this run ahead method use separate core affinity allowing multithreaded cpu to cover performance? Most emulators use just one core.

Thank you for the quick reply, though I’m afraid that’s not the solution since I’ve had the second-instance-option enabled already. The only option that makes the slowdown go away is turning vsync off. Interestingly, when I do that in the Smash Tennis menu, then the RetroArch video statistics report twice the expected framerate (120 fps instead of 60). I also tried one of the bsnes-cores and Arkanoid - Doh It Again, another SNES-game that switches to interlaced in some cases, same slowdown, same double framerate. Then I also tested the mednafen cores with some Saturn and PlayStation games that have interlaced video (Panzer Dragoon Zwei titlescreen, Radian Silvergun titlescreen, Gran Turismo titlescreen) and no slowdown at all, even with vsync on. also when turning vsync off, the reported framerate in the video statistics still remained as expected somewhere around 60hz. Seems like something fishy is going on with interlaced video timing for SNES cores when runahead is enabled.

maybe you have the video option “black frame insertion” turned on, on a 60hz monitor? try disabling that if that is the case.

Yeah, interlaced video is not quite working yet in runahead.

I don’t have it done correctly in Snes9x, and Genesis Plus GX resets the field counter every time state is loaded.

These are issues within the cores themselves.

Despite use of the word “core”, all the RunAhead stuff is strictly single-threaded for now.

While most situations are entirely sequential, there is one situation that could be made parallel. That is when using Secondary core, and input is not dirty. In that case, the two cores could be in two different threads. I have not implemented that, and RetroArch would need changes to accommodate two threads trying to use the callback systems.

1 Like

Ah, Ok. I never use Vsync in Retroarch since i have Freesync capable hardware. So, no problems at all with slowdowns in interlaced SNES games menu, title screens etc. Tried it with bsnes too.

There’s still some core options that are causing problems with runahead 2 instances.
FCEUMM isn’t cropping the picture when using the overscan option, it’s just changing the geometry
(easy to verify with super mario bros 3, the margin on the left side should disappear).

I saw some desync while changing the overclock option during runtime too.

What precise sequence of actions will cause the settings to not be synchronized?

I’m trying out Armadillo, and I’m seeing the overclock feature and overscan options work fine.