You are on page 1of 64

Subscribe to DeepL Pro to translate larger documents.

Visit www.DeepL.com/pro for more information.

MACHINATIONS 101
NOTES
(https://www.youtube.com/watch?v=UiCJQ2nRXXo&t=2s )

Prepared by
Yunus Emre GÖNÜL-Game/Level Designer
MACHINATION 101 (YOUTUBE)
- Machination is a web-based program that allows you to simulate the game through
diagrams, making it easier to adjust the balance of the game. It's a tool that allows you
to run the game randomly many times, gives different results with each play button,
and can also graphically represent this, allowing you to adjust the variety in your game
in the way you want.

- Machination is a moving flowchart and everything happens in steps. Once you have
decided on the game you want to model, the next thing to consider is what the step
will correspond to in the simulation. An example of a step could be a unit of time
(minutes, days in the game, etc.), an action of a game (opening a pack of cards,
completing a task, etc.), or the generation of blocks under the Player in Stack Jump.

- F1 shows shortcuts. When you click on any of the nodes twice, the node you clicked
directly on the Canvas is created. Then the object you clicked twice is immediately to
the right of it. If you hold Shift and click twice on any node, that object will move up
by itself. If you hold Ctrl, it puts it just below the node in the canvas. If you press
Shift+Ctrl at the same time and click twice, it puts it to the left of the node in the
canvas.

- Source (short form S):

• They are resource creators. For example, in a mobile


jumping game that goes on forever, we can think of
platforms that are created just below the player. This is an
example of an Automatic Source, as these platforms will
be created until the end of the game.

• Label part is located in all nodes. It is very


important to name the node because there will be a lot of
them while simulating. It can be named according to what it
does. For example, a Source name like "Kill Enemy" might
make sense.

• The panel on the side is called the Property Panel


in Machination. The Trigger section determines how our
Source will work. If we select Passive, there will be no
source transfer. It is necessary to activate it through another
node or through a condition. Interactive part
is activated when you click on it. Enabling works only once
(like the Start function in Unity●-^-^-^-).
• I will talk about push-any and push-all in the Action section in the next
topics.

• In the Style section, you can adjust the border thickness, color and text of the
node.

- Drain (short for D):

• We can think of it as a source absorber. So it's the opposite of Source. For


example, you can think of it like buying an item from the shop with your gold
in the game. Drains won't work if the trigger is passive. You need to trigger it.
It works when Automatic is selected. Trigger part is the same as the logic in
Source above.

- The explanation of pull-any and pull-all in drains is as follows:


In the chart below, there is a one-to-one transfer from Pool (another node explained in
detail below) to Drain. When pull-any, from Resource Connection (the arrow connection
that transfers resources from Pool (round node below) to Drain) 1 transfer is provided to Drain
in each step.

But when it is pull-all, the & sign appears on the Drain as below and it pulls the entire
amount to be transferred with this Resource Connection at once. As below, that is, after 5
resources go to the Pool, Drain pulls the transferred resource amount in one go.
- Pool (short for P):

• Pool allows resources to be captured and stored. In the Property Panel


Trigger parts also apply to Pool.

• A Pool can store more than one type of resource.

• If there is a resource transfer from Automatic Source to Automatic Pool and


the Resource Connection is 1, there will be 2 resource transfers because of both
Source and Pool. If Resource Connection was 5, there would be 10 resource
transfers. Because they are both Automatic.

• There are 4 options in the Action section of the Pool's Property Panel. Now you can choose
Let's examine it.
Push-any: Here we look at the possibilities through the pictures below.
Passive Pool and ��������🡪 There are 10 transfers from Source to Pool at the beginning
of the simulation. Our Pool in the middle is both passive and push-any (a P sign under the Pool
indicates that it is push
any) and the Pool to its right is passive and pull any. Since they are both passive, there is no
transfer between Pools.
Interactive Pool and ��������🡪 There are 10 transfers from Source to Pool at the
beginning of the simulation. Our middle Pool is Interactive and push-any. When you click on
the middle Pool, there is one source
transfer.

Automatic Pool and ��������🡪 There are 10 transfers from Source to Pool at the
beginning of the simulation. Our Pool in the middle is Automatic and Push-any. After 10
transfers are made, we move to the other Pool
are transferred one by one. The point here is important. What would happen if our Pool in the
middle was Pull-any instead of Push-any? Since it is Pull-any, the Enabling feature of the
Source would have no meaning and it would continue to pull 10 by 10 by 10 sources
indefinitely. And there would be no transfer to the Equiped Pool.

Enabling Pool and ��������🡪 There are 10 transfers from Source to Pool at the beginning
of the simulation. Enabling works only once when the play button is pressed. When the play
key is pressed
Since there are no resources in our middle Pool, there is no transfer to the Pool on the right.

Pull-all: An & appears just below the Pool. Let's look at the possibilities here through the
images below.
Passive Pool and ��������🡪 There is an infinite resource transfer from Automatic Source to Pool.
Our Pool in the center is Passive and Pull-any, the one to the right is Passive and Pull-all.
Because it is passive, there is no transmission.

Interactive Pool and ��������🡪 There is an infinite resource transfer from Automatic
Source to Pool. When we click on our Pool on the far right, we transfer the number in the
Resource Connection.
does it. If there are 3 resources in the middle Pool, when it presses the Pool on the right, it
waits for 5 resources in the middle Pool and then pulls them out.

Automatic Pool and ��������🡪 There is an infinite resource transfer from Automatic Source to Pool.
Every time the Pool in the middle accumulates 5 resources, the Pool on the right automatically draws them.
Attention here
the issue is t h a t the Pool on the right is Pull-all. Because if it was Pull-any and not Pull-all, it
would pull resources from the Pool in the middle one by one. Examples below.
Push-all: The p& sign appears below the Pool. Let's look at the possibilities here through the
pictures below.

Passive Pool and ��������🡪 As we mentioned above, if it is passive, transfer


It won't happen.

Interactive Pool and ��������🡪 As soon as we click on our Pool in the middle, Resource Connection
through which 5 sources can be transmitted.

Automatic Pool and ��������🡪 The Pool in the center automatically transfers to the Pool
on its right every 5 times.

• It is also possible to show the representation of the resources collected in Pools


in different ways. For example, if we want, we can show the resource in the
Pool with a number. For this, it is enough to write -1 in the Display section in
the property section. If we write 0, we will not see any numbers at the
beginning. For example, if 25 is written in the Display section, it means that I
will show 25 round shapes as numbers after they are collected in the Pool.
• If the Capacity section in the Property Panel of the Pool is -1, it means that it
can store unlimited resources. From here we can determine the capacity of the
Pool if we want. In the same section, there is the Overflow section. There are
two options here:
If Block is selected as Overflow: Resource transfer stops because the capacity is full.
If Drain is selected as Overflow, the resource continues to flow but the capacity of the Pool
does not change and the resources above the capacity are destroyed when they reach the Pool.
So it turns into a Drain.
• It is necessary to get the Push and Pull logic right. For example, in the example
below, our Pool draws unlimited resources from Passive Source thanks to pull-
any. But the Pool on the right side is not transferring resources because it is
Push-any.

- Gate (short form G):

• They are transmitters that transfer resources between nodes without storing
them. Gates have one input and multiple outputs.

• Only Pull-any and Pull-all in the Action sections in the Property Panel of Gates
There are.

• It is the same pull logic described in Pool, but the transfer from one node to
another node happens in 1 step. So having many gates in the picture below
does not mean anything. IMPORTANT.
• Trigger parts are the same as in Pools.

• In the Distribution section of the Gates Property Panel, select Deterministic or


You can choose the Random option:

Deterministic Gate🡪 Here resources are allocated sequentially.

Random ����🡪 Here the resources are distributed randomly. At each step, the number
written on the Gate is not the number coming from the dice, but the path to choose, that is,
which Resource
It indicates that it will go to the connection. It makes sense to use Random Gate Player when
you can't predict it.
• We can also write a percentage instead of a number to the Resource Connections at the
output of the Gate. But numbers and percentages are not used at the same time on the
Gate's outputs.

• If we want to distribute resources with 25% randomness in both Resource Connections


as in the picture below, with a 50% chance, the resources going to the Gate will be
destroyed.

• If we make both Resource Connections at the output of the gate 100% and it is not
random, the same amount of resources will be transferred to both.

P u l l - a l l 🡪 T h e s a m e logic as in Pool above. Let's look at the pictures. Here our Gate is both
Deterministic deployment after receiving 5 resources from both Automatic and Pool to Gate
is doing it. When transferring these 5 sources, it does it at the same time.
• Gates can trigger sources. In other words, they can activate. In the example below
We make Passive Sources transfer resources with a 25% chance.

• While our Gate Triggers the Sources, it can only Trigger one of them in each step. In
other words, both of them cannot be activated in the same step. The blinking orange
color in the Resource Connection coming out of the Gate indicates that the Source is
Triggered. Do not confuse Triggering here with transferring a bulk resource (for
example, in the previous 2nd picture, when 5 resources accumulated in the Pool, it was
distributing 3 to 2 at the same time).
• For example, Gate can be used easily when determining the percentage of items that
will drop when a boss is killed.

- Converter (short for V):

• Converters are used to convert one resource into another resource. For example, giving
10 gold to buy 1 weapon or giving 3 stone, 1 wood to build 1 house. Trigger parts in
the Property Panel are the same as other nodes. I am leaving one example photo.

• In Converters, all operations happen in 1 step as in Gates. As in the picture below. The
4 Converters at the top are also in 1 step, and the transfer of 1 source to the Pool
without a Converter is also in 1 step. Even in the picture below it, the transfer of 1
source through the Gates takes place in the same step as above.
• For example, you want to upgrade your item in a game and you don't want this
upgrade to upgrade every time you use the scroll paper. You want to increase the
attack of your weapon by 2 with a 25% chance. Then you need to use Gates and
Converters together. Here our Gate transfers resources to the Converter with a 25%
chance. It destroys the other resources. But in the first picture below, there is a 25%
chance that the source is passed through but it is destroyed. So we put another Passive
Deterministic Gate after the Random Gate to make it work more smoothly. Here, there
is a 25% chance that the source goes to Convertar, which is a problem because
Convertar can also destroy the outgoing source.

• In the property panel of the converters, there are two options as Conversion type. If
we select Single, it converts one by one as in the examples above. If we select
Multiple, it converts all resources in the Pool at once.

• Converters can take multiple inputs but should have a single output. For example,
l e t ' s say you can build 1 battle tower when you have 5 pieces of wood and 2 pieces
of stone. For this there should be 2 inputs to the Converter.
• If you want to distribute the outputs from the Converter, it is enough to use a Passive
Deterministic Gate.
If the colors of the Sources and the colors of the Resource Connection at the output of the
sources are the same, there will be a storage according to the color.
- Traders(short form X):

• It is similar to a converter. We can say that it provides the exchange of resources with
each other. For Traders to work, there must be 2 inputs, 2 outputs and they must be
represented by colors. Even if one of the colors is Black, which is the default color, all
input and output Resource Connections must also be color coded.

• We should think of it like shopping. The seller gets money and the customer gets
goods. If the seller does not have the goods or the customer does not have the money,
the exchange does not take place.
• Traders do not have a formula section in their output Resource Connections. Trader's Single
and we can transfer resources in multiple ways.

- Delay (Q):

• Delays, as they are called, transfer resources after waiting for a certain step. Here we
have a Delay whose Trigger is interactive. Whenever we click on the Delay, 2 steps
pass and on the 3rd time the resource is transferred. In other words, Resource
Connection lights up orange 2 times and on the 3rd time the transfer is done. In the
picture below, we started with 10 resources but there are 2 in the End Pool and 7 in the
Start Pool. This is because right now our resource is waiting in Delay.
• With Automatic Delay, things are a bit different. That is, there is a delay at first, and
then the next resource transfers take place without any delay. In our example, for
example, we started with 10 resources and it took 13 steps to transfer 10 resources. In
other words, it waits for 3 steps at the beginning and then transfers.

• If you want each source to wait 3 steps in turn, you need to check Queue in the Action
section of Delay's Property panel. In the picture below, it took 30 steps to transfer 10
resources.
- Resource Connection (short form C)

• It allows resources to be moved from one node to another node. In the Formula
section of the Property panel, we determine how many resources will be transferred. If
the Resource Connection does not say how much to transfer, then a constant 1
resource is transferred as in the 3rd picture. Comma numbers are not used in
Machination. It must be a whole number. Rounds the decimal number down.

• The component to which a connection points is called the target node and the origin
node is called the origin node. We can tell if the Resource Connection is connected to
the target by the orange coloring around it.

• If we write all in Resource Connection, it transfers the whole resource at once. If our
Source is Automatic, the resource transfer will be infinity.
• It is possible to distribute resources randomly with Resource Connections. In the
example below, a 5-sided die is rolled and a 4 comes up. 4 resources are sent to Pool.

• Here, a 5-sided die is rolled and a 1 comes up. 3*1=3 resources are transferred.

• In the picture below, we can think of it as if the dice were thrown 3 times and came up 2, 1, 2 or 1,
1, 3. This
the sum of the values from the 3 dice rolled.

• In the bottom picture, it does the same thing as above. It adds the dice rolled separately.
• In the bottom picture, the dice is thrown and the result is added to 6. This prevents the
possibility of a number less than 7.

• If we make the transfer type interval in the property section of Resource


Connections, we can decide how many resources should be transferred in how many
steps. For example; In the picture below, we were able to transfer 5 resources in 3
steps thanks to the interval option.

• In the Interval option, we can randomly decide at how many steps the resource will be
transferred. Below 5 resources will be transferred and the dice result is 2. In other
words, the transfer is provided in the 2nd step.
• In Resource Connections, we can enter a percentage (%) value in the Formula section.
There is a 50% chance that the resource will be transferred. You can even mix integer,
% and D5 (1+D5*10%).

• It is also possible to give randomness in a different way. We can use the formulas of
Maths Js Functions. When we assign a formula to the Formula section in Resource
Connections as below, it will produce an integer between 0 and 5.

• In the same way, by writing the addition formula, the resource can be transferred after
adding more than one number.
• We can also have Resource Connection calculate the Least Common Multiple
(EKOK). EKOK reminder: All numbers are divided into prime factors and these prime
factors are multiplied by each other. Example: 8 and 12 is the EKOK:

8 12|2
4 6|2
2 3|2
0 3|3
0 =>2*2*2*3=24

• We cannot treat Resource Connections as Register. I will talk about Register in my


notes in future topics. Here we are trying to pass a to the formula through the State
Connection. But this will NOT work.
- State Connection (shortcut Alt+C):

• State Connections can be used to manipulate nodes. We can think of it as a piece of


code. For example, it can be used to move resources coming to one Pool to another
Pool in the same step.

• In the same way, 1 resource coming to a Pool can allow a different number of
resources to be sent to a different Pool.
• We can use State Connections to reduce 1 resource coming to a Pool from another
Pool. Below, the rightmost Pool has 20 resources and when 1 resource from Source
goes to the first Pool, the same step decreases 1 resource from the Pool on the right.

• In the same way, we can also transfer resources between Pools.


• State Connections can only move in one direction. Therefore, when we want to
destroy a resource from a pool connected to another pool with the same State
Connection, we connect it to Drain with a Resource Connection.

• For example, in a game, if we want to keep track of the gold earned by the Player
throughout the game, a diagram like the one below can be used. Below we say that
every 2 steps, 10 gold disappear from the Current Gold Pool.
• If you want to transfer all resources from one Pool to another Pool in the 1st step, it is
enough to write +1 to State Connection. If we had written +2 in the picture below, we
would have 20 resources in the Pool on the right at the end of the first step.

• If you want to equalize the Pools and increase the number of sources 1 by 1 after step
1, you need to do as below. The important thing here is that both Pools have 11 at the
end of step 1. In other words, at first, 10 resources in the left Pool are transferred to the
right Pool and in the same step, 1 resource from Source is transferred to both Pools.
• Modifying resource transfer with State Connections, more precisely "Node Modifiers"
only works with Pools. It does not work with Gate or Converters.

• We can also change labels with State Connections. Label, for example, is the place in
the circle above the Resource Connection. So we write a formula in it. For example, in
the picture below, Source generates 1 resource every 2 steps and sends it to Pool. The
State Connection is connected to the label of the Resource Connection and increases
the resource transfer to the Pool at the bottom by 1, +1 every 2 steps.
• We can do resource reduction in the same way.

• We can also change the interval of Resource Connections through State Connections.
We need to use the letter i for this. Below, when 1 resource is transferred every 2 steps
from the Source on the right, the interval of the Resource Connection from the Source
on the left decreases by 1. The first resource transfer happens at step 7.
• We can increase or decrease both the resource and the interval of the Resource Connection.

• With State Connections we can reduce or increase the generation of a resource in %.


• With State Connections we can synchronize the directly transferred resource with
whatever resource is in another Pool. With the = sign, no matter how many resources
are in the Resource Connection, it overwrites the resource in the other Pool. Here in
the first picture there are 200 resources, after the 1st step it becomes 0.

• It is also possible to do conditional operations with State Conections. For example,


when we click on Source below, 1 source goes to our Pool and when the number of
sources in the Pool is greater than 0, it activates our other Automatic Source.
• You can use all conditions like ">, <, ==,>=" as above.

• We can also use a range value. For example, 3..5 means continue generating resources
between 3 and 5. Below we can connect the State Connection to both Source and
Resource Connection.
• If we write 2 conditions, if one condition is met, it transfers the resource. So it does
not wait for the other condition to be met.

• If we want to write two conditions, we need to connect 1 State Connection to Source


and the other t o Resource Connection.
• An important point is that if either the Source that transfers the resource or the Pool
that will receive the resource as a result of the condition is not Automatic, the resource
transfer will not start even if the condition is met.

• We can use Conditions on all nodes. Below we see that they are used in both Gate and
Converter. Multiple Condition states coming out of the same Pool.
• We can also connect State Connections between each other by setting certain
conditions. State Connection became inactive because the number of pools exceeded
5.

• With State Connections, we can activate objects that are Passsive thanks to the trigger.
Trigger symbol is the * sign. We can trigger all objects like Gate, Converter.
• We can use triggers and conditions together. In the bottom picture, the top Pool is
activated when it is greater than 1 and the Pool below it is triggered by the State
Connection every 3 steps (due to the interval) and resources are transferred to the Pool
on the far right.

• Below is a good example. Let's calculate how much resources will accumulate in Pool
in 3 steps.

1. In step we have a Source that only works when enabled. At first the Enabling Source
sends a source, which runs once. It passed through Converter, came to Pool and increased
its own source by 1 with State Connection. Then the Pool activated the Enabling Source. 1
source transferred 2 sources to the Pool at the end with Converter. In the 2nd step, the
number of resources increased to 3 and the Resource Connection from Converter to Pool
became 4. Then again Enabling Source is activated with trigger and Converter outputs 1
resource as 4 resources this time and the result is 7 in the last Pool.
• Reverse Trigger:
- End Condition (short form E):

• End Condition ensures that the simulation is completed under a certain condition.
In other words, End Condition runs when Game Over occurs.
- Register (short form R):

• Registers are always used with State Connections. I think Registers are the most
powerful object of Machination. Registers do not collect resources like Pools. We use
them for different calculations. We send/receive information to other nodes through
State Connections.

• For example, when we examine the bottom photo, the State Connections coming out
of the Pools are connected with Register. And we can give any name to the resource
going from the relevant Pool. We can call it a variable name. When we type
a+letter+word in the Formula field of the Register, the total value in the Pools appears
in the Register.

• We can make the registers interactive in the property panel. We can give the initial
value of the register, that is, the initial value and the step value. Then we can
determine the amount of increase each time the register is clicked with the number we

will write in the step section.


• We can use registers when we are going to perform more than one condition. For
example, how can we perform the "or" (|| in C#) operation. In the photo below, we can
think of the "+" sign in the formula part of larger(a,2)+larger(b,2) as the "||" sign. If
a>2 or b>2, we say activate Source. If we express it correctly, the expression
larger(a,2) becomes "1" when true and "0" when false. In the picture at the bottom
right, a is 1, b is 0. When we add it up, 1+0=1 is the number inside the Register.

• "In the expression larger(a,2)*larger(b,2), it works if they both return 1 below, that
is, if both expressions are true. Below a returns 1, b returns 1 and 1*1=1.
MACHINATIONS 102
NOTES
(https://www.youtube.com/watch?v=rNsfLH1zbjs)

Prepared by
Yunus Emre GÖNÜL-Game/Level Designer
- Register Detailed Overview:

• Arithmetic Functions:
The registers can contain negative numbers or decimal numbers. In the diagram below, the
formula written in the first Register is the same as add(b,a) and b+a. But it makes more sense
to use add(b,a). Add is addition, subtract is subtraction (a-b=1), multiply is multiplication,
pow is exponentiation 45.

In the first Register in the bottom picture, abs(b-a) expresses the absolute value. In other
words, it returns positive no matter what the result is. ceil(a/b) divides b by a and always
converts the decimal number to the number one above. 17/5=3,4 but the reason why 4 appears
in the Register is because it converts 3,4 to 4. floor rounds downwards. That's why the result
of the Register is 3. These formulas are frequently used since the source transfer will always
be integer. Especially round, ceil etc.
The bottom picture is the other half of the top one, i.e. a=17, b=5. fix(a/b) formula gets rid of
the comma. round(a/b) rounds the comma to the nearest whole number. So 3,4 is close to 3,
so it rounded to 3. mod(a,b) is the operation 17 mod 5. It gives the remainder after dividing a
by b. The remainder of 17/5 is 2.

In the formulas below, we get the square of 8(82), the cube of 8(83), the square root of
8(√8) respectively. In the formula sign(-a), sign returns 1, 0, -1. In other words, it returned -
1 because the parenthesis is "-". So we will use it as true, false.
We can also write logarithmic functions into registers. In the example below, log(a,b)
expresses the logarithm of the number a in base b. If we calculate it manually, log5(17)= x,
5x=17, that is, whatever power of 5 we take is 17. The number 17 is between 1 and 25. So it
will correspond to a number between 1<x<2. This formula gives us this x value. Likewise, the
expression log10 (17) calculates the value of 17 to the power of 10. 10x=17 which calculates
that there must be a value between 10<17<100=> 1<x<2. The last log(a) is expressed as
ex=17 in base e since the base is unknown. In other programs this may be ln(17).

With the help of the register we can find the EKOK (Least Common Multiple) and EBOB
(Greatest Common Divisor). Lcm=Least Common Multiple, gcd=Greatest Common Divisor.
An equation is the smallest multiple of two or more numbers that are the same. Let's calculate
a different Eq. than in the formula: For example, 8 and 12=>
Multiples of 8=8, 16, 24, 32, 40, 48 ...... Multiples of 12=12, 24, 36, 48....... As you can see,
among the numbers I wrote, 24, 48 are common multiples and EKOK gives us the smallest of
them, namely 24. Reminder: If we want to calculate manually, the desired numbers, i.e. 8 and
12, are factored and all are multiplied.
Ebob gives the greatest common divisor of the numbers. For example, the greatest common
divisor of 8 and 12 is 4. Reminder: when calculating manually, factorize and multiply the
common ones.
Below is the player's leveling simulation. Let's go step by step.
1st step: Xp is transferred from Source to Pool at random 300+d200. D200 returns a number
between 1 and 200. In Register, it calculates floor(1000*pow(1.15,a))=floor(1000*1.151) (the
reason why a is 1 is because it is 1 in Level Pool) and returns 1.150. Then it connects this
condition to the Resource Connection coming out of the Pool. When the initial value there is 0
and 0+1.150, we will say skip level. We convert this value with the help of Converter and
increase the Level Pool by 1.

4. step: In Step 4, our Experience Pool becomes 1.514, that is, more than our condition, in the
next step, that is, in Step 5, our level will be 2 and 1514-1150=364 remains in our Pool and
492 exp comes from Source. So 856 exp remains in our pool. Register calculates the amount
needed to go to Level 3 since we are Level 2 at that time. Floor(1000*1.152)=
1.322 exp. When 856 in the Expreince Pool is greater than 1.322, we will move to level 3.
• Bitwise Functions:
Bitwise operations are also possible. But it is almost never used. But let's explain it anyway.
First of all, to understand this, we need to take a brief look at the Binary system. Binary
system is a 2-counting system, in other words a 2-based system. We currently use the 10
system in daily life, the difference is that the highest number is 1 here. As a computer unit of
measure (i.e. storage) the smallest unit is the bit. 1 byte consists of 8 bits. 28 i s the maximum
value it can hold. In base 10, this corresponds to 256. For example, let's try to write 12 in
Binary system; 12/2=6(remainder 0), 6/2=3(remainder 0), 3/2=1(remainder 1), 1/2 =0
(remainder 1) what is important for us here are the remainders. When we start writing in
reverse, the remainders are 1100. According to this, the numbers we will use in the examples
are equal to 17=10001 and 5=101 in binary system.
The following formula bitAnd(a,b) checks which digits of numbers written in binary system
have 1s in common. 17 and 5 have only the first digit in common. 10001 and 101 So we get
the result 20=1. In the formula bitOr(a,b) we check whether there is a 1 in any of the 2
numbers (17 and 5). The number 17 h a s 1 in the first digit and the 4th digit in the binary
system, and the number 5 h a s 1 in the 1st and 3rd digits. So the result:
1. 1=20 in the 1st digit, 1=22 in the 3rd digit, 1=24 in the 5th digit 🡪 20 + 2 +224 = 21
The formula bitXor(a,b) gives the number 2 when the digits are the same digits in the binary system.
takes the value 0 in digits and 1 when there are different digits in the digits.
1 0 0 0 0 1 => 17 in the system of 2
0 0 1 1 0 1 => 5 in a system of 2
1 0 1 0 0 0 =>22 + 24 =20.
The following formula leftshift(a, b) shifts the digit a to the left by b bits. In other words, the
number 17 is shifted to the left by 2 positions in binary system. rightArithShift(a,b) formula
does the arithmetic shift of the number a to the right by b bits. So really useless formulas.
rightLogShift(a,b) I don't care at all.

• Logical Functions:
These formulas are used quite a lot. Here it is useful to remind the information that I think we
all know: 0=false, 1=true. We check whether the numbers coming to the register are 0 or not.
As in the example, since 7 and 4 are not 0, and(-a,b) and or(a,b) return 1, that is true.
xor(a,b) works in the opposite way of or, that is, if 2 expressions are greater than 0 or 0, it
outputs 0, false. If the 2 expressions are different, that is, if one is 0 and the other is a number
greater than 0, it returns 1, that is true. In the formula not(a), since a = 7 is not 0, it returned 0,
that is false.
• Matrix Functions:
We can write arrays inside the registers and use these arrays whenever we want. For example,
in the example below, the Register contains the numbers [6,3,9,2]. When one source goes
from Source to Pool, Register 2 becomes 6. Because Register 2 has a[b] in its formula. It tells
us t o call the first element of array a.
In the same way, we can use arrays without necessarily giving numbers. As in the example below.

We can find the number of elements of the array written into the register with the formula
size(a). If we want to sort the elements in the array, we do the sort(a) operation from small to
large. As in the example below. Below, the Register with the array is connected to two other
Registers with State Connections.
We can also write multi-dimensional arrays inside the registers. In the example
[[1,2,3,4],[5,6,7,8]] we wrote an array like this. If we want to reach the number 6 in the 2nd
dimension of this array, we call this array in the other Register. If we write a[2,2], we say
bring me the 2nd index of the 2nd dimension.

The example below is a simulation of the weekly event system in a game. Here the source
comes to the Pool above, we transfer the source to the Register in the middle with b and the
Register on the left side holds our numbers. If b=1, call the 1st element of the array a. If the
1st element is equal to 1, Event 1 is executed.
• Probability Functions:
With registers it is possible to calculate factorial, randomly select a number from 2 numbers.
As in the example, it calculates 7!=7*6*5*5*4*3*2*1. a=7 and b=4 are the number of
resources in the pools. random(b,a) returns us a decimal number, while randomInt(a,b)
returns us an integer. The important point here is that when returning the integer, it
includes the smaller number (i.e. 4) but not the larger number (i.e. 7). To prevent this, we
write the formula as randomInt(a+1,b). If we want to provide a randomness in each step, we
need to check the "force update value each step" option in the property section of the Register.

The pickRandom(a) formula is used to randomly draw an element from an array in a


Register to another Register. As seen in the example below
2. He chose Register 9.
Imagine that a character in your game attacks a monster of the same level. It should be almost
equal whether the character's attacks are misses or hits. We can even simulate that. As in the
example below, it generates a random value between 1 and 100 and connects to the Resource
Connections coming out of the Gate. Thus, we determine how many attacks are misses and
hits within a certain probability. The key point here is to check "force update value each step"
to update at each step.

But we can also simulate when our character hits an enemy with a high level or vice versa a
low level enemy. We click on the interactive option of Register and set an initial value. If it is
the same level, we can say 50. If we change it to 80% instead of 50%, most of the player's hits
will be hits. Likewise, if we reduce it to 20%, most hits will be misses.
• Relational Functions:
It is used to realize certain conditions. It gives us a lot of utility when building the simulation.
It is similar to Logichal Functions. compare(a,b) returns 1 if a>b (i.e. the first number is
greater than the second number), -1 if a<b, 0 if a=b. equal(a,b) returns 0 if a=b (the first
number and the second number are equal).

Likewise, when we think of the compare formula as true-false, we should think of


larger(a,b). Here a>b returns 1, that is true, and a<b or a<=b returns 0, that is false.
smaller(a,b) is the opposite. If we want greater than and equal to (>=) to return true, i.e. 1, we
should use the formula largerEq(a,b). Likewise, if we want small to be equal, we use the
formula smallerEq(a,b).
Let's explain the simulation below. When Player kills Enemy, with a 30% chance he gets a
material. With a 5% chance our Player loses 1 life. "a" is the player's health and "b" is the
number of materials. We can upgrade the material when the number of materials is greater
than or equal to 5 and the player's health is greater than 0. We also connect the condition that
Register ==0 to Drain. As seen in the Pool to the right of Register, there is 1 resource.
larger(a,0)
When *largerEq(b,5) occurs in two conditions, resources are transferred to our Upgrade Pool.
• Statistics Functions
The formulas max(a) are used to find the maximum value in an array, min(a) to find the
minimum value, median(a) to find the value in the middle of the array, and mean(a) to find
the arithmetic mean. If you want to find the sum of all values in the array, use sum(a), if you
want to find the product of all values, use prod(a), if you want to find the standard deviation,
use std(a).

The standard deviation is often calculated with the help of a calculator. It might be more
useful to explain standard deviation as follows. Let's say our player is level 10 and there is a
map with an area where 20 enemies are standing together. The player needs to decide whether
to enter this area or not. Let's say the arithmetic average of the level of the enemies is 10. But
here an enemy's level c a n be 20 or 5. This is how we measure how much it deviates from the
average. If the standard deviation is large, we know that the levels of these enemies may be so
different from each other, if it is small, we know that enemies of the same level are together.
If the standard deviation is 0, we know that all enemies are level 10. So hopefully
I thought I was right ●-^-^-^-Yet it is still necessary to investigate this issue.
Player's cooldown system is simulated below. It is useful to explain this. Register selects the
Pool with the minimum cooldown and transfers the minimum resource from the Pools to the
Resource Connections connected to Drain. At first, the one with 500 enters because the first
Player will be able to use that cooldown. When all Pools have 500, Pool 1 has 200,
0 in Pool 2 and 400 in Pool 3. In the 2nd step, the Player has to wait because the cooldowns
are not full. Then in the 3rd step 500 comes to the middle Pool. This time the smallest 200
remains in Pool 1. This time Register chooses 200 as min and 200 drops from all Pools. Then
comes the 3rd cooldown. It proceeds in this way. If ==0 in the State Connection from Pools to
Automatic Sources, it is a way of saying that if there are sources in Pools, do not generate
more sources.
• Trigonometric Functions:
It's not used very much. It is important to know that it exists.

• Utils Functions:
Instead of these formulas, formulas related to larger are used. The expression isInteger(a/b)
returns true, i.e. 1 if a divided by b is integer, false, i.e. 0 if it is not. isPositive(a-b) returns
true, i.e. 1 if the value obtained from a-b is positive, false, i.e. 0 if it is negative. isNegative(b-
a) is the opposite of positive. isPrime(a) formula checks whether a is a prime number. If it is
a prime number, it returns true i.e. 1, if not, it returns false i.e. 0. isZero(a) also checks
whether a is 0 and if it is 0, it returns true i.e. 1, if not, it returns false i.e. 0.
Let's look at the example given about isPositive(a-b). Let's imagine that Player and AI car are
racing. And we want the AI's proximity and distance to the Player to be close to each other, so
we set an advantage value. A 50-sided die is rolled on both cars to determine how far they
will move. Whichever car has a lower roll, the advantage value, i.e. the resource, is given to
the car with the lower roll. For example, car 1 rolled a 40 and car 2 r o l l e d a 3. Gates, as
we know, distribute resources in the same step. That's why car 2's Pool
13 appears. Because the Register subtracted 40-3 and found the result positive, which means
that the formula of the Register is true, that is, 1. When it is 1, through State Connection
Since the condition ==1 is met, 10 advantage resources are transferred to car 2.

🡪2. The dice value rolled by the car


• Some Different Register Formulas
For example, the formula/function round(100*1.25^(lvl-1)) Math.js can be written inside the
Register. What this means. Take the exponent of 1.25 every time the lvl variable increases,
multiply it by 100 and round it to an integer. Actually, we have written the formula for the
player's leveling. Or we can write it as a different leveling formula as
Floor(1000*pow(1.15,lvl)). pow = take exponent,
1.15lvl Floor also rounds to the nearest whole number.
For example, let's explain this math operation. floor((1+sqrt(1+sqrt(1+8*multiplier))/2)= 8
multiplied the multiplier variable from Pool via a State Connection, t o o k the black root,
added + 1 and divided the whole operation by 2 and rounded to the nearest integer with floor.

- Custom Variables:
Here you can write formulas as you want. To create it, there is a custom variable option in the
leftmost panel (X). You can create it by pressing the + sign and saying Add new. As Free, we
can create either Randomness or Math Expression. When we click on Randomness, the panel
in the right picture opens.
In the "Name" section we write the name of our variable. In the example below, Dice, in the
"Type" section, if you want to determine the random number in a certain interval, you select
the "Interval" option. For example, if you want the random number to be between 1 and 10,
you determine it this way. So you should write From:1 and To:10. This process is the same as
D10 if we noticed. In the "Distrubition" section, if you want the distribution to be equal
everywhere, you choose "Uniform", if you want to distribute symmetrically, then you choose
"Gaussian" according to the probabilities. In the "Update On" section, it means whether the
value should change at each step or only when play is pressed. If we want, we can also make a
definition in the "Description" section.

If we want to get the random value from a predefined array, we set the "Type"
and select "Array".
We can also define variables for mathematical operations. For example, let's say you will use
the number 2000 in many places in your simulation. Instead of writing 2000 everywhere, it
would be much more logical to write Cost as in the 2nd picture below.
In mathematical operations, we can enter an array that we will use continuously in the formula
section. We want it to be updated at every step so that our index changes. Since the first
element of the array is 10, Register also showed 10.

In this way, we do not use custom variable definitions only in registers. For example, we
create a list called "Array" and create another variable called "lookup" to call the index we
want in the array. This way we can even call it in Resource Connections whenever we want. If
we want to call the 6th element of a 7 element array, we need to fill in the formula part of the
Resource Connection as in the 3rd picture below.
/.r Math Expression a

Name Formda

upaate on

Dcserlplion +
Descfibe your variabie

Cancel

ArrayJookup]

1000 0.5 s Running step

Steps S['eed Step Resume Batch Rays Reset Open chart


OPINIONS
After sharing my Machination 101-102 notes with you, I would like to share my
opinions about the program. As far as I understand (not my area of expertise, I'm just trying to
learn), simulations of almost all games can be installed. For AAA games, it is possible to use
a loot simulation separately, skill update system separately, shop operations separately, etc. by
dividing them into parts. The program both saves time and reduces the workload in the
creation process of games by using the power of probability. It seems easier to simulate hyper
casual style games. It takes some time to learn the program and to set up the algorithm
correctly. It's like learning a new language. There are many ways to do an operation, but I
think it is up to the user to experiment and find the optimum operation. The program is based
on the Monte Carlo method. This method uses a random sampling process to make numerical
estimates of unknown parameters (I pulled it from the Machination documentation, if you are
interested, here is a link: https://en.wikipedia.org/wiki/Monte_Carlo_method). In short, they
say that they offer us the randomness of real life. The more chances there are to guess, the
closer the game you create will be to the real statistical value. For 10 different users or for 50,
we can find an answer to the question of how much average Xp they will have when they pass
10 levels in the game for example.
After we master the program a bit more, we plan to use it while designing our own
game's shop system. I'm leaving the link below in case you want to add it to the whislist list.
(https://store.steampowered.com/app/2518280/The_Arena_Pit/)
If we build the right algorithm, I think we can simulate the economy in the game close
to 80%.
I hope the resource was useful. I think the more simulations we build, the more we can
specialize in the program. The brains who made the program really need to be congratulated. I
think it will be a great contribution to the game industry.

You might also like