Unity Plugin (UP) & API
Note: machinations.io does not have an Artificial Player Node. However, most situations solved with the AP Node in the original version may be modeled with existing Components.
This article deals with a few examples of how to do this.
Fire a specific Node on the diagram
Fire multiple Nodes simultaneously
To emulate the statement above, use a Deterministic Sorting Gate with weighted outcomes.
💡 Note that the order in which the gate sends Resources along its outputs is determined by the order in which these outputs were added to the diagram.
To fire multiple Nodes randomly, use a Random Sorting Gate with probable outcomes to trigger each Node and balance the probability with which each Node is fired, to fit your needs.
You can emulate conditional commands like
if(condition)commandusing multiple components.
Here’s a simple example of how to emulate
If you’re trying to model a more complex if statement, you can use Registers to calculate conditions.
💡 Note that in machinations.io Registers support all math.js functions.
Here’s such an example:
The passive Register verifies if the value “a” – equal to the number of Resources in “pool” at every time-step – is larger than 3 and smaller than 8. This returns a binary result (1-true; 0-false). As long as the value of the passive Register is >0, “source” is active and produces resources.
Chapter 8: Simulating and Balancing Games – Artificial Players in Machinations” (Dormans, Adams, 2012)
Here’s how to emulate the
if(Resources>4) fireRandom(Consume, Upgrade) example
The Pool Resources fills with more than 4 Resources before randomly choosing between a Consume or Upgrade action, with a probability of 30% by 70%, respectively.