1
\$\begingroup\$

I'm trying to build play with MonoGame and I'm trying basing this regarding the GameTime steps. In my main Game class that is being run in the main entrypoint of my project, I'm doing something like that:

gameScreen.IsFixedTimeStep = true;
gameScreen.TargetElapsedTime = TimeSpan.FromMilliseconds(1000d / 120);

With a TargetElapsedTime at about 8ms, the "Draw" method of my current screen should display an ElapsedGameTime of 8ms but it's always displaying me 16ms.

Is it normal? Can't we go lower than 60fps in FixedTimeStep? I've tried to make a custom loop on another running at 120 fps (without going through the MonoGame pre/post-draw) and it's running correctly.

Can you guys give me some hint?

[EDIT - Add more info] I've fetched few answers before asking my question and some people were talking about the Vsync issue. So i've set up this:

_graphics.SynchronizeWithVerticalRetrace = false;

But the result is the same

\$\endgroup\$
2
  • \$\begingroup\$ This certainly sounds like it has something to do with VSync. Sometimes there'll be a setting in your graphics card that overrides the application settings for VSync. Out of curiosity, why are you trying to do this anyway? \$\endgroup\$ Sep 20, 2018 at 10:41
  • \$\begingroup\$ I'm doing it because I can ! I know that 60 fps is more than enough for a graphic rendering but i'm trying to see if i can go ahead of that "limit". Regarding your solution, i'll try to take a lot about that setting for the graphic card but if you have a hint on the possible path I should take, i'm listening. \$\endgroup\$
    – Kamigaku
    Sep 20, 2018 at 17:58

1 Answer 1

1
\$\begingroup\$

I was suggest on another platform this link:

http://community.monogame.net/t/cap-frame-rate-to-30-fps/10122

At the end of the post, someone suggest this:

graphics.PreparingDeviceSettings += (sender, e) => 
{                
    e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.Two;
};

This solution helped me to fix my solution, but I had to tweak it a little beat. In order to make it work, I had to do this:

graphics.PreparingDeviceSettings += (sender, e) => 
{                
    e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.Immediate;
};

Some doc on the internet say that regarding this parameter:

"PresentInterval.Immediate can be used to perform the flip as soon as possible and not wait for the vertical rectrace. Although your game can suffer from tearing artifcats, this mode is helpful when performing performance analysis because it does not limit the speed at which your game can draw."

If anyone have more information, or up and down about this solution, feel free to say it to me.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .