100% Lagless Emulation is Here!
-
casualcoder
- Posts: 346
- Joined: Sat Apr 21, 2012 4:35 am
- Location: West Coast, Canada
100% Lagless Emulation is Here!
I'm really not sure why I'm not seeing much talk about this. I thought this 'development' would be ALL around this forum.
What I'm referring to is 100% lagless emulation in the recent version of Retroarch.
For those that don't know: I'm not meaning zero ADDED input lag. I mean, less lag than the original hardware. Your inputs get read on frame 1 and sent to frame 1. This is huge.
I looked into it this weekend thinking it was too good to be true but, indeed all of my favorite games were reduced to zero lag.
In the most convincing cases I looked at Guwange and Metal Slug 3, both have 3 frames of built-in lag. You can easily find this out using the tools in Retroarch.
To compensate I subtracted 3 frames. The difference is immense. I can blaze through Guwange much easier (not that it was all that difficult before, but now it's even better and noticeable immediately).
On my 5ms Asus 1080p monitor I have <1 frame of total lag which is way less than you'd get on CRT + Original Hardware.
I will update this posting with some instructions/guides if you guys want (there is a bit of setup involved, including per-game settings but it's easy).
Now that I've discovered this I can't go back to the emulation alternatives (my go-to was Shmupmame).
I'll also add that this works across ALL emulation in Retroarch. It works with all core types. So you can use on FinalBurn, Mame, SNES, GBA, PS1... everything.
Also, I run it on an old dual-core system with a 6450HD AMD graphics card. Really low-level stuff and I've gotten it all to work without any frame drops (max 50% CPU usage) on even the most demanding emulations pre-2010's era.
What I'm referring to is 100% lagless emulation in the recent version of Retroarch.
For those that don't know: I'm not meaning zero ADDED input lag. I mean, less lag than the original hardware. Your inputs get read on frame 1 and sent to frame 1. This is huge.
I looked into it this weekend thinking it was too good to be true but, indeed all of my favorite games were reduced to zero lag.
In the most convincing cases I looked at Guwange and Metal Slug 3, both have 3 frames of built-in lag. You can easily find this out using the tools in Retroarch.
To compensate I subtracted 3 frames. The difference is immense. I can blaze through Guwange much easier (not that it was all that difficult before, but now it's even better and noticeable immediately).
On my 5ms Asus 1080p monitor I have <1 frame of total lag which is way less than you'd get on CRT + Original Hardware.
I will update this posting with some instructions/guides if you guys want (there is a bit of setup involved, including per-game settings but it's easy).
Now that I've discovered this I can't go back to the emulation alternatives (my go-to was Shmupmame).
I'll also add that this works across ALL emulation in Retroarch. It works with all core types. So you can use on FinalBurn, Mame, SNES, GBA, PS1... everything.
Also, I run it on an old dual-core system with a 6450HD AMD graphics card. Really low-level stuff and I've gotten it all to work without any frame drops (max 50% CPU usage) on even the most demanding emulations pre-2010's era.
-
- Posts: 1135
- Joined: Mon Feb 14, 2005 4:08 am
- Location: Los Angeles, CA
Re: 100% Lagless Emulation is Here!
I've heard about this and have been wondering, honestly, why is this a good thing and why doesn't anyone else seem to be picking up on it?
Hasn't the goal always been accuracy? And haven't we long noted - particularly here on the Shmups forum - that games created by the very best talent were built with hardware limitations in mind? I.e., if there are 3 frames of lag on native hardware in a top shmup, the level design is probably built around that degree of sensitivity.
Changing response lag in either direction can break a game based on speed and reflexes. Naturally, as emulation has been built and improved the challenge to this point has always been to match speed with original hardware. But now that we can, apparently, actually push back in the other direction, we need to ask if this is actually a good thing.
If we can create emulation with this much speed now, the goal should be absolute accuracy/parity with real hardware - NOT to exceed. This both preserves accuracy (which will only become more important as more and more original HW dies in the coming years) and preserves developers' visions with the original games.
I'm interested to hear what others have to say, but I think it's clear that this particular advance goes too far, and easily past the point of being an improvement.
Hasn't the goal always been accuracy? And haven't we long noted - particularly here on the Shmups forum - that games created by the very best talent were built with hardware limitations in mind? I.e., if there are 3 frames of lag on native hardware in a top shmup, the level design is probably built around that degree of sensitivity.
Changing response lag in either direction can break a game based on speed and reflexes. Naturally, as emulation has been built and improved the challenge to this point has always been to match speed with original hardware. But now that we can, apparently, actually push back in the other direction, we need to ask if this is actually a good thing.
If we can create emulation with this much speed now, the goal should be absolute accuracy/parity with real hardware - NOT to exceed. This both preserves accuracy (which will only become more important as more and more original HW dies in the coming years) and preserves developers' visions with the original games.
I'm interested to hear what others have to say, but I think it's clear that this particular advance goes too far, and easily past the point of being an improvement.
Re: 100% Lagless Emulation is Here!
People don't seem to mind the 360 port of Futari... And please, even if input lag was a known thing developers had to deal with, I would hardly call it a part of their "vision." Play the games however you want, one person pursuing lag reduction doesn't preclude another from seeking accuracy.bigbadboaz wrote:If we can create emulation with this much speed now, the goal should be absolute accuracy/parity with real hardware - NOT to exceed. This both preserves accuracy (which will only become more important as more and more original HW dies in the coming years) and preserves developers' visions with the original games.
As for myself, I never bothered with any lag reduction techniques because I simply don't care all that much about input lag, save particularly egregious cases such as Guardian Force.
-
casualcoder
- Posts: 346
- Joined: Sat Apr 21, 2012 4:35 am
- Location: West Coast, Canada
Re: 100% Lagless Emulation is Here!
Yeah I think the boat is being missed here.
As a developer myself I understand why lag enters the equation when creating a game. It is almost never implemented on purpose.
It's usually due to poor optimization, lack of knowledge, hardware limitations and so forth.
There are rare circumstances where lag is put in on purpose but this is usually to smooth out netplay, or asynchronous things of that nature. That's not the case here.
Actually, as an interesting sidenote the way this was developed was apparently out of rollback technologies that are used to diminish lag over netplay.
Although it's not rollback per se, it was apparently inspired by the idea.
So the end result is less lag is never a bad thing. If you can perceive it (I can definitely perceive 1 frame of lag) and you're sensitive to it then it's a no brainer.
Like playing soccer with boots vs shoes. You can definitely do both but one is at least a bit harder than the other. Still, some people will choose boots!
The biggest disadvantage here is setup. It can take some fiddling here and there. Also, for high-scores and speedruns it might pose an interesting problem because it is an obvious artificial advantage.
As a developer myself I understand why lag enters the equation when creating a game. It is almost never implemented on purpose.
It's usually due to poor optimization, lack of knowledge, hardware limitations and so forth.
There are rare circumstances where lag is put in on purpose but this is usually to smooth out netplay, or asynchronous things of that nature. That's not the case here.
Actually, as an interesting sidenote the way this was developed was apparently out of rollback technologies that are used to diminish lag over netplay.
Although it's not rollback per se, it was apparently inspired by the idea.
So the end result is less lag is never a bad thing. If you can perceive it (I can definitely perceive 1 frame of lag) and you're sensitive to it then it's a no brainer.
Like playing soccer with boots vs shoes. You can definitely do both but one is at least a bit harder than the other. Still, some people will choose boots!
The biggest disadvantage here is setup. It can take some fiddling here and there. Also, for high-scores and speedruns it might pose an interesting problem because it is an obvious artificial advantage.
-
casualcoder
- Posts: 346
- Joined: Sat Apr 21, 2012 4:35 am
- Location: West Coast, Canada
Re: 100% Lagless Emulation is Here!
Oh, another thing to keep in mind.
In terms of "accuracy." No glitches or anomalies in the emulation will pop up if done properly.
But, paradoxically, you can get a more hardware-accurate emulation using this lag reduction technique in certain setups.
For example, if your HDTV you're playing on has 2 frames of lag built-in, you can simply compensate by reducing by -2 frames within the game emulation side of things.
The net result is precise emulation on par with playing the original hardware on CRT (not accounting for other typical emulation inaccuracies).
So, all things being equal you can stand to benefit from the lag reduction - towards the goal of emulation accuracy - even if the net result is 0 lag reduction, if that makes sense
In terms of "accuracy." No glitches or anomalies in the emulation will pop up if done properly.
But, paradoxically, you can get a more hardware-accurate emulation using this lag reduction technique in certain setups.
For example, if your HDTV you're playing on has 2 frames of lag built-in, you can simply compensate by reducing by -2 frames within the game emulation side of things.
The net result is precise emulation on par with playing the original hardware on CRT (not accounting for other typical emulation inaccuracies).
So, all things being equal you can stand to benefit from the lag reduction - towards the goal of emulation accuracy - even if the net result is 0 lag reduction, if that makes sense
-
OmegaFlareX
- Posts: 888
- Joined: Tue Jan 25, 2005 10:15 pm
- Location: Virginia, USA
Re: 100% Lagless Emulation is Here!
How do you set it up? What options need to be selected? A short guide would be beneficial.
-
tomwhite2004
- Posts: 319
- Joined: Fri Mar 08, 2013 12:13 pm
- Location: UK
Re: 100% Lagless Emulation is Here!
It isn't quite that simple. You should only ever remove the amount of lag frames that an individual game exhibits. 99% of the NES, SNES and Megadrive games that I have tested only have 1 frame of lag. If you were to remove 2 frames with these titles then you will chop out a frame of animation.casualcoder wrote:For example, if your HDTV you're playing on has 2 frames of lag built-in, you can simply compensate by reducing by -2 frames within the game emulation side of things.
-
tomwhite2004
- Posts: 319
- Joined: Fri Mar 08, 2013 12:13 pm
- Location: UK
Re: 100% Lagless Emulation is Here!
Whilst a game is running press "p" to pause the emulation. Then hold a button on your controller and press "k" to advance frames. In super mario world for example you will notice that mario moves or jumps on the third frame, this means you should remove two frames. It's always best to press all buttons, action and movement as sometimes certain attacks can have more lag than say the main movement of a character, in which case you want to remove the lowest figure.OmegaFlareX wrote:How do you set it up? What options need to be selected? A short guide would be beneficial.
Then it is as simple as going into the core option with f1, going into the latency options and turning on run ahead and selecting the amount of frames to remove. If you get sound issues then turn on the second instance option which runs another emulator in parallel to exclusively handle the audio.
Then either save on a per game or core basis (1 frame is a safe setting if you can't be bothered to do it on a per game basis) and return to the game. You should now have the character respond on the next frame when pausing and advancing the frames as you did initially. This along with hard gpu sync at 0, windowed fullscreen off and as much frame delay as your cpu can manage makes an absolutely huge difference.
Let me know if this is coherent! If not am happy to put a wee guide together with some screenshots and examples.
-
casualcoder
- Posts: 346
- Joined: Sat Apr 21, 2012 4:35 am
- Location: West Coast, Canada
Re: 100% Lagless Emulation is Here!
Yeah I didn't make that fully clear. Obviously if a game has only 1 frame of lag then you will not be able to subtract 2 frames. If you try to, it will cause a glitch. Obviously this is how NOT to use the feature.tomwhite2004 wrote: It isn't quite that simple. You should only ever remove the amount of lag frames that an individual game exhibits. 99% of the NES, SNES and Megadrive games that I have tested only have 1 frame of lag. If you were to remove 2 frames with these titles then you will chop out a frame of animation.
But that 1 frame will still make a difference if your TV has at least 1 frame of lag.
-
casualcoder
- Posts: 346
- Joined: Sat Apr 21, 2012 4:35 am
- Location: West Coast, Canada
Re: 100% Lagless Emulation is Here!
I'll create a guide as soon as I finish up some setup on my end but basically just install the latest Retroarch and pick a core for whatever you want to play.OmegaFlareX wrote:How do you set it up? What options need to be selected? A short guide would be beneficial.
I recommend starting with SNES9x core and load some SNES roms. Some mame games are a bit more tricky to get going at first, so that's why I recommend that for testing.
Once you load the game press pause with the [P] key, then press & hold an arrow key to move your character. Since you're in pause your character won't move. So, while holding the arrow down press the [K] key to advance the frame. Count the frames BEFORE you see the character move and that's what you'll want to set your latency compensation to. (IE If it takes 2 presses of the [K] key to see the character move, you'll want a latency of "1").
Press [F1] and go to "Latency." Turn it to ON, and set it to the value you determined from instructions above.
If the audio sounds odd, be sure to also turn on the "second instance" option as this will run another emulation that it will use for the audio only.
You can re-test that the settings are correct by repeating the first "pause" steps outlined above. If you see the character move on the first press of the [K] key, then you got it right. Actually, do be careful because if you didn't count the frames right advance too far ahead. Avoid this by (A) counting your frames correctly and (B) watching how the character moves on the first [K] press. If it seems the character moves too far or in an animation frame that doesn't look like the first frame, then repeat the steps to get it right.
If you're happy with your results you'll want to save it to the game specific overrides (every game will be different). So again in the [F1] menu scroll down or select the game from the favorites part of the menu and scroll until you see the part about saving overrides. Select "Save game override."
That's basically it. The exact same process can be used for any game.
Re: 100% Lagless Emulation is Here!
It would be awesome to have a guide for setting up mame games in Retroarch. I can only play one game at a time, so it being a bit trickier isn't the worst thing.
Edit: Tried getting Battle Garegga setup. Having difficulty getting the audio correct though.
Edit: Tried getting Battle Garegga setup. Having difficulty getting the audio correct though.
Re: 100% Lagless Emulation is Here!
Can't someone just release a newer shmupmame that does this shit in a much easier fashion?
Re: 100% Lagless Emulation is Here!
What I'm wondering every time this comes up is, how come Super Mario World has inherent input "lag" at all? And 3 frames at that. Isn't it normal procedure to buffer the entire controller input during vblank and process it on the following frame?
Re: 100% Lagless Emulation is Here!
call me stupid, i never touch retroarch with a feet
just use same old emulators (and doing it separetely, without fancy multi- shells) i used for ages and not gonna switch horses
i'm too slow to notice lags so whatever
just use same old emulators (and doing it separetely, without fancy multi- shells) i used for ages and not gonna switch horses
i'm too slow to notice lags so whatever
-
tomwhite2004
- Posts: 319
- Joined: Fri Mar 08, 2013 12:13 pm
- Location: UK
Re: 100% Lagless Emulation is Here!
SMW has two frames of lag. As to why the only sort of explanation I have ever seen is in this video. " if the gamemode routine takes too long, the V-Blank routine cannot update for the next frame, so a lag frame is needed to allow the gamemode routine to finish."Sumez wrote:What I'm wondering every time this comes up is, how come Super Mario World has inherent input "lag" at all? And 3 frames at that. Isn't it normal procedure to buffer the entire controller input during vblank and process it on the following frame?
https://www.youtube.com/watch?v=tD6fCPPmBMA
Re: 100% Lagless Emulation is Here!
That sounds like someone paraphrasing something they don't fully understand.
What that quote talks about is what causes slowdown in games. If Super Mario World consistently spent two frames running its game logic routine, it would be running at a constant 30fps
What that quote talks about is what causes slowdown in games. If Super Mario World consistently spent two frames running its game logic routine, it would be running at a constant 30fps
-
- Posts: 95
- Joined: Sat Dec 02, 2017 5:08 pm
- Location: PA,USA
Re: 100% Lagless Emulation is Here!
This is fascinating, as I notice the lag switching between flatscreens and CRTs and it keeps me away from certain emulators and screen types for the sake of a consistent experience. This epoch makes the flatscreen barcade look a lot more appealing.
Re: 100% Lagless Emulation is Here!
If I'm playing on a 480p CRT PC monitor or in 240p on a CRT through a converter, will I see any advantages?
Re: 100% Lagless Emulation is Here!
RetroArch. Eh . . . yeah.
Emulation's most complex CAPTCHA. Every time I come back to it, I end up like Sisyphus.
So don't even get me fucking started, on this No-Lag Mode, voodoo, time-travelling bullshit!
With that being said, I hear this new magic is very good?
I must give it a try
Emulation's most complex CAPTCHA. Every time I come back to it, I end up like Sisyphus.
So don't even get me fucking started, on this No-Lag Mode, voodoo, time-travelling bullshit!
With that being said, I hear this new magic is very good?
I must give it a try
-
tomwhite2004
- Posts: 319
- Joined: Fri Mar 08, 2013 12:13 pm
- Location: UK
Re: 100% Lagless Emulation is Here!
Shitbags, I really didnt look at that clearly enough, they are clearly talking about slowdown rather than input lag, sorry.Sumez wrote:That sounds like someone paraphrasing something they don't fully understand.
What that quote talks about is what causes slowdown in games. If Super Mario World consistently spent two frames running its game logic routine, it would be running at a constant 30fps
Ditto, with both MAME and Final Burn Alpha. From what I have read and experienced it seems that it is 50/50 if a game will work properly or not with those cores. Some have the sound too fast, some too slow with no way of correcting anything if that is the case.kaiza wrote:Edit: Tried getting Battle Garegga setup. Having difficulty getting the audio correct though.
Re: 100% Lagless Emulation is Here!
I'm running RetroArch at 1080p@120hz here (audio sync as a frame limiter) with scanline-fract shader and I'm testing Higan with runahead and second instance.
And I'm using vulkan with a 1080 Ti, if that makes any difference. Exclusive full screen and didn't change anything else.
Is this actually too heavy for a i7 6700k overclocked at 4.5ghz?
I was trying some SA1 Snes games and I had to turn RunAhead off.
Also tried nSide which should be a lighter port of Higan but still too heavy to run using RunAhead and SA1.
Not sure if matters but I was testing a Super Mario World hack.
And I'm using vulkan with a 1080 Ti, if that makes any difference. Exclusive full screen and didn't change anything else.
Is this actually too heavy for a i7 6700k overclocked at 4.5ghz?
I was trying some SA1 Snes games and I had to turn RunAhead off.
Also tried nSide which should be a lighter port of Higan but still too heavy to run using RunAhead and SA1.
Not sure if matters but I was testing a Super Mario World hack.
CapivaraGamer
http://capivaragamer.com.br
http://capivaragamer.com.br
Re: 100% Lagless Emulation is Here!
Yep. That's a heavy load on your rig. It probably is too much.fandangos wrote:I'm running RetroArch at 1080p@120hz here (audio sync as a frame limiter) with scanline-fract shader and I'm testing Higan with runahead and second instance.
And I'm using vulkan with a 1080 Ti, if that makes any difference. Exclusive full screen and didn't change anything else.
Is this actually too heavy for a i7 6700k overclocked at 4.5ghz?
I was trying some SA1 Snes games and I had to turn RunAhead off.
Also tried nSide which should be a lighter port of Higan but still too heavy to run using RunAhead and SA1.
Not sure if matters but I was testing a Super Mario World hack.
Emulation depends heavily on your processor, so your GPU makes little difference. Although, you might try setting the emulator to 480p and using the GPU scaling option to get 1080p. That will offload the scaling duties to the GPU and take a task off Retroarch's plate.
Why 120Hz? Are you using black frame insertion?
Disable vsync. Use adaptive sync or try setting your video output to match the system refresh rate.
Why second instance? That's an expensive option. Were you having issues? You should get a good boost from disabling that.
Also, how many frames are you trying to claw back?
One last thing, the best answers to these questions are probably at the Libretro forums. It's not perfect over there, but it's a much better community than the usual neogaf or gbatemp shitholes (much like this fine establishment right here).
We apologise for the inconvenience
-
tomwhite2004
- Posts: 319
- Joined: Fri Mar 08, 2013 12:13 pm
- Location: UK
Re: 100% Lagless Emulation is Here!
It's worth noting that both Higan and nSide have 1 frame of input lag more than any other SNES core in Retroarch as they do not have the "Brunnis lag fix". So by removing a frame from Higan you are still only at the baseline for all the other cores. As orange808 said only turn on the second instance if you have sound issues, otherwise put that extra processing power towards frame delay.fandangos wrote:I'm testing Higan with runahead and second instance.
Re: 100% Lagless Emulation is Here!
I didn't have to use frame insertion or Vsync /2 to get 60hz.orange808 wrote:
Why 120Hz? Are you using black frame insertion?
I'm using 120hz because in this mode my TV has only 16ms of lag because it's kind of a "secret mode" and many built in scalling features that can't be turned off by the TV menu and gets deactivated this way.
I'm using 2 frames since this is what a measured here.orange808 wrote: Also, how many frames are you trying to claw back?
I get 60fps if I don't press anything if I start playing the game it drops to 55 fps and gives me audio problems.
I'll try disabling second instance or try Snes9X to see if I can get a better performance.
Also frame delay is set to zero here.
CapivaraGamer
http://capivaragamer.com.br
http://capivaragamer.com.br
Re: 100% Lagless Emulation is Here!
It should be.Sumez wrote:What I'm wondering every time this comes up is, how come Super Mario World has inherent input "lag" at all? And 3 frames at that. Isn't it normal procedure to buffer the entire controller input during vblank and process it on the following frame?
This is actually a very good question.
Afaik, SMW in particular has been reverse-engineered a lot, so some people probably know how it works well, and could explain it.
Re: 100% Lagless Emulation is Here!
The real problem is that this is limited to RetroArch and their special brand of tyranny. No thanks. Hopefully Bizhawk gets on it soon.
Rage Pro, Rage Fury, Rage MAXX!
Re: 100% Lagless Emulation is Here!
The developers had their reasons. The game loop was designed with the latency there. It's supposed to be there.Keade wrote:It should be.Sumez wrote:What I'm wondering every time this comes up is, how come Super Mario World has inherent input "lag" at all? And 3 frames at that. Isn't it normal procedure to buffer the entire controller input during vblank and process it on the following frame?
This is actually a very good question.
Afaik, SMW in particular has been reverse-engineered a lot, so some people probably know how it works well, and could explain it.
We apologise for the inconvenience
-
WelshMegalodon
- Posts: 1225
- Joined: Fri Dec 11, 2015 5:09 am
Re: 100% Lagless Emulation is Here!
Couldn't have said it better myself.Despatche wrote:The real problem is that this is limited to RetroArch and their special brand of tyranny. No thanks. Hopefully Bizhawk gets on it soon.
Indie hipsters: "Arcades are so dead"
Finite Continues? Ain't that some shit.
Finite Continues? Ain't that some shit.
RBelmont wrote:A little math shows that if you overclock a Pi3 to about 3.4 GHz you'll start to be competitive with PCs from 2002. And you'll also set your house on fire
Re: 100% Lagless Emulation is Here!
It is how it was programmed (at least, according to tests), of course it is there. But supposed to be there ? It probably didn't need to be be programmed that way. Just the same, computer games made for a wide range of evolutive hardware (PC ?) do not need be capped at 30 or 60fps*, they can be made to run and feel better while still being the same game. Still, many games come capped to 60fps, just because that takes a little less effort (probably).orange808 wrote:The developers had their reasons. The game loop was designed with the latency there. It's supposed to be there.
Anyway, it looks like there is SMW disassembly https://raw.githubusercontent.com/gnagh ... MWDisC.txt if someone with the knowledge ever feels bored enough to understand the mystery of the three frames
Last edited by Keade on Mon Aug 06, 2018 7:43 pm, edited 3 times in total.
Re: 100% Lagless Emulation is Here!
Input lag isn't "supposed to" be there. This is like scanline fetishism. No, sprites aren't really drawn for scanlines, and sprites often aren't drawn for the actual TV output at all. Likewise, most games aren't really "designed" for input lag, because most input lag is very minor and can easily be adapted to if it changes. Now, I greatly prefer hardware accuracy and the lag that's actually supposed to be there, but I don't blame people at all for trying to circumvent that. As long as the lag is being emulated properly and is always presented as the default, an option to go beyond the pendulum should never be an issue.
Options are good, especially in emulation. Why don't people understand this yet?
Options are good, especially in emulation. Why don't people understand this yet?
Rage Pro, Rage Fury, Rage MAXX!