Welcome!

Final Burn Neo => FBN Development => Topic started by: Tatsuya79 on March 31, 2018, 12:45:37 PM

Title: input lag is too high on certain games?
Post by: Tatsuya79 on March 31, 2018, 12:45:37 PM
Hello, thanks for this great emulator.

I'm using it more into RetroArch these days but I want to report a problem I verified in stand-alone as well.
Some games have extra frames of input lag compared to Mame.

Example, Dodonpachi has 4 frames before a reaction on screen while it's only 2 in Mame stand-alone.
Viewpoint has 3 frames vs 2 in Mame.

Where it gets strange is that another Neo-Geo game like KOF98 doesn't exhibit any additional frame of lag.
So is it an auto-fire code or something that would add the lag? something particular to some games?

All this is tested by putting games on pause, then keeping a button/direction pushed down, going frame by frame ahead till you see the action effective on screen.
You can do that with the K hotkey in RetroArch.

In FinalBurn Alpha I couldn't find a key so I had to record a video before counting the frames in a media player.
It would be a great addition to have that for testing purpose.
Title: Re: input lag is too high on certain games?
Post by: Fulg0re on March 31, 2018, 01:37:10 PM
Hi

i also use FBA on my Custom Arcade Machine. Incl. Arcade PC.
I cant confirm this issue. On shooters i dont havce any problems.
I usually play it with standard setup an es?ecially for al kind of CAVE
Games i config a seperat button for autofire. For some CAVE Games
i need to run MAME cause a few games are not possible to run on
FBA for now..... All Neo Geo Beat em ups i play on FBA without any
problems and i pleay some of the on a very high difficult level which
assume a high accuracy of input for some move. Also i use MAME
for Killer Instinct 1 & 2 ... without an problems an MAME for all
kind of Mortal Kombat Games....

I Play on a CRT Monitor. Normal and Tate Mode

Kind regards
Title: Re: input lag is too high on certain games?
Post by: iq_132 on March 31, 2018, 02:05:22 PM
Are you using MAME from MAMEDev.org or something shmupMAME?
Title: Re: input lag is too high on certain games?
Post by: Fulg0re on March 31, 2018, 02:13:38 PM
Me ?


latest MAME 0195 32bit.
10 % Overclock CPU Ingame and everythings runs okay.

Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on March 31, 2018, 04:13:41 PM
It's official MAME.
Title: Re: input lag is too high on certain games?
Post by: dink on March 31, 2018, 07:13:14 PM
technique:
fba: pause + right key + F1 to frame advance
mame: pause + right key + leftShift-P to frame advance

Windowed: Using mame 0.195 I get 2 frames in DoDonpachi and 4 in FBA for inputlag.
You will get an extra frame of lag fullscreen due to video buffers/flipping/etc.  I didn't test fullscreen. 

Let's do some debugging:
so, testing DoDonpachi in fba, I have it print out the inputs every frame to a debug window.  It registers that the input has been pressed on the very first frame, but, the game doesn't respond until the fourth frame.

What could be going on here?  Definitely the problem isn't FBA's input handling, because it registers the input immediately.  I think something might be wrong with the game's timing.  I will look into it deeper tonight / do some experimentation and post back here when I have some good info.

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: dink on April 01, 2018, 12:24:20 AM
DoDonpachi:

After a bit of tweaking and without doing anything too hacky, I got the inputlag down to 2 frames in FBA(!). 

I will have to do some playtesting tomorow to make sure nothing had been adversely affected.

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: furiadeoso on April 01, 2018, 04:54:46 AM
Could it also be happening in some neo-geo and cps1 games like metal slug or kod? I have always had the feeling of having a little more input lag than in MAME++ 0.119. But I've never stopped to test it.
Title: Re: input lag is too high on certain games?
Post by: Fulg0re on April 01, 2018, 05:22:22 AM
HI

worst Laag on Neo Geo Games is without a doubt on Art of Fightin 2.
I got this on AES and on FBA or Mame ... very ugly to me....
Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on April 01, 2018, 06:03:10 AM
technique:
fba: pause + right key + F1 to frame advance

Oh cool! I did not find that!

Glad you found what was the problem in Dodonpachi.
Is it something that can also happen in other game/driver or specific to this one only?
Title: Re: input lag is too high on certain games?
Post by: dink on April 01, 2018, 09:03:01 AM
Tatsuya79, this is a hard one to answer.  There is nothing wrong with the input system in fba, it responds perfectly.  The thing is, every game uses an almost completely different timing method.
I found that donpachi & dodonpachi can both be improved, since they both have very similar emulation code.

Please check your pm :)

best regards,
- dink

Title: Re: input lag is too high on certain games?
Post by: dink on April 01, 2018, 09:27:26 AM
Actually, going to need to look into this deeper.  I noticed a nasty side effect.  Back to the drawing board :)
Title: Re: input lag is too high on certain games?
Post by: dink on April 01, 2018, 10:14:53 PM
Hmm, seems the best I can get so far is 3 frames in DonPachi / DoDonpachi.  I can bring it down to 2, the tile:sprite layers get desynched.  I'm not too convinced that these extra 1 or 2 frames faster response will help the games any - and I'm quite the master of both of them.  I'm also worried that the timing differences might cause problems down the line, because I've been playing DonPachi/DoDonPachi for years in fba without issue.  Anyhow.. my personal opinions aside - what do you guys think?

Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on April 02, 2018, 08:15:40 AM
Well, the shorter input delay is always the best, as long as it doesn't break anything.

