Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Regarding Input/Video/Other Lag in MAME  (Read 3812 times)

0 Members and 1 Guest are viewing this topic.

adder

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 640
  • Last login:February 04, 2021, 10:51:51 am
  • Location: Easy St.
Regarding Input/Video/Other Lag in MAME
« on: December 04, 2012, 12:06:24 pm »
hey all
i never really paid much attention to the whole issue of lag (ie. input, video, or anything else) when using emulators such as mame
however reading around forums lately i notice its obviously a problem, for some more than others it seems

anyway i was wondering, does anyone know a good way to actually test controls/video/other lag in mame without the need of special/extra equipment

the reason i ask is, i tried the advance-frame method (see below) of testing lag in mame but unsure if it's an accurate test

what i did was took the game: galaga'88

i did the following test:

- launched mame, loaded galaga'88
- inserted coins, started a game
- held down the right arrow key on my keyboard to begin to move the ship to the right
- without letting go of the right arrow key, i pressed once the 'P' (pause) button on my keyboard
- now i let go of the right arrow key
- next i held down the left arrow key AND the shift key together
- finally while continuing to hold down the left arrow key and the shift key, i tapped the 'P' (pause) button on my keyboard several times (to now advance the game one frame at a time)

what happens is, the ship in galaga'88 continues to move across the screen to the right, another 4 frames after you have pressed the left arrow key on your keyboard (note: by the way i am not saying this is a mame specific problem, i imagine the actual arcade version itself has similar lag, but perhaps one less frame of lag than mame? i dont know..)

anyway, my question is this.... i heard/read that triple buffer introduces extra lag in mame, so i did the galaga'88 test above with triple buffer turned on and then turned off. i also did the same test with vsync on/off. i didnt get any change in results, the lag of 4 frames does not change.

am i being noob (strongly possible) or have i missed the point altogether? is my test invalid when it comes to determining whether triple buffer creates additional lag? if so, is there a way to test potential lag caused by triple buffer, or failing that, perhaps someone can simply advise me on if triple buffer should be avoided if possible, and if so, what are better suited settings in mame in order to minimise lag (eg. the best method of video sync to use, or, is there a difference in lag between using directdraw/direct3d, is it better to use usb port or older ps2 port controls, etc)

cheers! ;)

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Regarding Input/Video/Other Lag in MAME
« Reply #1 on: December 04, 2012, 04:35:34 pm »
Post your mame.ini's, one for each of the settings used to compare, and your system specs, including what MAME and OS.

adder

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 640
  • Last login:February 04, 2021, 10:51:51 am
  • Location: Easy St.
Re: Regarding Input/Video/Other Lag in MAME
« Reply #2 on: December 04, 2012, 05:53:42 pm »
to make things easier, rather than post mame.ini's, i can tell you the test was run using totally default settings in official mameui 32bit version 147, (plus the 147 beta versions)

so, to recreate my test simply delete (or rename if you dont want to lose it :)) your current mame.ini and launch mameui 147 into its default settings

now its just a case of enabling/disabling the triple buffer/vsync options and seeing if it makes any difference. in my case it is always the 4 frames lag in galaga'88, no more, no less, regardless of video settings, or if using direct3d vs. directdraw.

tests were done on a laptop with lcd screen, WIN XP 32bit, 2gb ram, 2ghz core2duo intel, directx 9, regular inbuilt laptop keyboard for controls
tests were also done on a second machine, an intel P4 3.4ghz desktop with 2gb ram, WIN XP 32bit, directx 9, usb keyboard, with crt tv connected via vga to scart cable

can i ask you (or anyone else reading this) to run the test and report your results? im assuming you get the same results as me. im assuming everyone will with a 'reasonably good' pc setup, which will either mean this test is pointless and doesnt prove anything :lol, or instead, (hopefully), it can be proved that changing many video settings in mame makes no difference to gameplay, video, (or whatever name it should be called), 'lag'.

equlizer

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 363
  • Last login:November 17, 2019, 02:56:48 am
  • All your base are belong to us
Re: Regarding Input/Video/Other Lag in MAME
« Reply #3 on: December 04, 2012, 06:16:20 pm »
Its funny cause i noticed that in galaga 88 as well.  Ill move the joystick left and right and there is like a half second delay.  No delay in windows or in SSF4 arcade.

eldiau

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 39
  • Last login:June 12, 2023, 06:01:40 pm
Re: Regarding Input/Video/Other Lag in MAME
« Reply #4 on: December 04, 2012, 06:25:56 pm »
I guess this lag is in the real galaga'88 too. I'm using mame 0.145 on Linux (Ubuntu 12.04 64bit on Intel i5 760 2.8GHz) and tons of GLSL effects to simulate CRT on my LCD.
I did your test on:
Galaga'88 - 4 Frames
Wonderboy -  2 Frames
Scramble (using up-down) - 1 Frame
Terra Cresta - No lag
DoDonPachi - 3 Frames

