# The principle of "anchors" in the game balance

We are talking about games that need a random, but controlled balance of some elements that very often appear on the screen and have both positive and negative properties. For example, take the game Doodle Jump . It has several types of steps - some help me jump higher - others may make it difficult to move the character up or even kill him. At first the game is very simple - there are a lot of steps, there are much more positive ones than negative ones, everything seems easy. But after a while the gameplay becomes more complicated - there are more negatives, the steps themselves are few, they are scattered across the screen.

I’ll try to explain how to achieve such a result in a very interesting way - * using the anchor method *.

And so: let's say we have 3 positive steps and 6 negative ones. We need to assign weight to each step. Positive will be with a plus sign, negative with a minus sign. At the same time, the weight of the positive should be significantly greater if we want them to appear less often than negative, or vice versa if we want to achieve the opposite result.
PositiveValueNegativeValue
Positive 1+100Negative 1-ten
Positive 2+300Negative 2-50
Positive 3+80Negative 3-20
Negative 4-eight
Negative 5-50
Negative 6-15

Positive and negative steps are essentially one type of step - one that obeys the * anchor rule *. Neutral steps (standard) and killer steps must be taken out of this formula. They can be set either with an absolute value (if you know how many steps can be in a game or on a level), or as a percentage.

##### Now about the anchor itself.

It should have a maximum and minimum value (or arithmetic mean). For our example, you can use this:
• MAX: 100 MIN: 20
• MAX: 40 MIN: -20
• MAX: 0 MIN: -80

What will come of it? The minimum and maximum values ​​do not mean that steps beyond this range will not appear at all. This means that the anchor will try to align the appearance of all steps between the maximum and minimum values. When generating a level, we have the sum of the weights of the steps on the platform (or on one screen) and the current value of the anchor. Here's what it looks like:

The current and absolute value of the anchor

If the current value of the anchor falls into the range between MAX and MIN, any steps will be generated. With their weight, they move the anchor in some direction - he opposes and tries to shift the balance back in the next step. In our example, this means that when several positive steps were generated that have significantly more weight than negative steps, the anchor will shift to the plus side. In order to align this value, steps with a negative value will be generated next, in order to align the position of the armature until it again falls into the MAX-MIN range.

If we need - the value of the anchor can be shifted in any direction since we need it. It doesn’t matter if we generate steps for an endless game or within a level. It all depends on what kind of balance we want to achieve. You also need to carefully approach the setting of the weights by the steps themselves - since it is from their ratio that the anchor will either deviate calmly or with significant jumps to one side and then align itself with the opposite value.

The behavior of the anchor also depends on the width of the range of the anchor. If you set a very wide range, the absolute value will constantly fall into it and there will be more randomness during generation. If the range is set to be very narrow - the value will skip it to plus or minus - it will be difficult to achieve a controlled result.

In any case, all balance values ​​need to be selected to fit your needs. But having such an instrument and an ultimate goal is very easy to achieve.