Unity Plugin (UP) & API
Loot & Craft
This example shows you how you can model a simple loot & craft mechanic.
Remember to hit the Play button on each embedded diagram in the example below.
- △ Sources produce Resources
- In this example the Spawn Enemies Source is used to simulate spawning enemies
- → Resource Connections transfer Resources
- The “kill” Resource Connection is used to set the rule of how many enemies are killed per Step. The player kills 1 enemy each Step. This is inputted in the Formula field. In this case, 1
- ◯ Pools collect Resources
- The Enemies killed Pool is used to track the total number of enemies killed
- ⇢ State Connections change the state of elements on the diagram
- Every time the Enemies killed Pool receives a Resource it triggers the Loot Source for one Step
*Formula on the “trigger” State Connection gives the “trigger” command
- For each enemy the number of possible drops ranges from 1 to 3
- We simulate this by adding the d3 formula on the Resource Connection “drop”.
- d3 represents a 3-sided die that is rolled whenever Loot is triggered
- ◇ Gates distribute Resources
- The dice symbol on the “distribute” Gate denotes that the distribution is random
- The chances for each type of drop are shown on the Formulas of the connections leaving the Gate
- We use 3 Pools to keep track of all the collected materials
- ▷Converters transform one type of Resource into another
- The Converter transforms/consumes 6 Iron Nugets, 4 Metal Wires and 3 Wood Planks
- and crafts them into 1 Bow
- Note that crafting action happens AS SOON AS ALL Resources needed are available in their respective Pools
- The orange connections are the variables that we can balance.
- We can adjust either the material drop rates, material cost for crafting, or both in order to strike a balance.
- The materials and bow Pools are added to the Chart.
- Hit Batch Plays and see how the player’s inventory looks evolves over time.
Add this diagram to your Machinations (big blue button top right)
- Change the highlighted variables
- After each change perform Batch Plays
- Visualise how your changes affect your system in the Chart