Posted June 11, 2023 by pedrorns
#game design #narrative #finite state machine #democracy
Hi there, friends and foes of democracy,
I am currently preparing the ground for the contribution of artists, musicians and script consultants. While the game is kind of clear in my head, I need to put on paper all of my thoughts in a way that they can understand. I learned last year how hard this task is. Thankfully, I also find it incredibly enjoyable.
All my contributors seem to agree on one thing: I should express clearly how the story evolves. I should make an ordered list of scenes, or, if the story is nonlinear, explain how each decision leads to this or that path and ultimately, which outcome.
Unfortunately, knowing my prototype and the future game, I know I can't do that. I can at most offer an approximate sequence of decisions and scenes of the winning strategy. But the winning strategy is probably just about 30% of the game. The game is not linear and not very representable by a game tree chart. Instead, the correct tool to understand the game is a finite state machine.
I decided to sit and spend a day writing an explanation why I can't describe how the game evolves, what is a state machine and how it is useful in this project. Even although my academic side cries for the lack of references in this writing, I decided to share with you all, hoping it is cool and that you may share your thoughts on it.
Games are branching structures. Each decision made by the player, and each random draw of luck, makes the story branch into different paths. A game with just two binary decisions could look like this:
I love these charts. Indeed, I teach game theory at my university. I know game trees are helpful to visualize games. However, they are only the best tool in games that have few possible choice nodes and endings.
Game trees are also important when the path taken by a player matters. Sometimes, however, they are not very useful, but confusing.
While this structure can represent games of any kind, it is less useful to represent games that are more complex. Consider, for instance, Chess. The current position of pieces and whose turn it is, is almot all that matters. There are exceptions to this rule, but only two (tie conditions and castling). Other than that, the path taken is of no interest, only the state of the game.
Suppose, now, that we have a game where a player can buy wheat in city A to sell in city B and can buy wine in B to sell in A; she can do this repeatedly, if she has money. The player can also go to C for a vacation, provided she has enough money. A game tree here would not help understand this game, for a number of reasons:
For this reason, many game designers do not care as much about decision paths, caring instead for the state of the game. They don’t care whether the player was in city A, B or C three rounds ago. What they care is where she is now, how much time has passed, what the player is carrying, how rich she is, etc. If a particular past event matters, such as, “was in B when the plague began”, game designers just add a variable to account for that state. But unimportant past events can be forgotten. The sequence of choices does not matter directly, but only indirectly, through its effect on game states.
Game designers use the metaphor of a “finite state machine”. The game is understood as a machine whose current state can be fully described by a set of predefined variables. Whatever matters for the game can be captured by one of those variables or a combination of them.
Think of a food processor. It can be connected to electricity or not. If it is connected, it can be: off, operating in bursts or operating continuously. It can be configured to blend or grate. Inside it, one can put a cheese or cake mixture. Given its current state, one can predict what will happen. A machine that is powered and operating continuously grating cheese will grate it all in a few seconds. It does not matter whether the cheese was put in the machine before or after it was connected to the power source (although, for safety concerns, it could matter). Its current state will determine its next state. Cooks manipulate states to produce the food they want.
In a similar vein, a game state may be defined by a finite number of variables. When a player comes to a battle, it may not matter whether the weapon and armor she uses was bought or stolen; for that task, what matters is the quality of these tools. Players select strategies to manipulate game states, just like cooks.
The trade game described before could have the following states:
Machine state games do not record the path, and do not need to know the map of possible paths. Instead, when events or encounters occur, they check the game’s state to find what will happen. Here are some examples:
Moreover, events and their effects can depend on combined states.
The video Narrative Sorcery: Coherent Storytelling in an Open World shows how a few machine state variables can easily support several different narrative paths. Games based on state machines can allow for emergent narratives, where the creator himself is not fully aware of all the paths that players will end up taking.
Most games have aspects that are better understood with a state machine and other aspects that are better understood with a game tree. Take Mario Bros 3 for example. While playing a level, the game is mostly a finite state machine. The game can be described by the following variables:
To know whether Mario can fly, the game must check his speed, and whether he has the tail superpower. To check if Mario will die upon colliding with an enemy, the game checks Mario’s size (small will result in death, large will result in downsizing). A mushroom will make Mario grow if he is currently small, but otherwise have no effect.
At the same time, it is useful to think of Mario Bros 3’s map system as a game tree. At any point in time, Mario has only a few choices to make with regards to the next level he will play. And upon completing a level, new paths may open.
Other games, such as Witcher 3, offer an open world that allows players to complete side missions in almost any order, requiring a game state structure. However, missions themselves work as mini games that are linear or can be understood with a very simple and small game tree.
In Socratic Democracy, the path is often less important than the state. For instance, Leonidas can be ostracized if the following conditions apply:
If all these states are true, Leonidas will be put to a judgement. It doesn’t matter how many years have passed, how many oligarchs have been expropriated, or whether Leonidas won or lost the last election. Ostracism can occur in the third year as well as the tenth. The conditions can be met in different order.
Even when it would be fair for Leonidas to be ostracized, he can escape this punishment in several ways:
Each strategy will produce a different narrative. Players who decide not to investigate corruption will be unable to ostracize Charon before he turns against Leonidas. Players who use the war to kill Bion will be accused of doing so by Achilles. And subsidizing the theater creates a long-term problem, as theater plays are constantly satirizing Leonidas, harming his reputation permanently.
Game trees are often an inadequate tool to understand and map complex narrative games. While it would be nice to create a chart that fully explains how the story goes, Socratic Democracy's is too complex for that. The game branches combinatorially. There are easily a few thousands of ways to play it.
I hope that you, my reader, had an enjoyable reading. And I hope my collaborators will both enjoy the concepts and understand how to make them work. I am currently writing additional materials to make that a real possibility, including a tentative list of all game state variables.
Cheers,
Pedro