martedì 29 aprile 2014

Cognitive Path Finding

For decades, players enemies, in all videogames, walked and ran over to take the PC (the avatar of the player) appearing more or less like robots. Any type of NPC (Non Playable Character, that is the character of the game is not run by a player) rarely goes in search of other NPCs or objects. Its innate goal is the player.

His behavior in the game, when it's well done (my experience tells me it’s more rare than imagined at first glance), is permeated by an iron logic. In doing this, the NPC "pretends" to be a person. Thinking to games like "I am alive", "Assassin 's Creed", "Prince of Persia" or other ones in which the player character is able to climb, jump and do other unusual actions, several considerations about the robot-like, or at least unnatural behaviour of the NPCs remind me how far we are from a correct human simulation in video games.

One of the most obvious of those considerations comes when they want to capture or kill the player and, to do that, "decide" not to follow it by climbing (as the player's avatar does). They expect that the player ends his actions climbing to attack him, or try to shoot from a walkable area, when the PC is still performing his jumps or movements on the walls.

Take as reference, for example, in the movie "Prince of Persia, The Sands of Time". During any run, in that film, crowds of guards follow the prince by climbing after him (for what is possible for them!). Apart from the bad figure made ​​by most of them by falling miserably, or when, in any case, can not keep up with him, their behavior is plausible: "I am a king's guard , I can not be put in check by a thief" or, "if I catch him, I’ll receive much money", and so on.

So, why only the PC can escape by jumping from one building to another? Maybe guards are not so in habit to climb as well as the player's avatar does, but they are humans, and humans can climb. It's clear to even the most inexperienced soldiers of the king knows that leaving alone the fugitive climbing the walls of the city, the risk that he escape entering a house or descending on an unreachable path is very high. To have a proper human behaviour by NPC/guardians, they should use the tactics of the pincer: some of them follow the PC by climbing after him, while others try to follow him from the ground to block his way out. Let us not forget, in fact, that guards are part of a trained body, governed by some leaders who also require teamwork.

Fortunately, some of the most used videogame engines are now able to let developers create more complex path findings than in the recent past, but this is not the only problem with NPCs and their simulation of the human behavior.


The fact is that the Path Finding systems adopted by developers are exclusively based upon the logic: A* is one of the most used, and it calculates the best and faster path for let NPCs reach their current destination. Are you really sure that humans (and animals too) have time and the willingness to study the map of the place in which they need to move, lose time to calcule a lot of possible paths and check then which of them is the fastest?

Even during the preparation of a modern battle there is no commander that lose time in trying to calcule the length of each possible path for his soldiers and the find the fastest, in order to tell them which to use.

The Cognitive Path Finding (CPF) differs from the classical approaches that are the basis of the current Science of Artificial Intelligence, as it doesn’t start from pure logic, but from human and animal psychology. It is, therefore, a new way to treat the issue.

The psychology comes toward us saying: in many situations, especially for environments not known in detail, the memory information can be recorded in various forms, and some of them do not have regular contours at all. Some of the information is or will be organized into a single cognitive structure. In these cases, however, rather than look like a real map, our internal representation seems to be more akin to a collage (Tversky, 1993).

CPF is the first model that uses studies made in the field of psychology about the way humans think and act it in a real path searching (path finding). I have carried out studies for several months, to extract, dial the "biologically correct" way to simulate the mental approach used during a real path.

The topic is vast, and it would not be possible to condense all in some articles. In any case, a valid CPF must, at least, take account that the biological beings, including humans:

  • All "reason" almost the same way during the choice of a path or when facing with an unforeseen along the path
  • Humans are not able to record enough information of a route to be able to reproduce, in memory, the same paths in the form of map (unless they are humans and know well the actual map), unless for some reasons, the map is studied for a while (not usual)
  • We do not EVER use to make calculations when choosing a path
  • We rely on our assessments to figure out which path is shorter
  • We often forgot part of the traits paths, or we confuse the sequence
  • We possess a way of evaluating the distances easily influenced by several factors, including our emotional current state.
As in case of Decision-Making systems built on scientific hypotheses (humanities and animals), there is no unique way to implement the CPF. Being also a whole new world for Artificial Intelligence, there is the need for who wants to build up a complete AI model, to avoid taking possible blunders.
I am available for any requests of further information in this regard.

Nessun commento:

Posta un commento