Be careful about how you use Guide.IsTrialMode in an XNA Game Studio 4.0 game for Windows Phone
My colleague Michael Klucher posted an item on his blog earlier this week that I wanted to link to in order to hopefully help raise visibility for it. In his post at https://klucher.com/blog/trials-and-tribulations/, he describes a performance issue to be aware of when developing Windows Phone games using XNA Game Studio 4.0 and the Windows Phone Developer Tools.
Here is a quick summary of the key points in his post:
- On Windows Phone, calling Guide.IsTrialMode can be expensive (~60 milliseconds per call), so it should not be called every frame in your game code.
- This performance problem only manifests itself when a game is downloaded from the Windows Phone Marketplace – you will not see it when running your game in the emulator or when using Guide.SimulateTrialMode on a device during development.
- This performance problem does not occur on Xbox 360, so pay particular attention to how you are using Guide.IsTrialMode if you are porting a game from the Xbox 360 to Windows Phone.
- You should consider checking the trial mode state at startup and at key intervals during your game instead of every frame. For example, if you have a functionality-limited trial mode, you could check the state at the end of the last level that is a part of your trial experience and determine whether or not to unlock subsequent levels.