Perhaps some of you are reminded of our GDC Europe 2012 report, where Stefan informed about an interesting modeling tool for games systems by Joris Dormans, called the Machinations Tool. However, the background of all this is much more than it seems, and therefore we have decided to prepare a tutorial in which we show you not only how to work with this wonderful tool, but we will also introduce you to the ideas and ideology of the framework on which it is built.

And we will go much further. Machinations Framework has much to offer and it would be a pity to not use it. In the coming days, you can move forward this four-part tutorial, but we will continue with a number of themes from Machinations. So I'm not going to delay you anymore, and we'll start on it.

Machinations Framework

Joris Dormans, holder of a doctoral and master's degree in game design and cultural studies, has been researching gaming theory for a number of years, especially by analyzing and formalizing game mechanics and patterns. Initial Machinations came into being as part of his dissertation, but the framework has now reached version 4.01 and is continually evolving.

The basic idea behind the framework is to reveal and analyze recurring patterns on the background of game mechanics. For this purpose a certain formalization was needed, and therefore Machinations became the language. This language allows at different levels of abstraction to express game mechanics, the relationships between them and their subsequent analysis. Indirectly, he provided a wonderful tool for game designers to balance and prototype their games. As the author himself claims, he can not model everything (at least for the time being), especially large and too complex systems.

The Machinations Tool itself is an automated "language compiler" that puts the entire structure into operation and enables real-time testing and testing of a formalized model. What can you imagine under such a language? You do not have to worry, you do not expect any programming. Language is the only way to keep information in this case. For this purpose the elements of language, such as Warehouse ( Pools ), Gates (Gates) registers (Registers)  and many others whose characteristics and behavior gradually show. For a better idea of ​​how Machinations works, we can look at the following diagram:

At the top you see "notions on the structure of games," or notes about game structure. These notes are the basis for building a model of game mechanics (codified by) and creating a diagram. These patterns show recurrent patterns that occur in a much less varied form across a wide range of games, and can be implemented and analyzed using Machinations Tool. Both notes and recurring patterns and data generated by the tool create background material for the design of specific games, resulting in the creation of new game mechanics, and the circle closes.

In our tutorial we will focus on the "diagrams" and "tool" fields. The tool itself can be found on Joris Dormanse or on the official wiki  (or at the end of the article). Let's now say something about the fundamental element on which the whole framework is built - resources.

Resources

Resources are the basic element of Machinations and basically all game systems. Whether it's the virtual money the player owns, the number of lives, the raw materials, the cards in the pack, the number of enemies, or the number of occupied territories. In principle, the game source could be characterized as:

Variable and quantifiable game element      

Sources can flow, rise and extinguish in millions of ways, making each game unique. The Machinations Framework defines a number of elements for the purpose of expressing a resource flow model. Consider, for example, the following simple card game model.


Download drawcards.xml

This model simulates the shuffling of the card and the subsequent distribution of the seven card players. For the simplicity of the model, however, we are only focusing on two basic types of cards - blue and red. As you can see, several levels of abstraction can be modeled. For example, if we needed to target a particular type of card, we would instead have four colors instead of two, and so on.

On the left is the so-called trigger. By clicking on it, there are always generated 26 cards of each color through the producer (triangle) that are placed together in one card pack. Clicking the "draw cards" button will randomly select the seven cards from the deck that are moved to the player's hand.

It is clear that the sources are here in this case two - blue or red card. They move into a joint package and then into the hands of the player, thus moving resources. Similarly, we could build the whole card game model, such as black-jack. The purpose of this model is only to show the basic principle on which the framework is built.

General settings

If you do not have any other element selected in the Machinations Tool, the diagram setting is available in the right column. Here are some basic features of the model.

Time mode

