MAMEWorld >> EmuChat
View all threads Index   Flat Mode Flat  

DaRayu
MAME Fan
Reged: 02/05/13
Posts: 162
Send PM
Re: Input lag
04/14/13 11:18 PM


> I've never seen anyone figure out all the best settings to reduce it meaningfully. If
> you figure it out let us know but I don't think anyone here has figured it out, thus
> you not getting an answer.

Well, as I said: It's not about reducing input lag from an absolute point of view. If someone thinks that the games already lag with the default settings, then I can't help him either. What I was referring to: If we take MAME with its default options as the basis, how will other options increase input lag?

An example: If you say that
mame suprmrio
plays fine for you, input-wise, but you want to remove the tearing when the game scrolls, then you might ask yourself what options to set without adding input lag. And that's what my tests were about.

My results:

If you have your screen set to 60 Hz and play "Vs. Super Mario Bros." (which is also set to 60 Hz) and Mario stands on the ground and you press the jump button, then it will take 3 frames until he jumps. So, from pressing the button to the first jumping animation on the screen it's 3 frames. That's our basis. And now we see how many frames the whole procedure needs with additional options.

At first: Don't use triple buffering. Triple buffering is deadly. Using triple buffering adds 2 to ~3.5 frames to the general 3 frames before the output reflects the input.
As I said above (and if I've understood triple buffering correctly), that's natural: If you render two screens in memory before displaying them, the visible output is always two frames behind the actual game scene. Even the most perfect hardware cannot do anything against it: If MAME shows scene 1 while rendering scene 2 and 3 in memory, then the input will refer to scene 3 while you are seeing scene 1 on the screen. That's why you shouldn't use triple buffering. Input lag is an integrated part of it and my tests confirmed it.

The other option to remove tearing: vsync. Here, it is a bit strange:
If you use Direct3D, vsync will produce about ~3.3 additional frames. (So, since the duration without any options is 3 frames, with vsync in Direct3D, Mario will take ~6.3 frames until he jumps.)
But if you use vsync with DirectDraw, then the lag will merely be ~0.3 frames, i.e. less than a single frame on average.

I don't know why that's the case. I don't know why vsync in Direct3D lags so much more than vsync in DirectDraw. My PC is from 2010, an Intel QuadCore, 2.33 GHz, 4 GB RAM, which should be more than enough to run MAME smoothly, so it's probably not the hardware. I even checked the stuff with MAME 0.127 from 2008. It must be a Direct3D issue. I also noticed input lag in the NES emulator Nestopia when vsync is enabled while there doesn't seem to be any noticable input lag in FCE Ultra. And guess what: FCE Ultra is DirectDraw, Nestopia is Direct3D.

Conclusion: If you want to play a game without tearing when the game scrolls and without relevant input lag, the best option is
mame -video ddraw -waitvsync -notriplebuffer
Triple buffer always lags. And Direct3D lags if you combine it with vsync. Vsync with DirectDraw is almost as good as with standard options.


How did I measure it? Quite easy. Everybody can do this and check the results for himself: You need a video camera that can shoot videos with 60 FPS. Set your monitor to 60 Hz. Start MAME with "Vs. Super Mario Bros." (or any other game you want to check) and map the jump button (or whatever button you need) to either the Num Lock, Caps Lock or Scroll Lock key. Those are the keys that are connected to a small LED on the keyboard. Now position the video camera in a way that the keyboard LEDs and Mario on the screen are in good view. Record it and let Mario jump a few times. And now watch the video frame by frame. As soon as the LED starts glowing, count the frames to see how long it takes from the keyboard physically registering the key press to the first jump animation. That's it.


About the relationship between MAME and an actual arcade board: Well, you would need an input device with an LED and could do the same. I don't know if "Super Mario Bros." on an actual arcade board or on an NES would need three frames from button press to output or if it reacts even quicker. But that's something that someone who owns this stuff and who knows how to connect an LED to a controller could find out quite easily. That's why I don't really understand how there can be so much controversy about it. Get a camera, put it to 60 FPS and then record the screen and your input device LED. Do this 20 times and you should have quite a reliable average value which you could check against MAME. Then you know if the complainers are right or if they just imagine an input lag.
This guy did it with the PlayStation "Street Fighter" games and he's the one where I got the method from:
www.youtube.com/watch?v=JoJzobmdGzU







Entire thread
Subject Posted by Posted on
* Input lag DaRayu 04/07/13 11:47 AM
. * Hey, this thread looks like it spawned a decent conversation.... italieAdministrator  04/27/13 08:19 PM
. * Re: Input lag jumpmaniac81  04/07/13 04:12 PM
. * Re: Input lag DaRayu  04/07/13 11:19 PM
. * Re: Input lag DaRayu  04/10/13 11:17 PM
. * Re: Input lag DaRayu  04/11/13 10:57 PM
. * Re: Input lag AWJ  04/11/13 11:44 PM
. * Re: Input lag DaRayu  04/11/13 11:47 PM
. * Re: Input lag B2K24  04/12/13 01:56 AM
. * Re: Input lag DaRayu  04/13/13 02:10 PM
. * Re: Input lag R. Belmont  04/13/13 10:08 PM
. * Re: Input lag DaRayu  04/14/13 05:36 PM
. * Re: Input lag SmitdoggAdministrator  04/14/13 05:50 PM
. * Re: Input lag DaRayu  04/14/13 11:18 PM
. * Re: Input lag Bryan Ischo  04/22/13 06:23 PM
. * Re: Input lag DaRayu  04/22/13 10:51 PM
. * Re: Input lag Bryan Ischo  04/23/13 09:08 AM
. * Re: Input lag Bryan Ischo  04/24/13 10:04 PM
. * Re: Input lag Bryan Ischo  04/23/13 02:01 AM
. * Re: Input lag Anonymous  04/23/13 12:37 AM
. * Re: Input lag R. Belmont  04/15/13 06:27 PM
. * Re: Input lag DaRayu  04/15/13 10:30 PM
. * Microstutter; ATi's dark little secret. Firehawke  04/16/13 05:00 AM
. * Re: Microstutter; ATi's dark little secret. StilettoAdministrator  04/16/13 05:44 AM
. * Flip Queue Size Calamity  04/17/13 01:50 PM
. * Re: Flip Queue Size R. Belmont  04/17/13 02:48 PM
. * Re: Flip Queue Size Calamity  04/17/13 04:01 PM
. * Re: Flip Queue Size R. Belmont  04/17/13 05:41 PM
. * Re: Flip Queue Size DaRayu  04/18/13 12:32 AM
. * Re: Flip Queue Size grog  04/18/13 11:38 AM
. * Re: Flip Queue Size DaRayu  04/18/13 12:52 PM
. * Re: Flip Queue Size grog  04/18/13 01:27 PM
. * Re: Flip Queue Size DaRayu  04/18/13 02:28 PM
. * Re: Flip Queue Size grog  04/18/13 06:21 PM
. * Re: Flip Queue Size R. Belmont  04/19/13 04:21 AM
. * Re: Flip Queue Size DaRayu  04/19/13 08:38 AM
. * Re: Flip Queue Size Calamity  04/19/13 11:07 AM
. * Re: Flip Queue Size DaRayu  04/19/13 11:53 AM
. * Re: Flip Queue Size Calamity  04/19/13 08:04 PM
. * Re: Flip Queue Size DaRayu  04/20/13 01:59 PM
. * Re: Flip Queue Size Calamity  04/20/13 11:24 PM
. * Re: Flip Queue Size DaRayu  04/21/13 11:51 AM
. * Re: Flip Queue Size Calamity  04/21/13 03:45 PM
. * Re: Flip Queue Size DaRayu  04/21/13 06:54 PM
. * Re: Flip Queue Size Calamity  04/24/13 12:06 AM
. * Re: Flip Queue Size DaRayu  04/24/13 04:27 PM
. * Re: Flip Queue Size Bryan Ischo  04/24/13 10:27 PM
. * Re: Flip Queue Size SmitdoggAdministrator  04/25/13 06:35 PM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 06:45 PM
. * Re: Flip Queue Size Sune  04/25/13 12:35 AM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 12:51 AM
. * Re: Flip Queue Size Anonymous  04/25/13 03:28 PM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 06:07 PM
. * Re: Flip Queue Size Vas Crabb  04/26/13 03:35 AM
. * Re: Flip Queue Size Bryan Ischo  04/26/13 06:03 PM
. * Re: Flip Queue Size Vas Crabb  04/27/13 02:02 AM
. * Re: Flip Queue Size DaRayu  04/25/13 11:45 PM
. * Re: Flip Queue Size Anonymous  04/25/13 07:58 PM
. * Re: Flip Queue Size SmitdoggAdministrator  04/25/13 06:39 PM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 06:47 PM
. * Re: Flip Queue Size casm  04/25/13 09:13 PM
. * Re: Flip Queue Size Sune  04/25/13 01:14 AM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 01:35 AM
. * Re: Flip Queue Size DaRayu  04/25/13 12:42 PM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 06:10 PM
. * Re: Flip Queue Size StilettoAdministrator  04/25/13 03:19 AM
. * Re: Flip Queue Size Bryan Ischo  04/25/13 05:31 AM
. * Re: Flip Queue Size StilettoAdministrator  04/25/13 06:12 AM
. * Re: Flip Queue Size Anonymous  04/24/13 08:51 PM
. * Re: Flip Queue Size DaRayu  04/24/13 09:52 PM
. * Re: Flip Queue Size Sune  04/25/13 12:44 AM
. * Re: Flip Queue Size GatKong  04/23/13 08:04 PM
. * Re: Flip Queue Size DaRayu  04/19/13 08:09 PM
. * Re: Flip Queue Size grog  04/19/13 09:24 PM
. * Re: Flip Queue Size DaRayu  04/19/13 10:13 PM
. * Re: Flip Queue Size R. Belmont  04/19/13 04:44 PM
. * Re: Microstutter; ATi's dark little secret. R. Belmont  04/16/13 05:07 PM
. * Re: Microstutter; ATi's dark little secret. Anonymous  04/16/13 10:59 AM
. * Re: Input lag Anonymous  04/15/13 10:54 PM
. * Re: Input lag R. Belmont  04/16/13 05:03 PM

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 223 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 9178