Provided Terra Cresta has no lag and other games have a variable number of frames I would think the lag is in the real PCBs too. Moreover I don't think a lag introduced by mame or OS buffering input, calculating and plotting the frames, etc would be visible with this method because with the game paused the OS and mame have all the time to catch up... ditto for the TV or monitor display buffer.
« Last Edit: December 04, 2012, 06:36:00 pm by eldiau »

adder

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 640
  • Last login:February 04, 2021, 10:51:51 am
  • Location: Easy St.
Re: Regarding Input/Video/Other Lag in MAME
« Reply #5 on: December 04, 2012, 06:27:01 pm »
equilzer could u be persuaded to do the test below, and report back if your lag is more than 4 frames?
____________________________________________________________________
the following test:

- launched mame, loaded galaga'88
- inserted coins, started a game
- held down the right arrow key on my keyboard to begin to move the ship to the right
- without letting go of the right arrow key, i pressed once the 'P' (pause) button on my keyboard
- now i let go of the right arrow key
- next i held down the left arrow key AND the shift key together
- finally, while continuing to hold down the left arrow key and the shift key, i tapped the 'P' (pause) button on my keyboard several times (to now advance the game one frame at a time)

what happens is, the ship in galaga'88 continues to move across the screen to the right another 4 frames, after you have pressed the left arrow key on your keyboard.....
________________________________________________________

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Regarding Input/Video/Other Lag in MAME
« Reply #6 on: December 04, 2012, 06:30:40 pm »
I've got different PC's and video equipment torn apart, and unfortunately I'm up to my neck in work for the time.  So, I'm sorry but I'm not able to properly test things right now.

As I've said, I don't think there's any way for triple buffer to be working and not add lag.  So if there's really nothing else going on, you've found a problem with the frame step method.

When I get things straightened in the future I'll test it with the high speed camera method to measure the lag in real time, and see what's really going on.
« Last Edit: December 04, 2012, 07:14:18 pm by rCadeGaming »

adder

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 640
  • Last login:February 04, 2021, 10:51:51 am
  • Location: Easy St.
Re: Regarding Input/Video/Other Lag in MAME
« Reply #7 on: December 04, 2012, 06:35:48 pm »
Quote
...I did your test on: Terra Cresta - No lag

cool, i just did the terra cresta test also and noticed no lag also

Quote
.....with the game paused the OS and mame have all the time to catch up... ditto for the TV or monitor display buffer.

thats what i have been thinking too, maybe the test is invalid. in which case im wondering which video sync effect in mame (triple buffer, vsync, syncrefresh) adds the least amount of 'lag'.. or if its just a dumb question overall and not worth worrying about! ::)

adder

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 640
  • Last login:February 04, 2021, 10:51:51 am
  • Location: Easy St.
Re: Regarding Input/Video/Other Lag in MAME
« Reply #8 on: December 04, 2012, 06:38:45 pm »
Quote from: rCadeGaming
I'm sorry but I'm not able to properly test things right now.

no worries at all

Quote from: rCadeGaming
When I get things straightened in the future I'll test it with the high speed camera method to measure the lag in real time, and see what's really going on.

awesome, im all ears if you come up with some interesting results ;)

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Regarding Input/Video/Other Lag in MAME
« Reply #9 on: December 04, 2012, 07:13:24 pm »
im wondering which video sync effect in mame (triple buffer, vsync, syncrefresh) adds the least amount of 'lag'.. or if its just a dumb question overall and not worth worrying about! ::)

Yeah, you shouldn't be picking a refresh rate and trying to force the game to it.  You should be adjusting the output refresh rate to that of the original game.  Doing this and using -syncrefresh will be the way to ensure the game is running at original speed, without sound issues (soundsync not needed), scrolling smoothly without -waitvsync and -triplebuffer (which cause lag) and without frameskipping.

Not a dumb question.  This is especially important with your SCART TV setup ^.  You should be getting native resolutions on that thing and running in proper refresh rates.

As for LCD's, you can't usually adjust refresh rates to use this method, so it's a different situation.  You can still use syncrefresh and force the game to 60Hz, but then you'll be off from the original speed depending on the native refresh, and you may need autoframeskip to alleviate audio stuttering may not work (actually I'm not sure if autoframeskip would work in this case).  Instead you could use waitvsync, which technically causes some lag, but should normally be much less than triple buffer.  Just more of the problems with LCD's, they lag in the first place, and then you can't use proper video settings with them.
« Last Edit: December 04, 2012, 07:27:16 pm by rCadeGaming »

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Regarding Input/Video/Other Lag in MAME
« Reply #10 on: December 04, 2012, 07:13:54 pm »
Quote from: rCadeGaming
I'm sorry but I'm not able to properly test things right now.

no worries at all

yup, typo again, woops

awesome, im all ears if you come up with some interesting results ;)

I'll get to it when I get things together.
« Last Edit: December 04, 2012, 07:26:04 pm by rCadeGaming »