Direct3D 9 Framerate Limited...

Started by
12 comments, last by Adam Hamilton 14 years, 5 months ago
Quote:Original post by NightCabbage
and would there be any point in updating more than once per frame?

Many physics simulations work better doing several smaller updates than one massive one.
Advertisement
Quote:Original post by NightCabbage
eg. isn't the update call done before the draw call (one after the other - once per frame)?

and would there be any point in updating more than once per frame?
If you turn that question around to "is there any point in rendering less than once per update", then the answer might be yes ;)

e.g. game logic often happens at a fixed frequency (no variable time-steps), which means you can't skip an update-frame... but if you're FPS drops, you can safely skip a render-frame.
Sounds almost like the update and render loops should be running in different threads...

How do most normal engines deal with this? (ie. skipping render frames)

Do they do it manually? (ie. check framerate and then skip a render if necessary)
I am not sure but I have seen something similar to this


TargetFPS = 60.0SecPerFrame = 1.0 / TargetFPS -- Will be about 16.66msdo   FrameTime = 0   do      deltaTime = GetDeltaTime()      Update(deltaTime)      FrameTime = FrameTime + deltaTime   while FrameTime < SecPerFrame   Render()while GameStillRunning


Although this may tend to cause your frame rate to drop to half your target speed so what I would do is is minus a millisecond from the SecPerFrame so that you are sure you are going to call that render function before your frame time reaches 16.66ms (in the case of 60FPS)

Another thing would be to update once, run your physics simulation a bunch of times and then call render. Extra AI simulation, extra particles' calculation for your particle system.

These are just ideas on what you can do with the extra bandwidth rather than stalling the GPU/CPU (in the case of vsync) or displaying only a third (or less) of your intended frame (in the case of no vsync) otherwise known as tearing.

This topic is closed to new replies.

Advertisement