Sinks & end conditions

In this section, we will explain how Sinks & End Conditions work, by using a food and hunger mechanic. First, create a new type of resource that can be looted.

Currently our model has no lose condition or inherent challenge. To demonstrate how Machinations can be used to model these, we will build a food and hunger mechanic.

First, create a new type of resource that can be looted: Food.

Adding a Sink

We will use a Sink to model the consumption of the Food by the player and workers.

Player Loots Food sends 1 Food a step into the Food pool, which starts with 10; the Eat Food sink, set to Auto, takes 1 Food out each step, and an Empty connection enables Player StarvesPlayer Loots Food sends 1 Food a step into the Food pool, which starts with 10; the Eat Food sink, set to Auto, takes 1 Food out each step, and an Empty connection enables Player Starves
Tip

Sinks are resource-destroyers. They are often used for decay-like mechanics, like taking damage or losing hunger points.

Locate the Sink on the toolbar, add it to the canvas, and connect it to the Food Pool. Then hit Play.

Warning

Remember, the Sink must be on Auto (a new Sink already is), otherwise the Food won’t be drawn out of the Pool.

A Source named Gather food adds 1 Food per Step to the Food Pool, and a Sink named Player Eats, set to Auto, takes up to 2 out each Step, so the Pool stays almost empty.A Source named Gather food adds 1 Food per Step to the Food Pool, and a Sink named Player Eats, set to Auto, takes up to 2 out each Step, so the Pool stays almost empty.
Note

Design consideration: In this model Player Loots Food gathers 1 Food each step and Eat Food takes 1 each step, so the Food pool stays close to where it started and the player never runs short. Changing either amount changes how long the player survives.

We keep the food requirement simple: Eat Food takes the same 1 Food each step however many workers have been hired. To make workers eat too, you could add a Modifier-type State Connection from Workers Employed to the connection that feeds Eat Food, but this model does not include one.

Adding an End Condition

The end condition of our game would be when the player runs out of food and starves. For simplicity, we will assume that Workers can’t starve (although this is something that can be modeled).

For quick tests of our model, we can use a component called an End Condition to flag when the player has starved.

A Pool named Food holds 3 Food and a Sink named Player Eats takes 1 each Step. When the Food has run out, the State Connection from Food reads true and the End Condition named Player starves is lit, which ends the Play.A Pool named Food holds 3 Food and a Sink named Player Eats takes 1 each Step. When the Food has run out, the State Connection from Food reads true and the End Condition named Player starves is lit, which ends the Play.
Tip

End Conditions take Activator-type State Connections (Type “Enable while”) as an input. When the condition given is met, the Play ends.

Note

Try implementing an End Condition yourself before continuing.

The Player Starves end condition, enabled while the Food pool is emptyThe Player Starves end condition, enabled while the Food pool is empty

This setup checks if the player has no food left, then ends the Play.

Warning

Notice we have a problem: playing this model will instantly end the Play. This is because the player has no Food to start off with.

Adding initial Food

We can solve this problem by giving the player some food to start the game with.

  1. To do this, select the Food pool and set its Initial quantity to 10 in the Properties panel.
Note

While you Play, a Pool shows how many resources it holds as a number inside its circle.

You now have a working diagram representing a small slice of a resource management game. Though more can be done to the diagram to improve its utility and accuracy, it has already been able to identify some balance issues. For instance, Wood and Stone tend to be overproduced (or under-consumed).

Note

This diagram would be a starting point for a larger, more feature-complete diagram; or for new diagrams which model individual features in more detail.

Next, we will explore how Charts can be used to plot your Plays and identify further balance issues.