Well Thought Thoughts

A Well Done Games Blog

How we used Machinations to simulate the economy of IndusTree

A journey in systems design

by Michael Leibner

Economies in video games, especially in strategy games, can get pretty complicated and hard to balance. If you think about the multitude of systems that are an integral part of a strategy game, it’s easy to shy away from developing one yourself. We are currently tackling this problem in the development of our tree management simulation game IndusTree and are looking for ways to simplify the balancing process and conceptualize the systems we need. For this reason, we tried out Machinations. In the following blog post, I want to give you an insight into how Machinations works and how I used it to map out our game concept.

What is Machinations and how does it work?

At its base, Machinations is a graphical framework for visualizing game economies. It was conceptualized by Joris Dormans and saw the light of day through the book Game Mechanics: Advanced Game Design by Dormans and Ernest Adams. But from there it evolved into a graphical online application and began to professionalize itself as a tool for game designers and other system-interested people.

In the online version of Machinations you can build, show or simulate game systems and game economies. It uses nodes with different kinds of properties that you can combine in multiple ways to simulate income and outcome, for example. You can also use it to analyze different runs of your program, where you can see how each of the games resources will be affected by changes in the system.

But how does Machinations work exactly? You are provided with a wide range of tools and so-called building blocks to simulate different states that help you build systems across various game genres.

You can, for example, use it to simulate a score calculation for Super Mario Bros 1, lay the groundwork for a 4X strategy game, design a loot system for your role-playing game or, in our case, try to map out an economy system for our tree-building game.

Automated Score Calculation for Super Mario Bros 1

The Building Blocks of Machinations

Starting a new project, you get a blank canvas and an array of the aforementioned building blocks.

First, you have the Source, which can generate a resource. If you want to develop a game with a currency like gold or coins, this currency would be a resource. Also, things like time, health, damage, items, and anything you can think of can be a resource.


Next, you have a Pool. Pools can store the resources that Sources generate. In the example with the currency, a Pool would function as a pouch or a one-slot inventory. So, if we kill something and collect the currency, this will go into our pouch (pool). If our workers in a strategy game are mining gold (currency), this will also go into our pool. With that currency in our pool, we can build or pay for things.


Then, we need a Drain. Drains, as the name suggests, simply drain the resource. So, if you buy something from a merchant, the money will go to him, who could function as a drain. The money is then out of the game, and we get something in return. In the case of a strategy game, we can use the gold to buy new soldiers. We get the soldiers, and the money goes into the drain.


If you want to introduce randomness or choice into your game, you’ll want to use Gates. Gates can distribute resources to different pools. So, you can use them, for example, to simulate item drops. You can give Gates deterministic or random values for how they should distribute resources. To make it understandable, you could design a system that drops 2 blue items and one green when you kill an enemy. That would be deterministic. Random would be that you have a 66% chance to get a blue item and a 33% chance to get a green. Gates can also have multiple use cases beyond that.


We can also use a building block called Converters. These can, as the name suggests, convert resources into another. If you got your currency from mining gold, you might want to convert the gold into coins or into gold ingots. Then, you would use converters.


Another building block is the Trader. We talked about using a drain for the money pouch of a merchant. We could also use a trader instead. This will give the merchant a limited amount of money, and we could also sell items to him unless he runs out of money. So, a trader can swap resources between two pools.


The last standard block is the Delay. With a delay, you can delay the transport of resources. You can use it to simulate build time, travel time, or manufacturing time. The process of converting our gold into coins can, for example, take time, so we can use a delay for that matter.


For all the building blocks, you need Connections to connect them to each other. Simple as that, these connections can also have different properties to transform how many resources get transported to the next one.

On top of that, there are different Activation States for the building blocks. That means that they can be triggered in different ways. Our miners mine the gold automatically, while a transaction to buy soldiers for the gold is interactive. We decide when to buy them.

In addition to the mentioned stuff, Machinations has more to offer that would go beyond the scope of this article.

Visualisation of how it works

You are probably very confused now, but don’t worry. I was too. After a while of trial and error, I figured some things out and learned how to work the tools Machinations gives to you. I want to explain a little bit about how it practically works with an example.

Cities generating Gold

Building an army

In this picture, taken from one of the videos on the official Machinations YouTube Channel, you can see the beginning of a strategy game system.

At the start, in the upper left corner, is an interactive Source. If you interact with it, the source sends one resource over the connection to the Pool on the right. This Pool represents the number of cities you currently own. The State Connection from the pool to the connection below shows a “+500.” This means that for each resource in the Pool above, 500 gets added to the connection below. So, for each city you build or own, the connection below gets added 500. This is important because the 500 represents the income your cities generate.

The second automatic Source below the first one generates, as the name suggests, automatically the amount shown in the connection next to the source. The source sends the resources via connection to the Pool on the right, the Gold-Pool. To sum this part up, each city generates 500 gold. By clicking on the interactive Source, you build a city, which adds 500 gold to your income, which is generated by the automatic resource. The gold is stored in the Gold-Pool.

Building an Army

