Ant on the beach on the grounds of Herbert Simon

Now our team Candango Games is working on a PC game in the style of horror. We plan to introduce it soon (by the way, to create it I study the components of fear). So that's one of the most important features that I wanted to implement in this game - a system that provides the effect of full presence. And, as we know, the most important thing to realize this task - is to create high-quality AI.






Thinking about how to do this, I realized that in order to create an architecture suitable AI heuristic approach. Below I will tell you more about this.

In some theories of knowledge says that we do not see reality for what it is. Instead, we see a virtualized "copy" of reality that is created and processed by our brain. This is a judgment we see in the famous Platonic «Мифе the cave ».

At first glance, this coincides with how we approach the implementation of AI: we program agents to receive and process information about the world in order to then based on these data to make a decision. Thus, we are now taking their vision of the world in artificial intelligence - forces the agents to act in the same way as if they were acting in the brain of the person. We can not say that this approach is absolutely meaningless.

However, specifically in the field of video games there is one detail: there is the equivalent of "real world" is already virtual, ie it is pure information. Why did it again virtualizovyvat agents into the brain and then causes the brain to process the information? Why are we trying to move the world into the brain agent, if you can do the opposite: to move the brain agent in the world? So I decided to do this: the world will "think" will be "smart" and knowledgeable. Peace, not agents.

We decided to go in that direction, since this approach is better suited to our purpose - to create AI for a good Speakers game. Imagine the following sequence of gameplay:

For you are being chased in some house. When you run down the hall, you notice an open door that leads to the bedroom. You're shooting in there and lock the door. Pursuers begin to break the lock, and you realize that soon they will be included in this room. Looking around, you see a closed window, a bed and a wardrobe. You open the window and hide under the bed. The door opens, one of the pursuers comes into the room, coming to the open window and looks out of it. Then he shouts his accomplices that you ran away, jumping out of the window and disappears into the darkness. At this time you managed to escape.

Here's what you can do with a simple code using basic heuristic approach "transfer the brain in the world." And the code is as simple as a code for Pacman. The peculiarity lies in the fact that the agent (the stalker) has no idea of ​​what was going on behind closed doors, he does not know what the box, what it means, where it leads, and even if it leads somewhere. The agent did not notice all these things and ideas. Everything he does - it should be available signs and instructions.

Now imagine the following events:

You're sitting at a computer, a game and suddenly find yourself in the kitchen in front of an open refrigerator. Are you looking for something there or return back to your computer with a cup of coffee, although this is no desire to drink coffee you have not experienced.

How did it happen? You deliberately got up and did it? Why would you do that?

So in this case, "smart" is not an agent, and the window, and the brain does not belong to the agent, and the world. Window agent says we need to do, where to look, where to go, what to say to other agents and to show how "his" decision to the player. When the agent comes into the room, things around tell him what to do. Bed, where it hides the player offers him a look under it. The cabinet also offers a look inside. The newly opened window tells him to go outside. After receiving these proposals agent receives reasonable solution on the basis of priority of these tasks.

Interacting with the window, the player increases its importance in connection with which the priority of this task is increased, and the agent it chooses, and not other embodiments - the window is controlled scenarios. Here, for example, if the player was hiding in the closet and sat there quietly, the priority of the task to "look in the closet" is automatically reduced, so the agent will choose the option "look under the bed," and the player, again, will be able to escape. It all depends on the choice of a game designer: it was he who decides how to work each item.



However, not all problems originate from external sources. Or attached to the internal elements of the agent can also give problems. For example, if the agent has a first aid kit, and suddenly he was hurt, the kit (which he has) order the agent to use. The significance of this problem is directly proportional to the severity of the injury. At the same time damage system agent (internal) order him to get away from the fact that the agent causing injury. Rather, in this situation, the agent, on the basis of the significance of each of the tasks, run away and find a safe place to heal wounds and either continue to fight or flee away. It is easy to implement: just need to give first aid kit by the knowledge that in the current situation without treatment no action can not be taken that will lead to treatment discontinuation vulnerability agent. Thus prioritize tasks.

This is the very foundations of the heuristic approach, and I really enjoyed using it. We were able to make the system to ensure the full effect of presence, we created it safe, challenging, but at the same time and very simple in terms of code. Besides, this system is flexible enough to allow easy change, modify and add tasks. For example, we can create a new source of problems in the form of the car, lock or stairs without change agent program. Or we can change or improve systems that control only a specific task or part of the brain environment without affecting other elements. Customization capabilities behavior seem really interesting to create a good game - especially for the game in the style of horror, because sometimes the player himself becomes a victim of the environment.

Then I wanted to add text recognition system to see how it can be used in the heuristic approach. Text instructions like "put a blue ball to the green box", which gave the respective NPCs will be identified, respectively, the green box and blue ball, and they will be given the task to the agent, so he picked up the ball, knew where to put it. This creates the impression that the agent understands that tells him to do the player.

Up to this point everything looked very nice. Then, the initial phase of making games is over, and I was faced with the fact that these problems have to somehow implement a code. A phase of the work. At this point my system looks like this:



Behavior - is the interaction of the agent with the environment i>

When I started to program the system in terms Uniformity, every day I had to pay some time the basics of AI. Not only AI video game, but in general AI. I just wanted to make sure that I do not spend wasting time inventing already invented the wheel.

I began to learn some very interesting concepts, as well as the old studies and experiments, some of which are already half a century. Among them I can call «belief systems» experiment Heider and Simmel animation (1944), "the science of artificial "Herbert Simon (1969) with an anecdote «Муравей on the beach », as well as Kuleshov experiment (original dates back to the area in 1919), which is I think at that time did not meet the time. Over time, this information has become more and more completely capture me and deprived me of sleep.

