After trying to define what makes an adventure ‘Epic’, let’s take a look at the AI. The scope is somewhat bigger than just the epic adventures, this time we need to lay down the foundation for NPC AI driven quest/task/job/adventure generation first.
NPC AI In separation
Previously, I was writing on this blog about NPC AI based on Maslow’s Hierarchy of Needs. (In Hungarian, so I’m linking only the wikipedia now..) Simply put, this system defines the same levels in the same order for humans, as it is outlined in Maslow’s Hierarchy, then uses them to determine the next action for the NPC. Naturally, different races have their own structure, and make their decisions by their own needs.
While in theory this is a very good system, in practice it is not the best for the imminent action, when the entity is expected to react when – for example – it is attacked. Also, quest givers are usually not expected to have their own lives, or to do anything else than to interact with the player. It is actually better to have a simple state based system for reactions, and use the maslowian system for long term goals, and with that, quest generation.
Beside of the memory, and the sense of the environment, the entity needs a sense of future needs. Let’s take the blacksmith of the village, as an example, and analyse his long term needs.
On the lowest level, his everyday needs: Air, food, something to drink, other body functions, sex. For three of these functions – food, drink, sex – he can make long term plans. Having food in the storage, having some water in the pitcher, being in good terms with his wife, these are all things that he can and will do to keep the status quo.
One level up, safety. To prevent future accidents, he takes good care of his tools, and protective clothing – mittens, apron. He puts out the fire for the night so that the building won’t catch fire in the night. He locks the door so no-one steals his materials, tools. Safety is one of those things where you need to do a lot of things to prevent future bad things from happening.
Then the next level: “belongingness”. (I found this wonderful word on the wiki.. ) There are a lot of groups the smith belongs to. His family, his friends, the guild of craftsmen, the angling club (see below), the village, the country, humans.. Although the role of the entity is usually more significant in a smaller group, meaning that he is more important in his family than as a human, he has obligations in each group. He will earn money to be able to put bread on the table. He will go to the local pub and drink an ale with his friends, and if a friend needs a loan, he will give some money to them. And so on. The future need on this level of the hierarchy is to maintain social status and to provide safety for the group.
Esteem, the next level, is when our smith shows his ambition. He wants to be known for something: Be a good father, be a good friend, be the leader of the craft guild, the best smith in the country, etc. He is working hard on this, to earn reputation. In game terms, the previous level means that he works to keep neutral reputation in the groups he belongs to by fulfilling his role. This level means that he is working to increase his reputation beyond neutral.
And the last level is self actualization. As I mentioned above, he is a member of the angling club, because his hobby is fishing. He likes fishing, not just for the fish, but also for fulfilling his need of solitude, and the time he spends out at the lake. He plans for these fishing trips, checks his equipment, gets the right kind of lure, talks to other anglers about good places, big catches, etc.
As we can see, these levels are somewhat interconnected (work -> money -> food) and you can be in several states at once – you might be worried at once about getting food for tomorrow, and forgetting to lock the smithy door. Also, the degree of your need can vary, you might be worried about having food next week, but that is probably not as worrying as not having food for tomorrow; you can quantify the need as a percentage value, for example. Thus, a simple finite state machine would not be sufficient for this, but a fuzzy logic system might work well. Aside of this, every NPC must have a definition of groups it is part of, as well as a “personality”, which would describe the importance of each levels for a given NPC. For example, we might have an NPC with a high importance for self actualization, and low importance for safety. Putting these two together the NPC is willing to go to prison to defend it’s art. (see Marquis de Sade) Personality also needs to define the occupation, hobby, and interests of the character. This importance of the need can be sometimes expressed as the speed the need raises – if the NPC eats more, it will need to store more food to have reserves for the whole month.
NPC generated quests
Now, let’s take a look at this system. What kind of quests can we generate based on this system? Let’s put together a few examples.
On the physiological level, the NPC might need help to gather food, get something to drink, or get sex. Also, the NPC may offer these things and is looking for someone to buy them. (this latter one is actually the second level, but connected to the needs of other NPC on the first level). Possible quests here is “get meat”, “help with the harvest”, “remove the troll from under the bridge which prevents us to get fresh water”, “get me a specific type of wine”. It’s important to realize, that we mix the levels here; the third one is safety as well as the basic need of drinking, and the fourth one is actually more like self actualization than basic need. The common point with all of these is that the NPC has a goal, but for certain reasons it requires help to achieve them – if it would be easy, the NPC would do it itself. A possible Epic quest on this level is to take food into a castle that is under siege and surrounded by enemies.
(I’d like to emphasize one thing here: There might be several different ways to actually solve these quests, and that is intentionally part of the system. The NPC doesn’t tell you which or how much animals you need to kill to get meat. It doesn’t tell you to kill the troll, if you scare it away for good, it can live with that. It doesn’t care about whether you steal the wine, buy it or take it out from your backpack.)
Second level: The source of the “Kill ten rats” type of missions. Defend, escort the npc, but also, help him to get materials for his everyday job, catch the robber who robbed him, etc, etc. Carrying items from point A to point B, including the safety of the item. Also, health is here, in this category, so a quest to find a rare herb to cure an illness will be generated on this level. Also, taking crafts into consideration, the NPC may even ask you to help him to repair his roof, for a reward, of course. Epic quest here is to save children from a burning house.
Third level: Carry messages, social interactions, solving group level issues. Diplomacy, quests related to emotions. Epic quest here is to prevent a war between two kingdoms.
It is important to notice that the quests you get in the MMOs today are usually of the lower levels. Because NPCs doesn’t have real lives, they don’t have higher level needs. There are some quests when the male npc is in love with the female npc, and asks you to collect a bunch of flowers that he can then give to her, but, beyond the obvious question (“Why the hell don’t you go and pick those f*cking flowers yourself, mate?”) these are also really bad examples for the quests of the third level. Maslow’s hierarchy would allow much more than that.
In the next article, I’ll take a look at the problems of numbers – the need for simulating the crowd.