An input lag investigation

Hello Brunis, thank you for all your work on input lag, it is very thorough. Do you own any arcade/fight sticks that you could possibly do any input lag testing on? Really interested to know how the 8bitdo N30 arcade stick stacks up to other sticks like Qanba, Hori, Brooks, etc.

Sorry, I only own a bunch of gamepads, no arcade controls.

This guy on Facebook solved it,maybe you can use his “data” instead?

Anthony Ball lol. Maximum input lag on a 60hz SNES games is 16ms. Your game is displayed and on the next vblank you process the previous grab from the controller. So if you run at 60hz then the delay from gab to processing is less than 1/60 sec. 1/60 sec is 16ms. I don’t remember any games on the SNES that didn’t run at 60hz.”

LOL indeed… :stuck_out_tongue:

Killer work man! I actually suspected the exact same thing about retroarch just needing to use one frame of run ahead to match console. I wonder do you think if you use 15 Frame delay, rather than run-ahead, it would match console?

Thanks! And, yes, given low latency controllers and otherwise well-behaving system/drivers/emulators, the settings I’ve listed in previous tests combined with a Frame Delay setting of 15 will get very close (as in indistinguishable) to the actual consoles. In absolute terms, this should get you within 5 ms, not counting any input lag caused by the display.

Here’s a pretty major input lag issue with the snes9x2002 core that I don’t think has been discussed previously:

I have never run any tests on snes9x2002 previously, since I haven’t used slow enough hardware to need the core. Now that I’ve started looking into a project where I will need it, I decided to run a few tests and it’s not looking good. See the linked issue for the details.

This will pretty much affect anyone running SNES on a Pi/Pi Zero.

Would be awesome if someone feels motivated to look into it. I really, really shouldn’t, due to far too much other stuff going on at the moment.

1 Like

I got 1 frame back.

Then it’s about adapting your fix but I’m not sure of myself here.

Awesome! That was quick! :smiley:

EDIT: By the way, I think the input lag added by this polling issue you fixed is between zero and one frame, varying depending on the individual frame processing times. For frames that are completed quickly, there will be a longer wait for the next frame and the sampled input will be more stale.

@Brunnis

Just curious, did you ever had a chance to glance over the mame libretro input lag issue?

I’m not after a solution, but would be interested in your opinion on the matter. There’s definitely something not right with the input response.

I’m mostly wondering whether the issue could not so much be a wrong moment of input polling, but something very different causing the issue (timer / throttle related or something.)

Is there any chance you could find some time to look into this matter?

(No is a valid answer for sure, I know about the amount of time you spent on the BSNES issue in the past. Still appreciating that find to this day :slight_smile: )

Sorry, never really looked into that. I’m not personally into Mame, so I haven’t prioritized it. Besides, life looks quite different now compared to 2015/2016 when I did most my old tests and contributions. I’ve since got kids (twins) that are now almost two years old. For the past two years I’ve also spent most of my limited free time on planning and building my new house. Combined with running my own business, there’s just not much time for other fun projects anymore.

With that said, and with the risk of sounding like a hypocrite, I sacrificed my sleep last night and stayed up to have a look at the snes9x2002 input lag issue. I ported the old lag fix without much trouble. However, it seems snes9x2002 is partly implemented in assembly (for ARM systems). I will need to find some more time to look at this. But status right now is that input lag is the same as on the other snes9x versions when running on Windows (nothing is committed yet though). I’m guessing pretty much no one uses snes9x2002 on platforms other than ARM, though…

2 Likes

Well, Snes9x2002 accuracy is rather bad.
You should use it only if your machine isn’t fast enough for more recent versions.

No probs. I know what it’s like with young kids. It gets a little bit easier when the youngest (in your case both :slight_smile: ) gets about 3 - 4. But indeed even then with work and other stuff going on it’s hard to really spend late night hours (and hours…) on this stuff. (Other than risking your relation/marriage in the proces…).

That said here’s one vote up for looking into the MAME lag, and one vote down for the Snes9X2002 lag! :wink: :smiley:

Yep, I’m guessing it’s mostly used for Pi Zero nowadays. That’s also what I consider using it with.

Hehe, the part about risking your relation or marriage is so true. :smile:

Running bsnes balanced on OpenGL video driver I get like 4 frames of input lag for SMW. I’m using Hard Sync ON at 0 but when I enable run ahead (1 frame only) the framerate crawls, even with the second instance enabled. My CPU is an i5-4670K @ 4.1Ghz. Is this normal? On fbalpha I’m ok at 3 frames of runahead.

Run ahead doesn’t work fine with bsnes/higan.
(smw should react on the 3rd frame if it’s a bsnes core)

I could make it work but I had to go as low as “bsnes-mercury performance”, and enable the second instance for 2 frames runahead (next frame response). I’m not sure what I am sacrificing with the performance variant, specially on the mercury versions.

For anyone interested, you can find the lag fix implementation for snes9x2002 here:

Tested and works on Windows. Should work on Raspberry Pi/RetroPie, but haven’t had time to test yet. Will create a pull request as soon as I’ve verified it on the RPi as well.

Luckily, I didn’t have to mess around with the assembly code after all, but I did have to add an extra line of code in an ARM specific C file.

EDIT: I’ve now tested it on Raspberry Pi (RetroPie) and I’ve fixed an issue it caused with save states. Pull request has been submitted.

3 Likes

Hi and I thought it was appropriate to post it here, otherwise I’m sorry.
The device used is under Windows 10 is Retroarch 1.7.6 running Dolphin core (6fc5941).

Dolphin to like the MAME, has an additional input lag of 1 frame compared to the standalone, but the GC title has no additional lag.
The titles investigated are Gradius ReBirth (Wii Ware), Muramasa (Wii), Soulcalibur II (GC) and F-Zero GX (GC).

Why is there no 1 additional frame of input lag in GC titles?
Also, is it possible that 1 additional frame of input lag delay of the Wii title will be eliminated?

Thanks

Just curious, HOW did you test the lag? Can you provide a step-by-step description how you tested it and came to the conclusion of one frame of lag?

If you provide these details the devs can maybe reproduce what you found and do something about it. Otherwise don’t get your hopes up.