In the end, I realized that, starting from the other end, to the middle of the road I came to this knowledge. I went with a slightly different perspective: I wanted to create a "smart" world, because it seemed to me that it is very effective, since we virtualizing the world in which we live, and the agent is already living in a virtual world. But it was only a base to do something much more powerful and serious. But then I did not see these opportunities.

All of these studies agree on one thing: simple, combined with a complex gives a complex result that our brain interprets as an even more complex and intelligent than he really is.

Of course, we in Game Design 'goal was to AI forcing agents seem complex and reasonable, using various tricks. But I am not interested in this basic approach, and formula Simple vs Complex, which is repeated in each of these experiments - this coincided in all studies, regardless their specificity.

After I noticed the presence of this aspect in all such experiments and research, I began to look for analogies in other areas, because assumed that this aspect may be present in many situations, I just do not know about it. Most importantly, I was looking for similarities in the gaps in our AI system. And then I started asking a lot of questions about the problems of design and tried to find an answer using the same system and formula.

• If the tasks are created in a modular system and have access to the information agent for the prioritization of instructions and tasks, why not increase the number of such information and not to make it more? Give her personality, background, mood, feeling, social dynamics, and then create a task to analyze this information, instead of dwell only on health and inventory.

Behavior to create a character who was born in the jungle and knows where to find food and water, and the characters of the city without such knowledge may be just a background check conducted by a source of problems, which sends the following tasks after finding food and water. If the character here - the problem should be given, if not from here - the problem is given.

• Why do I consider only a specific side of the world and do not consider the abstract things that seem to be there, but we can not see them? Things like drama, suspense, comedy? Why do I need to create behavior that originates from things, not from the people and ideas? Why not create tasks from a group of things, from science and story scenes?

We can make dynamic narrative scenes to revive behaviors. Scenes that are available for specific heroes and appear depending on how the respective roles of each character.
Situations can be planned, linked to, or run, depending on the situation and the particular point in the development of the plot. For example, to create a common zombie film scene where one of the characters has been bitten or injured, and the other characters are arguing about whether to help him, leave him or you just need to kill him and be done with it: the situation does not depend on who is bitten or wounded. The source of the problem (storyline) simply evaluates how their role fits into each character and offers them a variety of tasks for each role, resulting in the plot develops naturally on the basis of their decisions. Otherwise we could have a climactic situation for any of the characters would be watching from the sidelines as a player behaves in key situations in order to change the plot of a thriller.

• Why not use these dynamic storylines and distribute their effect on future events with the possibility of a significant change in the story?

If a player prowl around and notice the tires on the car NPC, he does not display the standard cut-scenes "Party." Instead, then the NPC will start dancing with some romantic intentions (because in the dance scene, he is replaced by another from the list of non-player characters), and a love triangle will change the situation between the two heroes to determine the identity, leading to some more unusual results.
Or if the character who assumes the role of group leader, lost in the desert begins to lose his mind or despair, the abstract idea / social dynamics "Leadership Group" takes the NPC, and thus responsible for their decisions. Similarly, if the group is happy with the decisions leader, the social dynamics of this situation could lead to a new dynamic scene where they first struggle against the system, and then split into two camps.

• But why stop there? Why not let the story lines to determine what role the player chooses, and then adapt the situation for each player?

Plot selected character to the role of the leader of the second (or it is open for some time to determine if a player for this role or not), then the other to express their support for any side, and someone expresses the intention to cease hostilities and unite.

• But the characters can fight, even running away from zombies, or during an argument about who is the leader, or the community in general can decide to throw the wounded leader. So why not improve decision-making system and add characters multitasking?



The agents have "psihoresursy" that allow them to select multiple tasks simultaneously (and prioritize these decisions based on groups of tasks, not just perform the task one by one): concentration limits, hands, feet, mouth, eyes ... < / i>

If the behavior - it's always interaction agent and the environment, why not extend the meaning of the term on the personality and mood? Do we behave the same way at home, at work, on various occasions, in the company of friends and strangers? If somewhere we see happy people, we ourselves did not become just a little happier? And if there's all serious, we, too, are becoming serious? Is the same true for other events and situations?

The current model h4>
 After further study of many problems and issues without complicating the code, but simply to better understand that with heuristic approach creates AI, keeping all the basic system intact, in the end we came to a conclusion:



Everything that happens once can never happen. But everything that happens twice will happen a third time. " Schemes can always be expanded to create new tasks i>

That's the way our system looks now, and with this and will create our horror game, of which I spoke earlier in this article. This game does not mean limit of this system, as the system is flexible enough to develop it further. Another thing is that before that we need to learn how to achieve more advanced tasks with optimal cost of labor and time.

I'll talk a lot more in future articles about this project. Now I can not do it, because there is not enough information.

The most interesting thing always says at the end: after the release of our game, we will likely be releasing its free model in the Unity Asset Store, as well as reveal her scheme for people to be able to do it for other systems. We will also record all that we learn about the conditions of use of the system, be sure to fix the tips and tricks to work with it, check out what works and what does not, and will make some interesting options for what you can do with this system.

We also want to play your cool games using this system! We want to develop a video game went on as usual, and eventually they would have come to that, what should be the game. We want to accelerate the evolution of art forms, and we believe that the AI ​​will be the next turning point in this respect.

Thanks for reading! Subscribe to our blog and we are waiting for all of you to our beta test VirCities ! i>

Source: habrahabr.ru/company/ilkfinkom/blog/256237/

Tags

See also

New and interesting