The time mode of the model determines how resources are redistributed. Because some elements may be automatic, other interactive and other passive (see below), it is necessary to specify how they behave. Three kinds of time modes are available:

  • Synchronous mode - In synchronous mode, all actions take place in one time tick, the length of which is specified by the interval . Interactive and passive elements can only perform one action at a time, and this will always be done at the end.
  • Asynchronous mode - Asynchronous mode only performs automatic element actions in a given time interval . Interactive and passive elements perform their action immediately.
  • Tracing mode - Traversing mode is a special case of asynchronous mode, where the number of action points is determined instead of the interval, and each interactive element is assigned its price for use. Once all the action points have been exhausted for that move, the action of all the automatic elements starts and a new round begins.

Distribution mode

The distribution mode determines how resources are being moved. Machinations Tool supports two ways of distribution:

  • Fixed Speed - All sources are moving at the same speed, moving them by animation. The speed of the move is determined by the amount of resources being moved and the time interval always so that all the resources are moved within one time interval. In the case of synchronous time mode, it does not matter in the distribution mode. However, in asynchronous mode, this distribution mode can affect the model's result and therefore may not always be desirable.
  • Instant - all resources are moved immediately over the time interval without animation and delay. Therefore, in this case, asynchronous mode does not cause raw material delays due to animation.

Symbols

Machinations Tool currently uses 4 symbols:

Dice (D) - coincidence
Skill (S) - player's manual ability to control the game
Multiplayer (M) - Seminar influence on other players
Strategy (ST) - Semantic impact on gameplay by the strategy

These symbols can be used instead of the source stream label (see below) simply by putting the letter in brackets as the label value (be careful it must be large). This automatically replaces the text.

In the diagram settings, you will find four items with the names of these symbols (Dice, Skill, Multiplayer, Stragegy). Here you can define their meaning. This can be any mathematical formula, but mostly using randomness.

To express an accident, Machinations uses the xDy format , where x defines the coefficient and y the number of elements from which it is "drawn". Thus, for example, 2D6 means adding the results of two 6-sided dice and thus will produce a number between 2 and 12. However, more complex formulas such as (2D11 + 8) * 2D8 can be used.

 In each time interval, this formula is evaluated and wherever the symbol is used, the resulting value of this formula is used.

Color Coding

Color coding is a powerful Machinations Tool feature for resolving resource types . If it is specified for a source color, then only elements of the same color chart can operate with these sources. We will look at specific uses later. For now, we need to know this.

You can also specify other things like name, author, and dimensions in the chart settings . However, they are so obvious that we will not stay with them anymore and throw them straight to the specific elements of Machinations framework.

Resource Connection

The source stream determines the amount of feed flows from one element to the other. For example, the fact that the player receives seven cards at the beginning determines the source stream. Their charm, however, lies in the fact that ways to define the amount of these resources is a stack.

This amount can be defined using a label that can be the following:

Type Value Example Effect
Empty Equal to 1
Value x 0, 2, 9, 0.5, 1.8 Current flows through a quantity equal to the value. Decimal numbers transfer their decimal part to the next wave.
Random value Dx, yDx, x% D9, 2D11, 75%, 180% At each time interval, a random value that is a current value for a given interval is evaluated. Values ​​greater than 100% are equal to 1 raw material for every 100% + chance of the remaining probability.
Fragments x / y ¼, 2/2, D3 / 2, D3 / (D8 + 1) It determines how many intervals the release of one raw material takes. In the case of random values, the new value is generated whenever the current number of intervals is reached.
All all all At each shot, he will send all the raw materials he currently has.
Random choose drawx draw1, draw5, draw8 Raw materials taken from the source are not taken in the same order as the source they came from, but in random order.

Notice the draw type and remember our first example of a card game. Here the draw was used to indicate a "shuffled" package that returns cards of certain colors randomly, not in a strictly ordered order.

Also remember the above-mentioned symbols. You can also place symbolic symbols (D, S, M, ST) on the label. At that time, the label is replaced by the expression specified in the chart settings. This way, you can define a player's strategy using one formula, and use a placeholder in appropriate places. Once you want to test a different strategy, just change the formula and run a new test.

