Game Development Community

Mouse/input lag?

by Manoel Neto · in Torque Game Engine Advanced · 09/27/2006 (8:31 am) · 11 replies

Hello,

I'm experiencing a delay in all input (both mouse and keys) on some machines. We have two identical machines (GF6600), but only one of them displays input lag. Another machine with a Radeon 9600 also lags all the time.

I noticed TSE initializes a bunch of threads when it starts up, most of them with very high priority settings, while TSE's main thread runs at normal priority. Is that supposed to be like that? It causes the computer to be nearly unusable while TSE is running (that wasn't a problem with TGE).

#1
09/27/2006 (8:55 am)
Have you tried to disable/enable the killFramesAhead preference?
#2
09/27/2006 (10:06 am)
I've noticed a similar thing. I coded a particular effect for one of our menu backgruonds. Now when I start the game, about 60% of the time I get probably 1/3rd second lag on mouse input. Other times it isnt there.

I've seen this in other D3D games from time to time, but not recently. Wonder what it is?
#3
09/27/2006 (10:21 am)
Stefan, I didn't find any reference to killFramesAhead in the engine (I'm using MS 3.5). I'll try to switch the D3D device creation parameters to see if I can get some result.
#4
09/27/2006 (11:01 am)
I was assuming that you were using MS4. Disregard my post, then.
#5
09/27/2006 (11:06 am)
Hmm, MS4 stuff, heh? What kinds of effects does killFramesAhead have? If it's supposed to elimintate the input lag, I can consider the risky time budget of upgrading our project to MS4.

We're doing a small racing game for a cars expo, and the input lag makes driving a chore, and we can't accept the risk of the input lagging on the computers they setup at the expo.
#6
09/27/2006 (11:38 am)
Dont quote me on this but I think Brian said somewhere that he implemented the killFramesAhead stuff to counter mouse lag.
#7
09/27/2006 (12:39 pm)
Ya, video card manufacturers like to set up the render pipeline such that the card will render a few frames ahead of the engine input. They do this because it results in a higher framerate and so they get higher scores on GPU benchmarks.

Unfortunately, in heavily GPU limited situations (happens all the time on those 6600 and 9600 cards on TSE), this will result in noticable mouse lag and even some camera "lurching". In MS4, I added a pref, $pref::Video::killFramesAhead, which is set to true by default. It basically just locks the backbuffer after every present() call such that the GPU can't get ahead of the CPU.

It was a small code change, so if you want to stick with MS 3.5, you can just check for the related changes and merge them in.
#8
09/27/2006 (1:35 pm)
Frames ahead is essential for SLI alternate frame rendering, which works with TSE much better than split-frame, IMO. SLI AA crashes for me.

EDIT: But yeah, for single vid. card make sure it's off
#9
09/27/2006 (2:58 pm)
Nice hint, I'll search the MS4 source for the related changes. Our deadline hits in 3 days, and I cannot risk trying to merge the whole MS4 into our project this late in the process.

Since this will run under relatively controlled circunstances, it can live without SLI support ;)
#10
09/28/2006 (5:18 am)
It works perfectly! That change killed both the input lag AND the annoying hiccups when running in windowed mode.

Thanks a lot.
#11
09/28/2006 (12:08 pm)
Cool, glad that worked out for you.