Modeling your fellow traveler: designing a cooperative game as fun alone as with friends
In Fulvinter, one plus one adds more than two. But … What happens when you play alone? Well, it happens that you control some more than your character. In Fulvinter, whether you play alone or in cooperatively, your character is tied to a partner.
This partner can be controlled by an AI or by another player. Well, the AI-controlled thing has its tramp :)
In this article, we are going to explain which is the trick and how we have implemented it.
Fulvinter was designed primarily to be a cooperative game but, on the premise that plays alone should be as much fun as play with your friends. That is one of the main ideas of the game. To achieve it, it was crucial that the AI replaces the fellow traveler must be good and does not make bad decisions.
Our first approach was to implement allied behavior as a full-independent AI. We had enough experience to carry it out, so it was the most obvious solution. But soon we discovered that having a full-independent AI in the game wasn’t fun. How many games have you played where the allied AI virtually wins the game without your help? We didn’t think it was fun and it didn’t add anything to a single player’s experience. Play alone was worse than together and this was just what we wanted to avoid.
So, we turn the table upside down and approach the problem from another point of view. What if the player could handle both characters?
Oh, wait… Hold your horses! How the player can control both characters?
Indeed that is not possible… directly. But not indirectly. Really the trick is the allied AI in Fulvinter do exactly the same actions that you did, but with a small delay. Most of the partner’s actions follow this rule, except the hammer hit that’s synchronized between player and partner. This allows you to predict all the time how the partner will behave and take advantage of it in your favour. Taken this into account, you can resolve puzzles o hitting an enemy even when the player isn’t near. You’ll see how useful it is!!!
But… How is this implemented? Well, Don’t panic!! We are going to talk about software design patterns.
The Command design pattern was initially used in the game to create the allied AI.
If you want to know more about this pattern here you have a link where it explains it quite well.
The allied AI was only a command queue that saved the commands that we are executed with a certain delay. Each action of the player was enqueued and then executed. All the actions except the hammer hit as we have explained before. We soon discovered that this approach was not the right one. The delay and the different starter position between player and NPC caused that the AI fails many times.
So we change our strategy radically. Finally, your fellow traveler search Smart Objects in the world.
The Smart Object was used for the first time in The Sims game to solve the problem to manage a large number of a different object.
Although the idea of executing commands remains and is similar, the approach is completely different. Smart objects are placed in the world and are independent of the position of the NPC, delay and the events that occurred in the game. They’re gonna be there at their place no matter what. The player with each action leaves these object around the world and the NPC goes looking for these objects and executing the orders that they contain. And finally, the smart object processed by the NPC is deleted to avoid repeating actions.
This approach solved 95% of problems that the first solution was produced but not all of them. There are some exceptional situations that we need to be handled separately. By way of example, we can cite the problem of mobile platforms.
In these type of platforms, the smart object can’t be placed in absolute position because the position where the player jumped can now be a position in the void and your partner to take a leap of faith.
The position must be relative to the platform. When the player enters the mobile platform, the redundant smart objects are removed and a new smart object is added to manage the jump on the mobile platform. Basically, the smart object performs the following actions:
- Jump from the last valid point until the centre of the platform.
- While the player is on the platform, the partner remains of it. When the player goes down and steps on the ground, the partner will also go down in the same position as the player.
And that’s how we solved the partner’s AI when you play alone. Making predictable AI that you can use as a mechanics. So, when you play alone, it’s up to you to use your partner as part of your playable mechanics. Surely you can come up with an original way to use it to your advantage ;)