Game Development Reference
In-Depth Information
The trial mode
So you want to sell your game upfront, but also want to give players a taste of the
game so that they can be encouraged to buy your game instead of ignoring it. This
can be accomplished using the Trial mode flag provided by the Windows Store API
in WinRT.
Even if you want to offer your full game as a time-limited trial using the built-in func-
tionality in the store, you might still want to add in some screens or messages to en-
courage the player to buy the game. For that, you need to know if the game is a trial,
or if the player has purchased it.
This can be easily accessed using the following lines:
auto trial =
Windows::ApplicationModel::Store::CurrentApp->LicenseInformation->IsTrial;
auto trialActive =
Windows::ApplicationModel::Store::CurrentApp->LicenseInformation->IsActive;
if (trial && trialActive)
// We are in trial mode and it hasn't expired
You'll notice here that we retrieve the IsTrial flag as well as the IsActive flag.
The IsTrial flag just indicates if the license is for a trial game or a full game. It does
not, however, indicate if the license has expired or been revoked. This can be checked
using the IsActive flag, which lets us know if the license (full or trial) is active and
valid. When used in combination we can determine if the trial is running fine and is in
fact a trial.
The other thing we should do at this stage is also subscribe to the LicenseChanged
event, which notifies us if the player has changed the license by purchasing the game,
or if the trial has expired while the player was playing. By responding to this we can
alter the game appropriately without requiring the player to forcefully terminate the
game and relaunch it. This enables us to get the player to switch to the store while he
or she is playing, buy the game, and then switch back into the game, which will have
recognized their purchase and unlocked any full game features.
Search WWH ::




Custom Search