Balanced Games
Can mathematics design the perfect game map?
Some of my most frequent clients are game startups. On one occasion, the task I was asked to solve was to create a balanced game level map. This meant that every level had to allow transitions to the same number of other levels and, likewise, had to be reachable from the same number of other levels. An example of such a 12-level game map is shown below.
Map of a 2-output 12-level balanced game.
As we can see, in this game every level has exactly two outgoing and two incoming transitions, so we will call it a balanced 2-output 12-level game. For example, from level 1 the player can move to levels 2 and 4, while level 1 itself can be reached from levels 10 and 12. The transitions are shown in different colors purely for clarity, making it easy to count how many choices the player is offered at each step (the red and blue arrows even create an association with the pills from The Matrix).

The difficulty in creating balanced maps is not in assigning the required number of outgoing arrows to each level, but in ensuring that, in the end, every level also receives the same number of incoming arrows. In the next map, for example, each level has two outgoing arrows, but the numbers of incoming arrows are not the same. In particular, levels 4 and 6 each have three incoming arrows, while level 5 has none at all. As a result, level 5 cannot be reached from any other level, meaning that the only way to include it in the game is to make it the starting level.
An unbalanced game map: although every level has two outgoing transitions, the numbers of incoming transitions differ from one level to another.
This problem led to the need for an algorithm that could automatically generate a large number of balanced maps, allowing the client to choose the most interesting one.

The idea that came to me was to use the Cayley graphs of finite groups as balanced game maps. I will not go into the mathematical details here, mentioning only that Cayley graphs are always balanced maps. Moreover, they satisfy the property of strong connectivity: from any level, it is possible to reach any other level by following the arrows. In fact, the balanced map shown at the beginning is the Cayley graph Cay(C12, {1,3}).

Below are the maps of a balanced 2-output 24-level game and a balanced 3-output 12-level game, which are the Cayley graphs Cay(S4, {2314,4123}) and Cay(C6⨁C2, {10,20,21}), respectively (whatever that may mean).
The map of a balanced 2-output 24-level game, which is the Cayley graph Cay(S4, {2314,4123}).
The map of a balanced 3-output 12-level game, which is the Cayley graph Cay(C6⨁C2, {10,20,21}).
The last map is particularly interesting because, instead of two choices, the player is offered three possible actions at every step, corresponding to the outgoing red, blue, and green arrows.

To summarize, Cayley graphs provide a convenient tool for generating a wide variety of balanced game maps, including highly complex ones. More broadly, mathematics remains the most effective tool for solving clearly defined problems - including those faced by startups.
Balanced Games
Can mathematics design the perfect game?
Some of my most frequent clients are game startups. On one occasion, the task I was asked to solve was to create a balanced game level map. This meant that every level had to allow transitions to the same number of other levels and, likewise, had to be reachable from the same number of other levels. An example of such a 12-level game map is shown below.
As we can see, in this game every level has exactly two outgoing and two incoming transitions, so we will call it a balanced 12-level game with two outputs. For example, from level 1 the player can move to levels 2 and 4, while level 1 itself can be reached from levels 10 and 12. The transitions are shown in different colors purely for clarity, making it easy to count how many choices the player is offered at each step (the red and blue arrows even create an association with the pills from The Matrix).

The difficulty in creating balanced maps is not in assigning the required number of outgoing arrows to each level, but in ensuring that, in the end, every level also receives the same number of incoming arrows. In the next map, for example, each level has two outgoing arrows, but the numbers of incoming arrows are not the same. In particular, levels 4 and 6 each have three incoming arrows, while level 5 has none at all. As a result, level 5 cannot be reached from any other level, meaning that the only way to include it in the game is to make it the starting level.
This problem led to the need for an algorithm that could automatically generate a large number of balanced maps, allowing the client to choose the most interesting one.

The idea that came to me was to use the Cayley graphs of finite groups as balanced game maps. I will not go into the mathematical details here, mentioning only that Cayley graphs are always balanced maps. Moreover, they satisfy the property of strong connectivity: from any level, it is possible to reach any other level by following the arrows. In fact, the balanced map shown at the beginning is the Cayley graph Cay(C12, {1,3}).

Below are the maps of a balanced 24-level game with two outputs and a balanced 12-level game with three outputs, which are the Cayley graphs Cay(S4, {2314,4123}) and Cay(C6⨁C2, {10,20,21}), respectively (whatever that may mean).
The last map is particularly interesting because, instead of two choices, the player is offered three possible actions at every step, corresponding to the outgoing red, blue, and green arrows.

To summarize, Cayley graphs provide a convenient tool for generating a wide variety of balanced game maps, including highly complex ones. More broadly, mathematics remains the most effective tool for solving clearly defined problems - including those faced by startups.
Made on
Tilda