Today we look at the Machinations features that support the feedback mechanism called Feedback Loop. We will show you how to dynamically modify the chart results by using gates and modifiers, and we will also talk about the judges and return to the second part of the model from the previous piece, simulating artificial intelligence.
State (State Modifier)
One of the basic game mechanics is the so-called feedback loop. In simple terms, this is a mechanism where the quantity of one raw material has a direct or indirect impact on the raw material. For example, the more laborers the player will have, the more gold he gets. Or vice versa: the more balls in the billiard sink, the more difficult it is to hit another and get more points. It can be seen that the raw material need not be just points or gold, but also the number of balls on the playing table.
For example, when a player has a lot of workers, the number of gold earned will increase. As you can remember, reception is shown by currents. There is therefore a direct link between the value of the current (the number of raw materials flowing) and the number of raw materials in the warehouse (the number of workers). The state modifier serves to express this relationship. There are many types of loops, but most of them are done using this tool.
The status modifier is distinguished by function on 4 types:
- Element Modifier (Node Modifier)
- Value modifier
Each of them is different in label format, as the current differs.
The element modifier is a modifier that connects two slots. Here is a direct link, where any change in raw material in one store directly affects the number of raw materials in the second store.
Every time the left warehouse receives 5 raw materials, the right warehouse for each raw material will be added. Should they be taken away or sent to them again, it will be deducted in the same way as the right store. The link between the repositories is determined by the modifier label. The one in this case can be entered in the following formats:
|Modififcator||+ x, -x||+5, +1, -3||The target warehouse is credited with x for each feedstock in the feed|
|Fraction||+ x / y, -x / y||+ 5/4, +3/2, -1/3||The number of raw materials in the target warehouse is multiplied by the source stock and the modifier value|
Note: I recommend avoiding situations when you attribute attributes to circles in the loop. Your app will drop
The value modifier is a modifier that links the storage with the stream or the modifier store. There is a direct link between the number of raw materials and the flow rate.
With each raw material received by the lower store, 1 is added to the value of its input stream. In the first move, therefore, they receive 1 raw material, they will receive two in the next stroke, in the next 4, etc. Similarly with each raw material removed, the respective value will be reduced.
Note that you can also link a warehouse with a modifier. It is possible to create several level links between the elements. This is also used in our first model combined with the gate.
But this model has one hidden trick. Try it. You will surely come to her quickly.
Tip: Watch how the current value that is affected by the modifier changes.
Vtah between stock and current is defined by the modifier label and can be of the following shapes:
|Modifier||+ x, -x, + x%, -x%||+2, -3, +0.2, -18%, 182%||Add the value of the modifier to the label value|
|Fraction||+ x / y, -x / y||+ 5/4, +3/2, -1/3||To that end, a fraction of the resources of the resource are priced|
|Interval||+ xi, -xi||+ 2i, -3i||Add x for each raw material in the warehouse to the target interval (ie, if a fraction increases the denominator)|
The trigger can connect almost anything. Its purpose is to invoke the actions of other elements under certain conditions and is defined by the modifier label format. It can be of two shapes:
|Trigger marker||*||*||If the raw material comes to the source store, the trigger is activated|
|Probability||x%||25%, 18%||If the raw material comes to the source store, the trigger is activated with a probability of x|
What does trigger trigger mean? Nothing else than triggering a target element action. For example:
Clicking warehouse A moves the raw material to store B, which satisfies the trigger and triggers the action of the warehouse C. The warehouse mode C is push any, ie it passes one raw material to the store D. Remember how I wrote that even in passive warehouses it may depend on their fashion?
If you wrote 20% instead of a star, first you would randomly calculate 20% chance and if satisfied, then the trigger would be satisfied.
Activators are defined by the format of their label as a condition. It can be of two shapes:
|Condition||== x,! = x, x,> = x||== 4, 1 = 1, -2,> = – 3||The left side of the condition is the number of raw materials in the source element. If the condition is met, the target element is activated|
|Interval||xy||1-3,2-4,5-6||If the number of raw materials in the source element is within a given interval, the target element is activated|
Keep in mind that if there is not one raw material in any circuit of the diagram, the entire block of the block is blocked cascade (it is “dead”). By cutting off one element of the diagram, you can cut even larger units of the model. What does it mean to be activated? Nothing but that he can and will do his actions. If it is an automatic element, it will regularly start its action (push, pull, source production, etc.). If it is an interactive element, the player is allowed to control it. Once the raw materials in the warehouse have changed so that the condition is not met, the target element is again blocked.
Note: The machinations tool currently contains one bug: if you use the warehouse and interval format as the activator, the specified interval is taken as a mathematical expression (eg 4-5 is taken as -1) and the activator becomes the value modifier (see above). Therefore, there is no way to activate the warehouse by using an interval.
And to make it a little, we have one exception. If the modifier is a gateway (see below), which by its very nature can not act as an activator because it never stores any resources, in the case of label format in the form of a condition or interval, instead of activating the element, it only invokes its action (ie does not work as an activator, trigger).
Activators and triggers along with the gateway are the most rewarding elements of the entire framework. So I recommend that they pay close attention to them and try their best to try them out.
More examples of how to use modifiers can be found at the official Machinations wiki .
That’s all about modifiers. Among other things, color, thickness, and minimum and maximum values can be set. However, these properties do not differ from the source-like attributes of the same name, and therefore move directly to the next element: Gateway.
Gateway is a very important and multifunctional element Machinations. Its essential feature is that it never collects the raw materials and only redesigns them immediately into their output streams. If the state modifier outputs, the gateway works together with the modifier as the so-called trigger.
The gateway defines four basic features:
The gateway can be either passive, interactive, automatic or in OnStart mode. The principle of these modes is no different from the warehouse of the same name.
Unlike a warehouse, the gate offers only two modes: pull any and pull all. Still, for some reason, there are two other gateways in the menu. But they take as if the gate was in the pull any mode. Functions of these modes are no different from the warehouse.
Each output can use a label to define the condition for which raw material passes through the path. The gateway output can either be a source stream or a state modifier. If the output is a status modifier, the raw material is discarded and trigger action is triggered instead (trigger, see exception above). When determining a label, we distinguish between probability and condition:
|None||It is taken as if the label “1”|
|Probability||x%, x||10%, 4, 3, 6||It defines the chance for the raw material to pass through the path|
|Expression||== x,! = x, x,> = x||== 2, 1 = 2,> 8||If the gate value generated meets the condition, the raw material passes through|
|Interval||xy||1-2, 3-5||If the generated gate value is within a given interval, the raw material passes through|
|Other||else||else||If the gate value generated does not meet either condition, the raw material is sent by the path marked else|
determines how the gate value is generated when the raw material passes. It can be of two types:
- Deterministic – in the case of probabilistic outputs, it divides the raw materials evenly with respect to their relative weight so that they always share the raw materials in the same way in each run of the diagram. In the case of conditional outputs, each gateway feeds the gate value by one, and this value is used to evaluate the conditional expression determined by the label. For each interval, the value of the gate is reset and starts increasing again from scratch. Obviously, conditional expressions may overlap, or there may be situations where the condition does not fill any current. In this case, the raw material is either multiplied or discarded. If the sum of the probabilities of the output streams does not cumulate 100%, the remainder of the sum determines the likelihood of the raw feed.
- Random- Random Gate is defined by a random formula of one of the four basic symbols specified in the diagram setting. This value can be further modified by the input status modifier. In the case of probability outputs, the output is chosen randomly with respect to their relative probability.
The fundamental difference between deterministic and random distribution mode is that, in a deterministic way, each run of the diagram produces the same result. Not accidentally, however.
The gateway is the most enamored element of the whole frame. It allows for a huge number of combinations, but if you can orient yourself in it, it will come in handy. Here are some examples of how to use the gateway:
More examples of how to use the gate can be found at the official Machinations wiki.
Tip for interest
I recommend that you keep the gateways listed and do not mix them together, the gate will behave in a very unpredictable way.
If you want to use probability, use probability for all outputs. To define it by weight, define all outputs only by using the balance. And if you want to use conditions and intervals, use only the conditions and intervals and do not confuse that probability. There is no reason for that, and second, you can be pretty sure it will not work. Likewise, I do not recommend giving probabilities greater than 100% and using probability in deterministic gates.
I spent several hours trying out all the possible variants, but I tried very hard, I could not find out how these bizarre combinations were decided on the gate’s throughput.
The arbitrator’s input can be any number of status modifiers, all of which must be type activators (or their label must be conditional). Once all the conditions of the referees have been met, the diagram will automatically terminate. This way, you can simply include in your charts the conditions determining the victory of one side or another.
Now let’s look back at the example with the distribution of raw materials and focus on the Artificial Intelligence:
Review the entire diagram again and try to identify as many elements and features as possible. Then return and compare your findings with the following diagram description.
We first examine the gates. There are three in the diagram and all of them have the same purpose and features – simulating the same decisions a player might have done. Note its configuration:
- It is automatic – it generates a gate value in each time interval (end of stroke) and starts its action.
- Its output is a state modifier – it also acts as a trigger. With each success, the target element action starts.
- It is random – it generates the value of the random expression defined by the symbol of the playing block.
- Its output is given by probability – it has a 50% probability of passage.
Now take a look at them all. Do not you see anything special about them? If you have no input stream, you have won. Under normal circumstances, the automatic gateway in every turn would trigger an action specified by the gateway mode (eg pull any). Through it he would have reached the raw material and turned it into a chance to trigger the trigger. However, this gate has no input stream. Instead, it generates a gate value and attempts to run at least triggers while output raw streams are ignored. But I recommend that in this case the gate always be random. For the deterministic gate, there is no written record of how it behaves under these circumstances, and although it produces seemingly random values, it is not guaranteed that they are 100% random.
With this mechanism, you can partially simulate the Artificial Intelligence of the player (much better to use the script, but later on). Each area has a certain probability of an investment that will happen if it has enough money and succeeds against the coincidence. By distributing the probabilities then you give each area a weight, with the ones with the greatest weight being the most important and the most invested in them.
For a more dynamic decision-making, I’ve brought another state modifier that affects the probability of investing in research. The value of “-20%” means that with each raw material owned by a player, the chances of investing in research will be reduced by 20%. This can simulate a strategy where, if a player spends enough money, he will consider much more investing in a more expensive area (s) at the expense of research. The probability of investing in economics is not affected, because it is so important that the player invests it with a certain regularity (once per round).
As a last resort, note the referee. This one detects which player first won a population greater than 30. When 31 raw materials appear in the Population warehouse, all the conditions of the input modifiers of the referee are satisfied, and he will end the diagram and blink as a sign of his decision.
The gate along with the modifiers are the biggest weakness of the whole frame. The huge number of combinations for them is not defined in any way, they can easily be lost in all the exceptions and differences and sometimes they can be quite confusing. Still, they are an integral part of the framework and work with them without them. That’s why I recommend trying them a lot before you go on the tutorial.
Next time we look at game economy and 4 Machinations for their implementation.