A special case of a current is the situation when its source element is gate. Here the rules for the label format vary, but we'll show them when we talk about the gates. In addition to the label, the current can be defined by other settings:

  • Color - The visual color of the label. Suitable for differentiation and important when using color coding (see Color Coding).
  • Thickness - line thickness in the diagram. They are only for visual differentiation.
  • Minimum / Maximum Value - Specifies the maximum and minimum possible label values. This affects all the values ​​generated by random expressions, as well as adjustments to values ​​using state modifiers (see below). Once the value is above or below the limit, it is immediately rounded to the maximum / minimum value.

With the streams you meet across the tutorial and are virtually inevitable part of each model. We will return to them often. But the same inevitable element is the warehouse.

Pool (Stock)

One of the basic elements of Machinations is the so-called warehouse, which is represented as a circle and represents the "holder" of resources. In the case of game mechanics, it can be a player on his own, but also virtual elements such as an enemy, an NPC, a bank or even highly abstract elements such as a coincidence or gaming world.

The purpose of the warehouse is to only hold, retrieve and transfer resources under the conditions specified by the link (see below). In the above model we had two warehouses.  One for a deck of cards and one for cards in the hands of the player.

Each store can be one of 4 types:

Passive - Serves only as a resource holder. It will never invoke the action of relocating only if triggered by the trigger (see below)
Interactive - Performs action only if the player clicks on it or is called using the AI script
Automatic - Performs an action at any time interval
OnStart - Performs only one action at startup, then behaves the same as passive.

Each store can be in one of 4 ways to determine what happens when a fire occurs :

  • Pull any - attempts to stretch the number of raw materials defined by the current through all input streams regardless of their availability.
  • Pull all - always pulls the maximum number of raw materials equal to the amount defined by the input streams, and only if all the raw materials from all the streams are available.
  • Push Any will always fire the maximum number of raw materials to the output streams regardless of their availability. If there is not enough raw material available, the evenly distributed raw materials are divided into all output streams, so that distribution is as uniform as possible.
  • Push all - If the action occurs, the maximum possible number of raw materials will always be equal to the amount defined by the input streams, and only when these raw materials are available.

Among other things, each warehouse also defines:

  • Color - element color. It serves for visual differentiation of the model parts and for color coding purposes. Subsequently connected elements automatically take the source color.
  • Thickness - the thickness of the line around the store. All subsequently connected elements automatically take the thickness of the feed line.
  • Label - Label. It is used for descriptive purposes, and the label is also referenced in scripts.
  • Actions - The number of actions that the interactive warehouse action in turn-based mode.
  • Resources - the color or type of raw material that the warehouse contains at the beginning of the diagram.
  • Number - number of raw materials in stock at the beginning of the diagram.
  • Max - the maximum number of raw materials in the warehouse. If a pull is attempted or a raw material is sent to it, it is discarded if the maximum limit is reached. If the value is -1, no limit is defined.
  • Display limit - the number of raw materials in which the display changes from symbolic to numeric. The maximum possible value is 25.

Let's look at the following diagram:

Download resourceManagement.xml

At first glance, the model may seem complicated, but focus only on the blue section in the "Player" area for now. The right part only simulates very simple artificial intelligence and we will return to it later.

This is a strategy game where your goal is to reach a population of 30 people before your opponent. You have money that you get from a bank on a regular basis at every turn. You can spend either for economics, research, or for resources. Each area has a different amount and a different number of action points. Once you have enough points in each area, these points will turn into a higher population. If you press the "Run" button, you can try the whole model in real-time by clicking on the two-element elements (interactive pool). By clicking, you always spend the money that you have with a given number of action points (number in brackets). If you want, you can skip your move by clicking "Skip Turn".

Now try the following:

  • Play the model and notice as much as possible. What resources flow and where? Why? Where is their quantity defined? If you do not know, go on. Gradually, we'll show up later.
  • Now look at the graph again and try to identify as many Machinations as possible and all their properties. Concentrate only on the blue area of ​​the player.

Succeeded? Great! He would probably never have been a great blockbuster from such a model, but he has allowed us to illustrate almost everything we have already shown. If you managed to get everything right, congratulations. If not, here is a more detailed description of the diagram:

