• Advertisement
Sign in to follow this  

Speed of app is random :(

This topic is 4868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I run my Particle System demo, sometimes it loads up and runs at max of 55 FPS. Normally it runs at around 72FPS. I edited my code and forced it to run in software mode, and I received the low FPS. Is my app not properly acquiring the graphics card? Here is a screen shot of the good FPS. It should be noted that the BAD FPS is even obsevered when NO particles are being drawn. I am baffled by this problem.... In my program I check to see what type of CreateDevice() call works, and then display a string to signify that. Even at the low FPS it says it is using "Hardware Rendering"..... Any ideas? PS If you want to download and test yourself, go to the announcement forum....

Share this post


Link to post
Share on other sites
Advertisement
You still have v-sync enabled, so the speed of your app is limited to the refresh rate of your monitor (by what you posted, I would imagine 75Hz). Assumming you are using DX9, when you setup your D3DPRESENT_PARAMETERS structure set the PresentationInterval to D3DPRESENT_INTERVAL_IMMEDIATE.

Alan

Share this post


Link to post
Share on other sites
Well let me see....


When the app runs at ~75 FPS, it looks beautiful (I'm OK with that). And yes, my refresh rate is set to 75Hz....But would the refresh rate cause it to dip down to ~40FPS? It appears to be a random thing. I can run the app 10 times in a row, at full speed. Then without changing a single thing, it will load and max at 40fps.....

Thats what baffles me. I will try your suggestion. Thanks.

Share this post


Link to post
Share on other sites
Ok, I tried your suggestion and it seems to have worked, but now I am overshooting A LOT.

I am getting ~250 fps, but the entire engine is running way too fast, the rectangle in the center spins at like 250 mph.... :O

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
use delta time for your movement, not frame rate

Share this post


Link to post
Share on other sites
Okay, the reason for the dramatic drop in framerate has to do with how VSyncing works. If you miss flipping the buffers during a vertical retrace (Even by a fraction of a millisecond), it has to wait for the next retrace before the buffers are flipped, so you lose one frame for every two and fundamentally halve your framerate.

As for the super-speed problem, you should be working with time-based movement rather than moving the objects an explicit distance every frame. What you do is get the amount of time that has passed since the last frame, and use that to scale how far your object moves.

For example, if you have a framerate of 40fps, the amount to scale the velocity of the object would be 0.025 (1/40th of a second), but if your framerate is 20fps, you would scale it by 0.05. This means that all objects maintain a consistent speed regardless of framerate (Even at very high and very low framerates), and your final animations will seem to move a whole lot smoother as a result.

Share this post


Link to post
Share on other sites
Wonderful, this is the info I was looking for.

I will see what I can do with this, and report back my findings.

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement