Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

My xna game is running at about 70-90fps and it looks laggy at this fps. I'm using fraps to record the fps and I have a 120hz monitor, over 120hz looks fine but I can't understand why it feels like it's lagging so much at high fps :/.

share|improve this question
4  
We're really going to need more than this information. I can only say that the XNA apps I've made that run at < 100fps still don't look laggy on my machine. –  Roy T. May 7 '12 at 15:29
    
Explain lag. Does it look choppy (I'd insist that anything north of 50fps or so probably doesn't look choppy, unless you're getting occasional hiccups). If the lag is in the perceived response time (time from the player providing an input to the time it's reflected on screen) I'd believe you, but this wouldn't have much to do with framerate (not at those rates.) –  stephelton May 7 '12 at 15:54
    
Yes it can look very choppy. I just realized that if I put fixed time step on at 60fps it looks a lot smoother, but without it on I get around 80-90 and it looks very choppy and laggy :/. –  jacker May 7 '12 at 15:58
    
What time control would you use if not a constant 60 fps? –  eBusiness May 7 '12 at 16:04
1  
And you can remove that accepted mark, we are not done util you understand the cause of the error. Simply finding a setting that solves the issue on your computer without knowing why is pretty much asking for it to resurface in another environment. –  eBusiness May 7 '12 at 16:55
show 4 more comments

1 Answer 1

up vote 9 down vote accepted

I think you have some very inconsistent frame times. You can test this by printing out the frame times to a log (or similar) and measuring their jitter.

Edit: If you find that a small number of frames consume substantially more time than most, this is indicative of a performance problem. If this is the case, you need to use a profiler to help you understand where this problem is and fix it.

In general, the faster you try to draw your frames, the more your framerate can be affected by outside factors (such as the OS scheduling CPU time for other tasks, or a function in your game running unusually slow).

At 120 fps, you have 8.33 millis to have your frame drawn. As you are not hitting your 120 fps, it can be assumed that your game can't be run on that hardware at 120 fps, and that it will draw as fast as it can. This means that any extra load on the CPU will necessarily drag your framerate down. In other words, you have no built-in tolerance to fluctuations in CPU load.

I would suggest capping the framerate. If you really want to optimize around the minority of people who have the equipment to draw frames so frequently, allow them to change the max fps in your games's settings, or you can run some analysis on the framerate in your game itself to find an appropriate max.

Capping the framerate at a rate below which it can be drawn provides some "down time" for your game. This can absorb any of the fluctuations mentioned above without affecting your framerate. If you cap it at 60 fps, you have 16.66 millis to draw your frame. If you can draw the frame in 12, you have almost 5 millis for other things to happen without anyone noticing.

If it were me, I'd set it at 60 and be done with it.

share|improve this answer
    
Why 60 and not, say, 30? –  ashes999 May 7 '12 at 17:40
1  
If 60 is no sweat, why limit to 30? If 60 isn't doable, limiting to 30 might be appropriate. –  stephelton May 7 '12 at 17:44
    
@Levi, see my edit. Don't use my advice to throw a blanket on an underlying problem. –  stephelton May 7 '12 at 19:10
    
because human eyes cannot perceive much higher than 30, if even that, IIRC –  ashes999 May 7 '12 at 19:11
4  
@ashes999 That may be true in relation to film where each frame contains some motion blur that helps the brain 'fill in the gaps,' but I think the human eye/brain is much more sensitive when it comes to computer graphics, which essentially provide a rendering of an instantaneous state. Additionally, as framerate decreases, perceived response to input suffers as well. –  stephelton May 7 '12 at 19:26
show 2 more comments

Your Answer

 
discard

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.