If you look at the connection from the Gold-Pool to the right, you can see 1K written on it. This means that 1000 gold is needed to use this connection. It is connected to an Automatic Push and Pull any Converter, which converts the 1000 gold into a +1 for the Army-Size-Pool. So, for 1000 gold, I get one soldier for my army. The state connection going diagonally left from the Army-Pool shows a +50. This means that the normal connection the state connection is linked to is increased by 50. At the moment, the connection shows a 400. That is because we already have 8 soldiers in our Army-Size-Pool. For each soldier, there is an upkeep cost of +50, so 8 times 50, and we get the 400. On top of the 400, we will pay 50 more for the recently bought soldier.

Cities generate gold, which is needed to buy soldiers and pay their upkeep.

I hope this little example shows you how Machinations works. If you would like to see how to expand this little example, then I can recommend this video from the Machinations YouTube Channel. In 90 minutes, they create a much more complex and interesting system out of this little example I just explained to you.

How I used Machinations to model our game IndusTree

Initially, I wanted to build a fundamental game system for our tree-management simulation game, Industree. That’s why I learned Machinations in the first place.

Firstly, I wanted to recreate the individual resources. We start with the primary resources Time, Light, Water, Glucose, Minerals, ATP and secondary resources Carbon Dioxide, Oxygen, and Temperature.

Time was the first and most important one. Machinations works with ticks. So, every second, one step gets simulated or progressed. I knew how we wanted to structure our time and could, with a little bit of practice, recreate how our time system could work.

Our time is linked to our light. Our day is 12 instead of 24 hours long, roughly half of the day the sun would shine. So, every 1 to 6 hours, the light resource was triggered and turned on the photosynthesis. The latter is important for our glucose resource.

Now it gets a little complicated and biological. Glucose is built out of 6 parts of Carbon Dioxide and 6 parts of Water, and besides Glucose, 6 units of Oxygen are an additional end product. Carbon Dioxide (CO2) is abundant in our air. Water is generated by our tree, which sucks in water through its roots (we’ll come back to that later). Photosynthesis takes place in the leaves of the tree. Both water and CO2 go into the Converter, which sends the resources with a delay to the gate, which distributes the end products to the corresponding resource pools. The amounts of how much gets transferred via the connections are 0 because these are linked to how many leaves are built. There is a whole sub-system for building Tree parts. Tree parts are built out of the three main resources: water, glucose, and minerals. If you build a leaf, the glucose production (photosynthesis) goes up, and so do the costs for producing them.

Now we know how Time, Light, and Glucose roughly work. Water is linked to the roots, as well as minerals. Minerals get sucked into the roots too, through the water. So, building more roots lets the tree suck in more water and, with it, minerals. As easily as that, Water and Mineral production are covered. Besides producing, the tree also uses the resources to maintain its parts. That’s why there needs to be a subsystem that tracks how many Tree parts are built. With that in mind, you can calculate the upkeep for each resource. Each Tree part has an equal upkeep.

So, for every Tree part, 3 Water, 3 Minerals, and 0.25 Glucose (and also 0.33 ATP) are needed every tick to maintain itself. The upkeep is then deducted from the income of resources, so you get the true value of what you are getting.

The last main resource is ATP, which stands for Adenosine triphosphate, which is simply put: Energy. It gets produced out of Glucose through a process called Cellular Respiration. Like the other resources, ATP has an upkeep. Its main function is maintaining the tree with energy.

The last resource that is important in the grand scheme of things but not in the game is temperature. We divided the year into 4 seasons. The coldest season is winter, and the hottest season is summer. The idea was to increase the upkeep of water in the summer season and at first stop the generation of water and also minerals. But in research, we found out that most of the water supplies come from winter rain and that the roots don’t freeze even when it’s way below 0 degrees Celsius. The higher upkeep didn’t get implemented, and Winter was not correct, so I turned it off.

The last system we integrated was the Upgrade System. Comparable to the rising upkeep of the Army salary in the example above, Upgrades get more and more expensive as the upgrade level gets higher. So, on top of the regular cost, which is equal for all Tree parts, you need to pay a higher price for higher upgrades.

The system was not finalized, so it only multiplied the income and production by two.

Problems, Tips and Tricks

The more systems we built, the better we got at building them, but with higher complexity and more systems interacting with each other, it cost us more time. For each system, we needed to update the rest and connect them to each other. Keeping track of things got harder, and we decided to stop prototyping in Machinations and move on with, in our minds, more productive things.

Getting into Machinations and using it is fun, and there are plenty of great tutorials and rebuilds from the creators of Machinations. Watching them rebuild familiar systems helps a lot to understand certain aspects, and you can use many parts for your own systems. BUT: The basic systems are explained very well and thoroughly, but later in the very first tutorial, they rush through very important parts of Machinations that I could not fully grasp. I think that many systems I have created can be built in an easier way if you use the right building block and the right state connections. The more you use it, the more you will understand the systems and how to use them. In the beginning, it is better to build more, smaller systems than one big one.


Machinations is a great tool for prototyping and especially balancing. The latter we couldn’t use fully but may test it in the future. I hope we could give you an insight into how Machinations works and in what cases it can help you conceptualise, build and balance your systems. Furthermore we hope that you at least generally understood our system and that you had an idea of how we built it in machinations. Check out Machinations for yourself. There is a free trial at the beginning, so you can decide if it is something worth your money and time.

Thank you for reading and don't forget to subscribe to our Twitter for further updates on IndusTree.

by Michael Leibner