Input lag

This forum is currently in read-only mode.
  • >

    > > Well, recently I noticed a HUGE input lag. When you create a sprite (say 128x128 red square) and give it a mouse behavior it will always follow the mouse, but with some kind of lag. The same with keyboard controlled behaviors. Help, pretty please, anyone?

    > >

    >

    > Switch framerate mode to unlimited, just to see if it still lags.

    >

    nope, in unlimited mode it does not lag. but I don't think it a good solution :/

    edit: in vsync it runs on 60fps (lcd screen), my specs: athlon 64 x2 2,9ghz, 2gb ram, nv geforce 9600gt so I don't think it's a hardware related problem

    Nope it's not a solution and wasn't meant to be, but it narrows down the problem.

  • This does look like a system issue rather than a construct issue to me. I fiddled around with the mouse speed and precision settings in my control panel and they both affect how much a box with Mouse Behavior lags behind it (and yes, mine lags as well, but not nearly as bad as in the video that was posted). I would guess that the amount of lags varies from system to system. Hell, what kind of mouse you have might even have an effect on the matter.

  • This does look like a system issue rather than a construct issue to me. I fiddled around with the mouse speed and precision settings in my control panel and they both affect how much a box with Mouse Behavior lags behind it (and yes, mine lags as well, but not nearly as bad as in the video that was posted). I would guess that the amount of lags varies from system to system. Hell, what kind of mouse you have might even have an effect on the matter.

    when i use a graphic tablet (wacom), this also happens. also I tested it on two other computers (both laptops) - and on one the lag was somewhat the same, on the other, it was quite small!

    i think it has something to do with the graphic card, the computer with the smallest lag is actually worst of all three, but it has an ati card, other two computers have nvidia. any ideas?

  • Might have to do with double or triple buffering.

    At least triple buffering causes horrible lag in 3D games, most console ports suffer from this as mouse lag is much more noticeable than button lag.

    To wit: Dead Space.

  • I'm not sure why this happens. I guess it would be useful to narrow it down to a single setting.

    I can't see how Construct could cause more than two or three frames latency given double buffering, which should appear almost instant. It might be something to do with graphics cards settings, VSync, mouse settings, or a combination. I don't know of anything I could do to rectify this at all; as far as my code does, it gets the mouse position and draws it, all in the same frame, so I can't see where such a large delay would come from!

  • I'm not sure why this happens. I guess it would be useful to narrow it down to a single setting.

    I can't see how Construct could cause more than two or three frames latency given double buffering, which should appear almost instant. It might be something to do with graphics cards settings, VSync, mouse settings, or a combination. I don't know of anything I could do to rectify this at all; as far as my code does, it gets the mouse position and draws it, all in the same frame, so I can't see where such a large delay would come from!

    well, i think turning off the triple buffering AND setting the "max frames to pre-render" to 0 (default was 3 for some reason) lowers the lag A LOT. it's still noticeable, but very little. as you all stated, little lag is "normal", i'm at the point you all are, so for this thanks but it would be great, if there was some way to get rid of the lag completely.

  • well, i think turning off the triple buffering AND setting the "max frames to pre-render" to 0 (default was 3 for some reason) lowers the lag A LOT.

    Out of interest, where were those settings? Are they in your graphics card driver options? What make is your graphics card?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > well, i think turning off the triple buffering AND setting the "max frames to pre-render" to 0 (default was 3 for some reason) lowers the lag A LOT.

    >

    Out of interest, where were those settings? Are they in your graphics card driver options? What make is your graphics card?

    I dunno about ATI cards, but there's settings for the render frames ahead on nVidia cards. You often see suggestions about changing them for games like Oblivion, to smooth things out or to help with mouse pointer lag. The triple buffering stuff is usually where the standard card quality settings are found.

  • > well, i think turning off the triple buffering AND setting the "max frames to pre-render" to 0 (default was 3 for some reason) lowers the lag A LOT.

    >

    Out of interest, where were those settings? Are they in your graphics card driver options? What make is your graphics card?

    in the freaking "nvidia control panel". this said, my graphic card is nvidia geforce 9600gt. i was on 6600gt earlier and there was no lag, but i don't think this is the problem, i'd still bet on the triple buffering and th pre-rendered frames thing.

  • >

    > > well, i think turning off the triple buffering AND setting the "max frames to pre-render" to 0 (default was 3 for some reason) lowers the lag A LOT.

    > >

    > Out of interest, where were those settings? Are they in your graphics card driver options? What make is your graphics card?

    >

    in the freaking "nvidia control panel". this said, my graphic card is nvidia geforce 9600gt. i was on 6600gt earlier and there was no lag, but i don't think this is the problem, i'd still bet on the triple buffering and th pre-rendered frames thing.

    I tried it and changing either of those made no visible difference (the lag wasn't bad to begin with for me, but could see it was there like others).

    Turn v-synch off though and either using unlimited (not recommended obviously) or fixed, removes any lag. So it's obviously down to the v-synch in some way. Just a shame things look bad without it heh.

    Download: No lag at all

    BTW even if enabling/forcing v-synch outside of construct. It still causes the lag. And a quick check on google shows many other games and setups that suffer from it. Fix? They suggest turning v-synch off too.

    Edit: Ok more testing and yup. Turn v-synch off and there's absolutely no lag whatsoever. It's not a construct bug or issue, it's a DirectX problem that apparently effects any game using it. The good news is even if you make your game with v-synch on. Someone could force it off in their nVidia control panel (I imagine ATI as well), and remove all lag if it's a problem for them. Regardless what you've set it as.

    And just to make the OGL nuts happy.. this doesn't happen in that.

  • Turn v-synch off though and either using unlimited (not recommended obviously) or fixed, removes any lag. So it's obviously down to the v-synch in some way. Just a shame things look bad without it heh.

    well, you set the fixed framerate to 120fps. when someone has 85hz monitor, ther will be visible choppy display. also, when I set fixed framerate to 60 fps (my screen refresh rate), the lag is still there. (i believe in 120fps, it is there also, but half as visible)

    Edit: Ok more testing and yup. Turn v-synch off and there's absolutely no lag whatsoever.

    nope. i set the vsync to "force off" in nvidia control panel - no difference sadly so for me to minimise the lag, the settings are "max pre rendered frames - 0, tripple buffer - off, vertical synchrtonization - use application setting/off/on - does not make a difference)

    i'm still using the v-synced display in construct, as using fixed or unlimited is bad - the way you see it, setting the app to fixed 120 lowers the lag, you can set it to 240 and lower it more, this is not the way to do things here also i'm not saying this is a construct problem, but still i'd like to know how to overcome it.

  • I know a bit about this, so I guess I'll explain.

    To draw a frame you need to calculate it first. so:

    input -> framebuffer.

    Input is where the game picks up your commands and framebuffer is the screen. This is a 1-frame lag. This is the minimum you can get, there's no way around it. Think of this as an unlimited framerate, single-buffered game.

    This isn't so hot, because you're drawing directly to the screen. If your drawing code takes longer than a screen refresh, the scene might be half-drawn when presented.

    input -> backbuffer -> framebuffer

    So this is double buffering, where you can hold one frame in a backbuffer and draw to that one, and when it's done you copy that one to the framebuffer. This means your commands will show up two frames later.

    input -> backbufferA -> backbufferB -> framebuffer

    And of course, triple buffering is the same idea, just bigger.

    All of these were with unlimited frames per second (fps).

    Now what happens with vsynch?

    let's see the most common double-buffer scenario:

    input -> backbuffer -> VSYNC -> framebuffer

    the backbuffer is copied to the framebuffer only on a VSync, which happens 60 or whatever times per second. So now your input is delayed by one frame plus the time it takes to the next VSync.

    With triple buffering.... yeah

    input -> backbufferA -> backbufferB -> VSYNC ->framebuffer

    your input is delayed by two frames and one Vsync.

    Now, most video cards have a hardware mouse cursor, which is calculated in paralell to the rest of the screen drawing stuff and it's directly overlaid on top of the framebuffer, that's why it responds so well.

    I hope this clear things up. To sum:

    The fastest cursor will ALWAYS be the OS' cursor, followed by the 2-frame delay that's minimum for DirectX, with no VSync and doublebuffering.

  • > Turn v-synch off though and either using unlimited (not recommended obviously) or fixed, removes any lag. So it's obviously down to the v-synch in some way. Just a shame things look bad without it heh.

    >

    well, you set the fixed framerate to 120fps. when someone has 85hz monitor, ther will be visible choppy display. also, when I set fixed framerate to 60 fps (my screen refresh rate), the lag is still there. (i believe in 120fps, it is there also, but half as visible)

    >

    > Edit: Ok more testing and yup. Turn v-synch off and there's absolutely no lag whatsoever.

    >

    >

    nope. i set the vsync to "force off" in nvidia control panel - no difference sadly so for me to minimise the lag, the settings are "max pre rendered frames - 0, tripple buffer - off, vertical synchrtonization - use application setting/off/on - does not make a difference)

    i'm still using the v-synced display in construct, as using fixed or unlimited is bad - the way you see it, setting the app to fixed 120 lowers the lag, you can set it to 240 and lower it more, this is not the way to do things here also i'm not saying this is a construct problem, but still i'd like to know how to overcome it.

    The 120fps was just something I left it at, it works without lag at 60fps, 20fps, 900fps too. The point was, turning v-synch off solves the problem, at least on my end, and you can either build the game with it off, or let the user force it off via their control panel for their video card.

    I did read somewhere that machines that are too fast are the ones with this problem, and ones that are slower are immune to it. Which makes me think, when you've got everything on there doing it's thing, this is probably not going to be happening then.

  • The 120fps was just something I left it at, it works without lag at 60fps, 20fps, 900fps too.

    well, it does not, when i set the fixed framerate to 60 it behaves exactly as when i turn the v-synced mode.

    also,

    V-Synced: [...] The best quality and smoothest display. Games should all use this option.

    The point was, turning v-synch off solves the problem

    I'm confused

    Thank you Madster for explaining, but i don't think the lag is 2 frames, if my monitor draws 60 frames per second, the lag seems more like about 10 frames (well, now, after fiddling with the nvidia control panel). please also don't jump to conclusions that it's bad lcd, because the hardware mouse cursor does not lag whatsoever.

    Any ideas how to lower the lag even more, to the twoframes from the Madster explanation?

  • >

    > The 120fps was just something I left it at, it works without lag at 60fps, 20fps, 900fps too.

    >

    well, it does not, when i set the fixed framerate to 60 it behaves exactly as when i turn the v-synced mode.

    also,

    >

    > V-Synced: [...] The best quality and smoothest display. Games should all use this option.

    >

    > The point was, turning v-synch off solves the problem

    >

    I'm confused

    Thank you Madster for explaining, but i don't think the lag is 2 frames, if my monitor draws 60 frames per second, the lag seems more like about 10 frames (well, now, after fiddling with the nvidia control panel). please also don't jump to conclusions that it's bad lcd, because the hardware mouse cursor does not lag whatsoever.

    Any ideas how to lower the lag even more, to the twoframes from the Madster explanation?

    Well I don't know what to tell you then besides filling a test layout up with lots of things, to simulate a completed game, and see if it still does it. Or just use the default cursor rather than a custom one (I know that isn't the perfect solution).

    Why don't you make some higher fps limit, but have your game run at 60fps or something, can't that timedelta thing do that? Then just not use it on anything involving the mouse pointer. Wont that solve the problem? Though judging by the number of games and people having this problem, it might just be one of those things you have to live with. Do what most developers do, blame Microsoft and the end users hardware, say it's entirely out of your control and not a problem with your game, then suggest turning v-synch off as a last resort.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)