Friday, December 29, 2006


Some members of the XNA community (including me) have experienced problems with XNA games when running on fullscreen mode -in particular, I have a GeForce 6600 GT card.

The problem: when a XNA game tries to get/set the presentation parameters for accepted fullscreen modes, it takes the list of rates accepted by the gfx card and in some cases uses the higher one -for instance, like 240 Hz on 800x600. Phewww! So you will see nothing more than a black screen and your monitor trying to warn you that something is attempting to set an invalid refresh rate.

The workaround: if the user forgot to (or cannot) forbid any rate above the maximum accepted vertical retrace on the gfx card, just catch the "PreparingDeviceSettings" event and then set a common rate like 60 or 72 Hz. How? In the class that derives from "Microsoft.Xna.Framework.Game" class, add the following line (say, within the constructor):

graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(MyMethod); // "graphics" is a reference previously instanced as "GraphicsDeviceManager(this)" usually in the same constructor

Then add the following method in the same class:

private void MyMethod (object sender, PreparingDeviceSettingsEventArgs args)
args.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = 60; // for instance, or 70, 72, 75, etc.

I've modified the code of games like Rocket Commander and Wildboarders and it all works great!

Let's hope Sharky modifies Air Legends soon so that I can finally play the game.



  1. hehe. I'm working on it. Just wondering if there's any exception I could trap somewhere, so I'd only force the refresh rate when absolutely necessary.

    Anyway, I should have a new release out in the next couple of days.

    Plus it'll include much improved sound effects.


    p.s. Good blog dude.

  2. Hi Sharky, thanks for your comments about my blog. Really appreciate.

    "Just wondering if there's any exception I could trap somewhere, ..."

    Good question. I have searched for an exception but the interesting thing is that in most cases everything just executes ok "behind the scene" so no exception is raised most of the times (even the monitor "forgets" to warn you at some resoultions like 1024x768).

    Thus, what to do? You use a n xml file which contains the basic setup for your game. Maybe you can add a node like:

    ... fullscreen forceHz="false" value="60" / ... (tags not allowed on comments)

    So, if the user needs to set the framerate just go and change forceHz to true.


Any thoughts? Post them here ...