Randomized Transitions
In some demos, you may need to randomize multiple transitions from the same scene. You are likely to do this in scenes that involve unpredictable results, such gambling, a player hitting a baseball, or randomly spawning one of several monsters.
For example, to reflect the randomness of a possible outcome in a baseball game, you can create multiple transitions with different probability in your demo, for example, 40% Home Run, 30% Double, 15% Single, 10% pop out, and 5% ground.
With randomized transitions, the demo will move to an alternative flow somewhat at random rather than as a result of a predefined transition logic. To accomplish this, you need to set the appropriate probability values fro each alternate transition.
Here’s what you need to keep in mind about setting probability:
- The probability values are decimals between 0 and 1, with 1 indicating that the transition will occur with 100% probability and is the only valid probability.
- The total sum of the probability values for multiple transitions is not required to equal 100%, as Studio tallies the values you enter for each alternate transition and calculates its percentage accordingly.
- If you enter the same value for each transition, each will have an equal probability. For example, if you enter .33 for each of three possible transitions, each will have 33.33% probability.
- To increase the likelihood of a specific transition, for example, to offer the user an easier, winning path, enter a greater decimal value for that transition and lower decimal values for the others.
- Go to Scenes and select a scene where you want to add randomized transitions.
- Go to Events & Actions and in the Transitions section, click Add
.
- In the Transition menu on the right, in the Probability field, enter a decimal between 0 and 1, for example, .4, .3, .15, .1, and .05 for 40%, 30%, 15%, 10%, and 5% respectively in the example above.
Tip: You can also randomize transitions using trigger conditionals, for example, as described in Trigger Use Case 2.
- Make the appropriate selections in the remaining fields.
- Repeat steps 3 and 4 for each transition in the flow.
The respective Move to Scene blocks in the Events & Actions panel reflect the probability you set for each transition. - Save the project.
- (Optional) Click Path View to see the transitions you have defined.
In Path View, the transitions for the use case above should appear similar to the ones shown below.
No Comments