Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on my first OpenGL 2D game and I've just locked the framerate of my game. However, the way objects move is far from satisfying: they tend to lag, which is shown in this video. I've thought how more fluent animation can be achieved and started getting segmentation faults due to accessing the same object by two different threads. I've tried the following threads' setting:

  1. Drawing, creating new objects
  2. Moving player, moving objects, deleting objects

Currently my application uses this setting:

  1. Drawing, creating new objects, moving objects, deleting object
  2. Moving player

Any ideas would be appreciated.

EDIT: I've tried increasing the FPS limit but lags are noticeable even at 200 fps.

share|improve this question
up vote 4 down vote accepted

Sounds like something is causing your update loop to run in uneven intervals. Try implementing a fixed timestep loop and your problem should go away.

share|improve this answer
This is a short answer but most probably the right one. Threading seems like trying to treat the symptom instead of the disease. Since your lagging doesn't seem connected to your FPS it's most likely a fault in your loop (thus threading won't fix it, no matter your settings). Also the video feels like it's the game loop, since I've seen it before while I was learning how to handle the loop. – user8363 Sep 11 '12 at 11:33
great answer, thanks :) @user8363 your medical metaphor is great. – Robin92 Sep 11 '12 at 12:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.