Virtual Currencies #

Gems and Cash are two of the available virtual currencies in Squad Alpha by Say Games.
Gems and Cash are two of the available virtual currencies in Squad Alpha by Say Games.

Define any number of currencies to be used in your game. Each currency can be either soft or hard currency. Soft currency is currency that can be obtained by the player through gameplay, and hard currency is currency that can be obtained by the player through real money purchases.

New players can be initialized with a set number of each currency, if desired, and currencies can be granted as part of a reward.

Defining currencies #

Currencies are defined in the JSON configuration file for your game’s economy system. You can define any number of currencies, and indicate the amounts (if any) of each currency that new players should start with.

This is done via the currencies property of the initialize_user object, for example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "initialize_user": {
    "currencies": {
      "Gold": 0,
      "Silver": 50,
      "Gems": 100
    },
  }

  ...

}

Wallet #

Listing currencies #

You can list the currencies in a user’s wallet.

1
2
3
4
foreach (var currencyKvp in economySystem.Wallet)
{
    Debug.Log($"{currencyKvp.Key}: {currencyKvp.Value}");
}

Refreshing the wallet #

You can refresh the economy system’s wallet data.

1
await economySystem.RefreshWalletAsync();

Currency rewards #

Players can receive currency by purchasing it via a virtual store, by watching a rewarded video, or as a donation from other players.