Synchronous Load?

Dec 13, 2009 at 10:41 AM

Hi SimReality,

This is more a general XNA question but I hope that you can help me with it::

Is there a way to do a synchronous load?

I didn't find one and I guess that means I didn't understand the concept. What I'm trying to do is to load some general game options (resolution, volumes, and so on) in the constructor of my game. This is probably not the way to go, but I don't know where else to put the load code. If the Game is already running, when loading the options, I will have to reset the resolution (which looks strange) and probably change the volume of a playing sound (also strange).

With a synchronous load I could load the settings before the game initializes, so that would solve problems for the pc. But on the XBox there is another problem: If I want to store these options per user, then I think i would need a "press start" screen to get the active controller, but how can I know the resolution of this screen? Also, If a user set his game to mute, he probably doesn't want to have loud music during that screen ...


Dec 14, 2009 at 4:16 PM

Here are a few random suggestions in no particular order that you should consider:

1) On PC use the PCSaveDevice. It uses standard .NET IO and doesn't rely on any asynchronous methods so you can create it and immediately start using it in your game's constructor. Of course you'll want to put an #if !XBOX around it.

2) For Xbox you don't need an option for resolution. I'd even argue that having such an option would be ugly and unelegant. You can determine the user's current output resolution using the GraphicsAdapter.DefaultAdapter.CurrentDisplayMode and create your graphics device with the proper resolution from the get go. Though on Xbox I generally recommend people stick with a single resolution (like 1280x720) and let the Xbox handle scaling up (to 1080i/p) or scaling down and letterboxing (to 480i/p) to simplify your job as a developer.

3) For audio, you want to balance your start up audio with the Xbox's default output volume. It won't be perfect but if you want to have a sound play over your company splash screen or at the title screen, this is how to do it. And with most things, it's better to be too quiet than too loud. Then when the user presses start on your title screen, you can prompt them to select a device, load their settings, and apply the new volume.

4) When applying the volume, do a bit of interpolation over a second or two. That way the volume change is more subtle and will feel a bit more polished than a sudden jump in volume.

Dec 14, 2009 at 5:57 PM

Thanks for the hints, this helped alot. I decided to show the SplashScreen only on the XBox and allow resolution changes only on the pc which solves my problem. Thanks again for your great lib, it really helps to handle storage in a unified way.