Thursday, January 3, 2019

c# - Incrase framerate in XNA



I'm trying to increase the frame rate of my game from 60FPS to 100 FPS because of reasons. But i can't seem to get it higher than 60 frames. This is the count I'm using. I can slow down the frame rate by setting TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);


to a higher value, but settings it lower won't increase the frame rate, according to the counter. Anyone have any idea what's going on?



Answer




I found I had to do the following to set the FPS limit free. In your Game class, do the following:


graphics = new GraphicsDeviceManager(this);  // I have this stored as a member variable
graphics.SynchronizeWithVerticalRetrace = false;
IsFixedTimeStep = false;

Note that an unlimited FPS can cause unpredictability in physic engines, and network games. A full discussion of fixed vs variable timesteps can be found here: When should I use a fixed or variable time step?


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...