First, note the warehouse number 100 and all its associated symbols. This warehouse is practically extra and the initial 100 raw materials could contain the bank. However, it allowed us to illustrate one of the four basic types: OnStart (you know it by the symbol s).

Number 100 means the amount of raw materials in the store, and the & sign means it is in "push all" mode. Normally, this mode is called "p &" (see the bank store), but only output streams here, so the letter p is omitted.

These outflow streams are directed to three other warehouses - the player's money, the cash machine and the bank. Number 2 means that 2 raw materials flow. All means sending out the rest. When the diagram starts, the OnStart warehouse action will be called up, which will send all its raw materials up to the maximum defined by the output streams (2 + 2 + all, ie all).

Bonus Question: Is this store in push all mode?

 Answer: Not. Likewise, push mode can be any, because it always has enough raw material to satisfy all its output streams, or the result will be the same.

Now look at the bank. The asterisk stands for the basic type of automatic, ie, in each time interval (tik or tire mode wheel), causes the action specified by its mode. This is "push all" (note that the letter p is not omitted here). In each round, the bank then releases 2 raw materials to each player, and only if he has enough points for both (push all).

Bonus Question: What happens when push is in any mode?

Answer: In this case, nothing serious, because 100 raw materials is a number divisible by 4 and no other resource store does not collect, so it always comes out to everyone. But if the initial source was eg 101, the behavior would be different.

We proceed further. In a row, the store is marked as "money". This shows us the basic type of "passive". He does nothing, he only holds, accepts, and handles the raw materials. At first glance, it does not seem to matter in his fashion, for he will never call for himself. Nevertheless, it is necessary to think of so-called triggers that can externally trigger action and passive warehouses (for example, PCs are passive for Economy, Research and Resources, but can be triggered by a random trigger).

We already know who receives the raw material from the store (bank). Let's take a look at who is taking them. Economy, Research, Resources and Skip Turn warehouses are the last of four types: interactive . They will trigger your action if the player (or script defined by AI) clicks on them. When a turn-based time mode is set, it is possible to set the number of action points required by their actions.

Let's first take the first three. All are in pull all mode (marked with "&"). If the player clicks on them, they try to get the number of raw materials equal to the amount defined by their input streams. Each of them has only one input stream, that is, the quantity is equal to their label. For example, Economy only requires 1 raw material, Research 3 and Resources 5. If there is not enough raw material in the bank, nothing happens and the player only wins the action points. If the raw material is enough, it will spend the action points and move the raw materials from the bank to the appropriate warehouse.

It can happen that the player does not have enough resources in the bank to spend, or does not want to spend, and still has action points left. Therefore, there is a Skip Turn box that does nothing and only spends enough points to end the player's move.

Bonus Question: What if the maximum value of Money flowing from Money Ware to Resource 3 warehouse is smaller than the label?

Answer: Maximum and minimum values ​​always exceed the label value. This means that if there is no label within the interval, either the maximum or minimum value applies. Since the label is greater than the maximum, the value of the current would become the number 3.

We have only the last stock - Population. This is also automatic, but in a different mode - pull all. This means that every move attempts to pull all the raw materials from all inputs - Economy (5 raw materials), Research (2 raw materials) and Resources (1 raw material). If something is not enough, nothing happens. And so the basic mechanics of the game is formed - if you split the raw materials poorly or inefficiently, you will not have enough raw material to reach a 30-member population, or you will overtake your computer.

Nevertheless, it is not a game like a kind of logical puzzle. It contains one dominant strategy, which in most cases leads to victory. Once it's revealed, the game is no longer fun. Maybe we could add some coincidence or more to link the links between the elements. Maybe we could add more dynamic elements that allow us to multiply or divide raw materials or turn them into other types. Or, we could develop a more sophisticated revenue and expenditure mechanism. All Machinations can do, and as you will see at the end of the tutorial, it will allow us to model a fairly good gaming system.

But that's all for today. Next time we look at the feedback loop mechanism and explore the other 3 Machinations elements - status modifier, gateway and register.

:)

Original text