I thought it was some particular problem but perhaps FBA is just using and older driver for this game that was modified at a later date in MAME, and that gave better result on the input lag front.

Perhaps it's different for neogeo games?
As some like Last Resort or Viewpoint react in 3 frames vs 2 for MAME, while other games of the same driver like KOF98 don't?
Title: Re: input lag is too high on certain games?
Post by: dink on April 02, 2018, 08:57:26 AM
Don't worry, I didn't give up - I will not be beat.  I have just been collecting recon with rant's inbetween... :)

dp and ddp are very very timing sensitive when it comes to vbl and sprite buffering, I mean, just a couple cycles off and it will do one of 3 things:
1: go out of sync with sprite:tile layer (usually when getting close to the 2 frames of reaction time)
2: go between 2-4 frames of reaction time
3: explode!

if you get it exactly right, it will react in 2 frames with no bad side effects.  that being said, our dp / ddp now reacts in 2 frames. with no side effects.  tonight I'll do the ultimate playtest.

p.s. fba doesn't use drivers from mame :)

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: furiadeoso on April 02, 2018, 11:14:28 AM
I will be happy as long as it has no side effects in the netplay.
the word "desync" gives me a little fear. :eek:
Title: Re: input lag is too high on certain games?
Post by: dink on April 02, 2018, 09:05:45 PM
I will be happy as long as it has no side effects in the netplay.
the word "desync" gives me a little fear. :eek:

Your fears aren't without warrant, that's why I don't like messing with the timing of games that have been working great for years.  But don't worry, if something goes wrong we can just change it back :)

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: furiadeoso on April 03, 2018, 03:08:28 AM
Your fears aren't without warrant, that's why I don't like messing with the timing of games that have been working great for years.  But don't worry, if something goes wrong we can just change it back :)

best regards,
- dink
Thanks, Dink :smilie:
Title: Re: input lag is too high on certain games?
Post by: dink on April 03, 2018, 07:47:02 AM
the updated do/donpachi driver's w/2 frame reaction time have been sent to the libretro fba guy (barbudreadmon), if everything goes well they will be in the fba core in a few days.

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: furiadeoso on April 03, 2018, 02:44:13 PM
the updated do/donpachi driver's w/2 frame reaction time have been sent to the libretro fba guy (barbudreadmon), if everything goes well they will be in the fba core in a few days.

best regards,
- dink
Great! Thanks! I'll try it on netplay.
Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on April 03, 2018, 05:39:45 PM
Thanks! hope all will go well with that change.

I thought FBA was using older MAME drivers that got modified over time, guess I was wrong.  :p
Title: Re: input lag is too high on certain games?
Post by: dink on April 03, 2018, 06:27:58 PM
If that really was the case, I wouldn't be here.. :)
Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on April 04, 2018, 07:55:07 PM
And I most surely used it to play cps games back in the days reading a brief history now...

Time makes things cloudy.
Title: Re: input lag is too high on certain games?
Post by: barbudreadmon on April 05, 2018, 05:55:58 AM
the updated do/donpachi driver's w/2 frame reaction time have been sent to the libretro fba guy (barbudreadmon), if everything goes well they will be in the fba core in a few days.

best regards,
- dink
Done !
Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on April 07, 2018, 08:09:42 AM
Just went through Dodonpachi in RetroArch, didn't see any issue and I used the new read ahead feature to have next frame reaction.

Great work, thank you! :)
Title: Re: input lag is too high on certain games?
Post by: dink on April 07, 2018, 09:10:09 AM
excellent news!

what's this read ahead feature about?

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on April 07, 2018, 09:25:06 AM
Details explained here. (https://www.libretro.com/index.php/retroarch-1-7-2%e2%80%8a-%e2%80%8aachieving-better-latency-than-original-hardware-through-new-runahead-method/)


It's hit or miss with fba depending of the game, I opened an issue to discuss it here. (https://github.com/libretro/fbalpha/issues/197)
Title: Re: input lag is too high on certain games?
Post by: dink on April 07, 2018, 06:05:17 PM
Not touching that one with a 40ft pole :) sorry.
Title: Re: input lag is too high on certain games?
Post by: Tatsuya79 on September 23, 2018, 07:40:54 PM
Well, it's working now. :)

It was missing something in the serialization part (https://github.com/libretro/fbalpha/commit/7c79ba992cafa6e4cfb5519c67fec5f4b60cb990) and an additional fix in retroarch run ahead code.
Now it's good if you use the 2nd instance mode, no more sound issues, I just finished Batrider with 4 frames of lag removed.
That's pretty neat!
Title: Re: input lag is too high on certain games?
Post by: dink on September 23, 2018, 10:15:03 PM
Tatsuya79, thanks for the news :)

Nice work getting this working, barbudreadmon!

best regards,
- dink
Title: Re: input lag is too high on certain games?
Post by: barbudreadmon on September 24, 2018, 09:51:41 AM
Nice work getting this working, barbudreadmon!
They did all the research, i only applied the fixes.