Artificial Player

Note: machinations.io does not have an Artificial Player Node. However, most situations solved with the AP Node in the original version, may be modelled with existing Components.

This article deals with a few examples of how to to this.

1. Direct Commands

1.1 Fire Node:fire(node)

Fire a specific Node on the diagram

1.2 Fire Multiple Nodes: fireAll(node, node...)

Fire multiple Nodes simultaneously

1.3 Fire Sequence of Nodes

1.3.a In order: fireSequence(node, node...)

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.

1.3.b Randomly:fireRandom(node, node...)

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.

2. If Statements

You can emulate conditional commands like if(condition)commandusing multiple components.

Here's a simple example of how to emulate if(pool>2)fire(source)

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: if(pool>3&&pool<8)fire(source)

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.

📚 👩🎓 Studying Game Mechanics: Advanced Game Design, "Chapter 8: Simulating and Balancing Games - Artificial Players in Machinations" (Dormans, Adams, 2012)?

Here's how to emulate theif(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.