Trial mode in XNA Game Studio 3.0
All Xbox LIVE Community Games are required to provide a trial mode, so people can play the game for a while before deciding if they want to purchase it. You have several choices as to how much time you want to spend implementing this.
Do Nothing
You can do no work at all, and your game will still have a good trial mode experience. Here's what the framework does for you:
- Users can play the game for a fixed period of time.
- When the timer runs out, we will bring up a screen over the top of your game, saying "hey, this trial has expired: do you want to purchase the game?"
- If they decide to purchase, the screen goes away and they can continue playing.
- If they say no, we exit the game.
- While the trial expiry screen is up, Game.IsActive will be false, the same as if any other Guide screen was active.
Note that networking is not supported in trial mode. If you try to create or join a network session while in trial mode, you will get a GamerPrivilegeException. But you don't need to write any special code to handle this, because trial mode forces GamerPrivileges.AllowOnlineSessions to false, just the same as if it was a Silver or child account.
Detecting Trial Mode
Some games want to detect when they are running in trial mode. You might change your level selection based on this, giving the trial an easy but exciting first level that will suck people in, and only enable the slower paced training missions after they purchase it.
Trial mode is easy to detect:
- Add a GamerServicesComponent to your game, if you don't have one already.
- Check the value of Guide.IsTrialMode.
The value of IsTrialMode can change at any point. Even for a game that has been purchased, trial mode might be active for a few frames when it first starts up, as the system checks what user profiles are signed in to see whether they own it. And of course the user may purchase the full game while the trial version is running. So if you have a menu that displays different options depending on the trial status, you should update this every frame, not just once when the menu is first activated.
Once a game has been unlocked, it will never go back to being in trial mode. Even if the original user profile signs out, the game stays unlocked as long as it is running.
Upselling Your Game
You can use Guide.ShowMarketplace to display the purchase UI before our time limit has expired.
For instance a multiplayer networked game could deal with trial mode in several ways:
- It could hide the "Play Online" menu option when in trial mode.
- It could leave this option in the menu, but have it display an error message.
- The "Play Online" option could bring up a message that says "hey, you need to purchase this game before you can play it online. Do you want to do that now?" and then take the user to Marketplace.
Testing Trial Mode
This trial mode stuff is all very well for Community games that have made it through peer review, but what about when you are testing or peer reviewing? At this point the game is not yet on Marketplace, so there is no way to purchase it. Even if there was, you wouldn't want to pay real money every time you tried to test something!
Fear not. You have several options:
- When launched from Visual Studio, Creator games are not in trial mode, so you get to see and test everything.
- When launching a Creator game from the Xbox Dashboard Game Library, you will see options to start either in trial mode or as a full version. Peer reviewers can use this to make sure the game behaves sensibly in both modes.
- If you set Guide.SimulateTrialMode to true in your Game constructor (important: for this to work you must set it before the first update!) this will force the game to run in trial mode, so you can debug trial-specific behaviors.
- If you call Guide.ShowMarketplace from a Creators game that is not yet on Marketplace, this will not actually take you to Marketplace, but will instead bring up an emulation message box asking whether you want to simulate a purchase. Saying yes will change Guide.IsTrialMode to false, and enable network sessions, the same as if you had really purchased a Community game. Combined with the SimulateTrialMode setting and/or launching in trial mode from the Game Library, this allows you to test your upsell implementation.