Thanks to a feature on Gamasutra by Ernest Adams and Joris Dormans and their book Game Mechanics: Advanced Game Design (Voices That Matter) I discovered the fascinating world of Machinations diagrams. This tool really blew my mind because it provides game designers with a powerful new weapon of choice for analysing, prototyping, communicating and testing game mechanics without having to write a single line of code. That's great because I am not a coder. Even better: I many cases I do not need a coder anymore for a first game mechanic prototype.
I had a first go with Machinations and modelled a simple resource management game. The basic action is to claim tiles of an imaginative game map in order to gather the resources you need to grow your population, food, building materials, tax income and military strength. The aim of the game is to destroy all of your enemy's defence bots, while preventing the enemy from destroying yours. It's still pretty rough around the edges and I am sure many things could be done in a more elegant way. However, it helped me to learn how the single Machinations elements work together.
How to play:
I am going to describe the diagram step by step and also explain the meaning of the different elements I used.
Let's start with the most essential action of the game: claiming tiles to increase your resource income. Each tile contains four types of resources:
Each tile also contains a bad surprise: evil monkeys! More about them later. The "claim tile" converter element in the centre of the diagram is your starting point. It's the triangle pointing right with the vertical line running through it. Elements with a double line are interactive. Clicking on it triggers multiple events:
Let's move on and see what happens with the four basic resources.
When you click the "refurbish" converter credits, building materials and derelict houses are pulled from their resource pools. Five derelict houses are then converted into a random number of refurbished ones. The resource connection is labelled "3D2" (the sum of three rolls with a two-sided dice). This let's the converter push a between three and six resources to the "refurbished" pool. The refurbish converter's pull mode has also been set to pull all. Since the converter has three inputs (from the credits, houses and building materials pools) it is important that it only starts to pull resources when all inputs can provide the required number of resources. Lovely empty houses now gather inside the "refurbished" pool. From there they move through another converter into the population pool. People are moving into their new homes. The resource connection between the "refurbished" pool and the "population growth" converter is labeled with "1/3". This means that the "population growth" converter pulls one resource every three intervals. It then turns one refurbished house into two people, or rather two people move into one house. The population pool itself has multiple effects on other parts of the game system:
Food is a renewable resource that grows on fields and has to be harvested by farms. If there is no food your population neither moves into refurbished houses nor does it put credits into your pockets. In order to build a farm you need a fixed number of fields, building materials and credits. If you have all the required resources the "build farm" converter turns the incoming resources into one farm. You need to build at least one farm to meet the condition stated on the activator that connects the farms pool with the "food" source. The food source is marked with an asterisk, which means that its activation mode is set to automatic. Once activated resources move automatically to the "food" pool. New food is produced every three intervals in quantities between five and eight. The dotted green label modifier that runs from the "farms" pool to the resource connection increases the food output by two per farm. If the number of resources inside the "food" pool is greater than zero the outgoing state connection activates the "population growth" converter and also the "tax income" source. Furthermore, the "food" pool is connected to the "monkeys steal food" drain that is activated as soon as the number of resources inside the "evil monkeys" pool is greater than zero. If you do not keep those evil monkeys under control they will severely diminish your food resources.
Before you can build up your army of attack and defence bots to deal with the evil monkeys and the ever growing threat of an enemy attack you need enough building materials to create a factory. As you already know you need materials for the other buildings as well. So keep the wood flowing in by claiming new tiles! There are no elements in the wood mechanic that I haven't described before, so I keep it short and just summarise the mechanic itself. Each claimed tile contains a random amount of wood. In order to turn the wood into building materials you need at least one saw mill. Saw mills cost credits and wood to build. The more saw mills you build, the more wood is turned into building materials every five intervals. This makes time much more important! Five intervals (= five seconds) can be a long time when you urgently need to refurbish houses to increase your tax income in order to increase your military strength. I also added a converter that turns one wood resource into two building materials. For example, this converter could later be used to implement upgrades that make saw mills work more efficiently and let them produce more building materials per wood resource.
Factories produce attack and defence bots. Building factories is straight forward but expensive: besides a lot of credits you need iron and building materials. Once you have built your first factory you can start creating up your bot army. The "iron" pool provides resources for both building factories and attack/defence bots. The interactive "build factory" converter turns five iron resources and 200 credits into one factory. The "factories" pool activates the "build attack bots" and "build defence bots" converter as soon as you have built your first factory. Each factory doubles the number of bots produced per click and also the rate at which they are produced. I use a "queue" pool to delay the actual delivery of the bots (I have not figured out yet how to use the delay element properly). The queue pools' activation modes are set to automatic (*) and their pull modes are set to push any (P). Both the defence bots and attack bots pools are connected to an End Condition: the execution of the diagram stops when the number of resources in any your bot pools equals zero. In that case you have lost the game.
The battle feature is very simple but serves the purpose to add win/lose conditions to the game: you win if you can destroy all of the enemy's defence bots. You lose if the enemy manages to destroy all of your defence bots or if you run out of attack bots while attacking either the evil monkeys or the enemy defence bots.
Below the diagram's centre you see two interactive gate elements. One is labelled attack evil monkeys, the other attack enemy. You want to deal with the evil monkeys early on in the game, because they continuously steal food and can disrupt the flow of incoming tax credits and population growth. Clicking on the attack evil monkeys element triggers the following events:
Attacking the enemy or defending against his attacks has an additional condition attached to it: The label of the red activator that runs from the attack bots pool towards the interactive attack enemy gate sets the condition under which the gate is activated. You need more than 20 attack bots to be able to attack the enemy. However, the enemy also needs more than 20 attack bots before he can attack you. Let's take a closer look at the enemy. In a more advanced iteration of this diagram the enemy would be an artificial player using exactly the same mechanics of tile claiming and resource management. However, to speed things up at this stage I simulated the enemy in a very simple way:
On the one hand this mechanic gives you enough time go get your resource incomes sorted before the enemy attacks, but on the other hand, once the enemy is strong enough, your defence bots will be under constant pressure. If you want to win the game you have to attack yourself! In order to attack the enemy you need 20 attack bots yourself. Only then the "attack enemy" button is being activated by the activator running from the "attack bots" pool to the "attack enemy" button. There is also another option: if you collect enough XP points by growing your population you can upgrade your attack or defence bots. Each upgrade level will cause the enemy to lose two additional bots per round. That's more or less all there is to this example diagram. I hope you find it useful!