Sign in to follow this  
Montynis

[.net] XNA Performance

Recommended Posts

Montynis    122
Hello, I am trying to increase the performance of my XNA game. When I do the following change this.IsFixedTimeStep = false; and count the FPS, I see that the average value of it is only about 65. Is there any possibilities to increase the FPS (maybe I need to change some graphics properties or something else)? Thanks in advance.

Share this post


Link to post
Share on other sites
ViLiO    1326
IsFixedTimeStep only affects Game.Update. Realistically there aren't many reasons I can think of why you wouldn't want to run the game logic you update inside that function at a fixed time step (I believe it defaults to 60hz), so I wouldn't unset that flag unless you have some specific reason.

As for rendering, if you are wanting to allow Game.Draw to present immediately and not wait for v-sync, you should set SynchronizeWithVerticalRetrace to false.

Regards,
ViLiO

Share this post


Link to post
Share on other sites
Cygon    1219
Also, as anyone from the DirectX community would tell you, timing an empty game loop is quite pointless and won't give you even the slightest idea on how fast the system can perform.

I'd risk a bet and claim that you could rewrite DooM3 in C# / XNA and it would run within 10% tolerance of the original's speed. You mileage may vary with CPU-heavy things such as physics engines and AI, but performance should still be good enough to pull it off.

-Markus-

Share this post


Link to post
Share on other sites
Montynis    122
Quote:
Original post by ViLiO
IsFixedTimeStep only affects Game.Update. Realistically there aren't many reasons I can think of why you wouldn't want to run the game logic you update inside that function at a fixed time step (I believe it defaults to 60hz), so I wouldn't unset that flag unless you have some specific reason.

As for rendering, if you are wanting to allow Game.Draw to present immediately and not wait for v-sync, you should set SynchronizeWithVerticalRetrace to false.

Regards,
ViLiO


Well, first I unset this flag because I just want to see the real possible FPS on my machine.

The reason why I want to have higher FPS value is that I don't want the camera movements to look jerky. Let's say that the screen refresh rate is 75 and my app's FPS is just 65. In this case, while moving with a camera around the scene, the movements are jerky. And how about a situation when user's monitor has even higher screen refresh rate value?

So I want to increase my app's FPS to be sure that it is higher than screen refresh rate and there are none jerky movements (could changing something in PresentationInterval be a solution)?

Share this post


Link to post
Share on other sites
ViLiO    1326
As I said, IsFixedTimeStep only affects the frequency of Game.Update being called, so it will have no affect on your framerate.

Setting the flag SynchronizeWithVerticalRetrace to false will allow Game.Draw to present immediately and not wait for vertical synchronisation (ie, your framerate will not be limited to that of your monitor's refresh rate, which for you seems to be 65Hz).

If your camera movements are jerky, then I'd have a long look at your game logic, as you should really be able to handle smooth movements even with a low FPS.

Regards,
ViLiO

Share this post


Link to post
Share on other sites
Montynis    122
I have tried to run my app after setting graphics.SynchronizeWithVerticalRetrace to false, and I got that FPS is near 100.

One strange fact I have found out: if my screen refresh rate is 60, camera movements are very smooth. But if it is bigger, all the movements become really jerky. It says for me that possible problems in my camera class is not thee reason of jerky movements.


Share this post


Link to post
Share on other sites
gharen2    520
I'd guess that your camera code moves based on fixed values. If you make it move based on any given time interval, it should move the same regardless of your frame rate.

Right now your code is probably something like this:

position += deltaPosition

When it should be

position += (deltaPosition * time);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this