共用方式為


Guide.IsTrialMode behavior change in XNA Game Studio 4.0 games for Windows Phone

Last fall, I wrote a blog post linking to some information about using Guide.IsTrialMode in an XNA Game Studio 4.0 game for Windows Phone.  Since then, the XNA Game Studio team has updated the behavior of the Guide.IsTrialMode API to simulate the same performance characteristics during development that a game will experience when a game is downloaded from the Windows Phone Marketplace.  This change is available in the Windows Phone update that was released this spring:

As a result of this behavior change, the following point in my previous blog post no longer applies:

  • 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.

The following points from my previous blog post still apply, and should be taken into account when implementing trial mode functionality in your game:

  • 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 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 (specifically, in your Activated event handler) 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.

<update date="5/5/2011"> Added a clarifying note to recommend that the trial check be done in the Activated event handler. </update>