Hi there!
For Ludum Dare 47, Revetoon and I have made Mobodo, a point-and-click game about getting out of a boring daily routine. One of the first challenges was to build the plotline, and this is what this post is all about!
But first of all, come and try Mobodo! It is better to try it before reading this post, as it contains spoilers about the storyline :grin:
The concept of the plotline
Our main idea to match the theme was to have the whole game be a cycle of working days, all looking like each other. Also, we wanted the game to be more like a story to watch than a real challenge for the player.
From those two assumptions, we decided that:
* The game had to start in a loop (a bad loop).
* The game had to end in a loop (a good loop).
* Every state of the game had to be a specific loop, meaning that the player could at any point stop playing and see the game loop as long as he does not resume playing. This ensures that the game is easy and that the player cannot miss an opportunity ; he just has to wait to have the same opportunity again.
* Every action of the player (including waiting) had to either do nothing or make the game go in the right direction. There are different paths and ways to play, but they all lead to the nice ending :heart_eyes:
Small summary of the story
At the beginning, the player is stuck in the following loop: "I sleep alone and I wake up - I go to work - I work a boring job - I have dinner alone at home".
At the end, the player is in another loop: "I sleep with a loving girlfriend - I develop games from home as a job - I have dinner with my girlfriend". The idea here is not to fall into the very common "break the routine" plot: you are still in a routine at the end, but a better one.
There are 2 story arcs:
* Work: you start by working a boring job. After breaking your alarm clock (therefore being late for work), unplugging the multi-socket at work and spilling coffee on your boss' shoes, you get fired. While back at home on your computer, you look at all the video game objects you have and decide to make video games for a living.
* Love: you start alone. When the train brakes too hard one day, you fall and break your arm. The next day, a girl gives you her seat. Then, another day, you chat with her and she takes your number. She calls you, you have dinner together and voila, she is your girlfriend :)
How this "moving loop" was implemented
Here is the original diagram of the storyline described in the last paragraph! (translated from French)

The Dual State Machine
You probably know the concept of the State Machine, but here is a reminder. A state machine is a system that has a finite number of "states", which can be represented in an enum variable, or with several variables. For each state, it has a specific behavior, and from each state it can "move" to zero, one or several other states to change its behavior.
For this game, each one of the story arcs is managed by a different state machine. This way, the player can progress independently on the two story arcs, but will always finish on the same end, where both state machines are on their "ending" state.

The Love State Machine is simple: as the love story arc is linear, the state machine just stores where the player is in the story by storing the last thing that happened on this arc (for instance, if the machine knows that the player just broke his arm, it is time for the girl to give her seat).

The Work arc is more complex, and split into two parts: "at work" and "at home"; they work in the same way so I will only describe the "at work" part. To progress, the player has to get a "boss anger" variable to 3, by breaking his alarm clock (hence being late at work), unplugging the multi-socket at work and spilling coffee on the boss (each increasing the anger by 1). As we wanted the coffee to be "the icing on the boss' anger", we made the boss get close enough to the coffee mug only if the anger is already 2. When the coffee is spilled on the boss, the anger is 3 and the player is finally fired.
The Loop Builder
The core of the game is this routine loop that can continue endlessly if the player suddenly stops playing. The have that, we made the "Loop Builder", responsible for the logic of the story, building the loop out of "vignettes". Every small scene that the player sees is called a "vignette"; for example, the first loop is made of 4 vignettes:
1. Sleeping alone
2. Transportation
3. Work
4. Dinner.
The Loop Builder takes the current vignette as a parameter, checks the state of the two State Machines and decides which vignette to put next. Like that, the loop and the story is build progressively. For example:
- If the current vignette is "Sleep alone" and the player has not been fired yet, the next vignette should be "Transportation" because he has to go to work.
- If the current vignette is "Sleep alone" and the player has already been fired, the next vignette should be "Work from home".
- If the current vignette is "Work" and the boss' anger is 3, the next vignette should be "Getting fired".
Conclusion
This system (mainly the Loop Builder) is quite generic and is able to create all kinds of stories, even made of dozens of story arcs, each one of them having its own State Machine. We think it is quite a good way to build the game, as it is very easy to add a new vignette, or even a new story arc.
Thank you for playing, have a nice day! Remember to rate games, the results are near :smiley: