Posts: 3
Joined: Sun Jul 15, 2018 3:24 pm

Defender emulation lag

Mon Jul 16, 2018 1:55 am

I've got a lag testing result that I can't explain and have a hunch it might be down to a problem with the emulation, so I'm here looking for help from someone who understands the MAME code.

I did some lag testing a while back on Defender:
Groovymame framedelay 8, Dell 1913 TN monitor.
120fps video with LEDs lit by the Fire button.

The result was that the input lag at 3/4 screen depth was about as expected, but the lag at 1/4 screen depth (which I would expect to be 8ms better) is actually about 8ms worse. [ edit: I've taken a larger sample of 100 shots to get a better value than I posted yesterday ]

I haven't been able to come up with any explanation other than something odd in the emulation.

Defender polls the inputs twice per video frame, the inputs state at the start of the video frame is used to update the lower half of the screen while the top half is being drawn. And then the input state read mid video frame is used to update the top half of the screen(which will be displayed next video frame). This results in low average lag and low variability of lag, with actions in the upper and lower half of the screen being equally responsive.

I'm just guessing but I can see that the person doing the translation to MAME might have looked at the video frame and said that the top half of the screen uses an older input state and therefore decided to use the inputs state previous to the current one. That sounds reasonable even, until you think about how much lag is already being introduced by 60hz polling versus 120hz, the emulation response is already lagging so you want to pull back 8ms rather than give away another 16ms.

Posts: 87
Joined: Wed Oct 26, 2016 12:26 pm

Re: Defender emulation lag

Tue Jul 17, 2018 7:04 pm


Even though I'm certainly no expert on this matter here, you do seem to know what you're talking about.

However, this is the official MAME forum for the official MAME version, and you have stated that you use Groovymame. I ass-u-me that the most people around here would prefer it if you could reproduce the issue with the (latest) official MAME binary (currently 0.199) from http://mamedev.org/release.php

If you can reproduce it with the latest official MAME; great, you may have found a bug here. If not; you may to need to look for support on the proper Groovymame channels.

Thanks, and sorry I personally can't be of more help.

Posts: 3
Joined: Sun Jul 15, 2018 3:24 pm

Re: Defender emulation lag

Thu Jul 19, 2018 11:08 am

Thanks for the reply. You are right that I should do the testing with proper MAME. I'll do that next time I have a PC set-up, at the moment I'm running hardware emulation ( JROK WSF fpga board).

Posts: 3
Joined: Sun Jul 15, 2018 3:24 pm

Re: Defender emulation lag

Sun Jul 22, 2018 3:06 pm

OK, so I've now done testing with mame199, everything default (vsync off), except for filter off.

This time I've used an automatic continuous fire rate at 168.7ms rather than manual firing. So this way each button press takes place 2ms later in the input window which lets you see a pattern and every 8 fires you get one at near to optimal (for fastest response) and it also gives you an even distribution rather than a random one.

I've counted 50 high (1/4 screen) )and 50 low (3/4 screen) shots and the results are approx 10ms faster response at the low position.

The 1/4 screen is approx 30ms behind the hardware emulation, 3/4 screen is approx 20ms behind the hardware.

Return to “MAME Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests