Skip to main content

Spin the wheel and treasure chest

Data stores can be used to create engaging mini-games like "Spin the Wheel" and "Treasure Chest." These games add an element of chance and excitement to your engagement strategy.

Overview

These mini-games use data stores to save information that determines the probability of particular outcomes, such as:

  • Which spoke on the wheel is selected
  • Which prize in the treasure chest is unlocked

The rest is implemented using standard mechanics from the Mambo platform, combined with a custom user interface.

Implementation steps

Follow these steps to create a spin the wheel or treasure chest mini-game:

  1. Create a coupon (optional)

    • Create a coupon that gives users the opportunity to spin the wheel or open the treasure chest
    • Associate a relevant image with the coupon (e.g., a token for spinning the wheel or a key for the treasure chest)
    • The coupon can be earned by exchanging points or through other mechanics
    • Alternatively, you could simply allow users to spend their points directly for spins or chest openings
  2. Define behaviours

    • Create behaviours that will reward the user based on the outcome
    • These behaviours will be triggered when the user spins the wheel or opens the treasure chest
    • The behaviour triggered will depend on the probabilities defined in the data store
  3. Set up rewards (optional)

    • Tie rewards to the behaviours to recognise streaks or combinations of outcomes
    • This can add an additional layer of engagement to the mini-game
  4. Configure data stores

    • Create a data store to define the different possible outcomes and their probabilities
    • Link each outcome to a specific behaviour that should be triggered
    • See the example code below for a spin the wheel implementation
  5. Build the user interface

    • Create a custom UI that allows users to:
      • See their available tokens/keys
      • Interact with the wheel or chest
      • View their rewards after spinning/opening

Example code

Below is a sample data store for a spin the wheel mini-game:

JSON

In this example:

  • Each object represents a possible outcome on the wheel
  • The probability field determines the likelihood of each outcome (the sum should equal 1.0)
  • The behaviour_verb field specifies which behaviour will be triggered
  • The behaviour_metadata contains additional information that can be used by the behaviour