Home  |   Java  |   The Chosen (RTS)  |   Research  |   About  
Java Apps:        

The Illusion of Intelligence

Douglas Crafts
February 16, 2006


      One step at a time, the world moves into the twenty-first century bringing technology and software with it. Movies continue to grow, shift and adapt to the public while video games follow close behind. According to Gloria Goodale, of the Christian Science Monitor, “Last year US sales of what is now called ‘interactive entertainment’ topped $7 billion, closing in on the $9 billion film industry.” The gaming industry has become something greater than anticipated, and its games have moved past simple adaptations of table tennis, like the original Pong, as they each strive to be the finest in their field. Modern games are frequently graded primarily on their graphic content, their main concept and storyline, or even purely on how fun they are. However any and all games are only as good as the thousands of lines of code working behind the scenes. The concealed coding in all games is what dictates everything from lighting and color fluctuation to the fluid player movements comparable to real life. While great graphics, realistic movement, and intriguing sound could make any game interesting, it’s an opponent that all gamers truly desire. To satisfy the players, many modern games now come equipped with extensive artificial intelligence systems that are designed to control numerous entities ranging from computer controlled opponents (bots), to non-player characters (NPCs), to even animals, miscellaneous creatures, and other elements of the virtual world and its scenery. On page one of his book, Jack Copeland defines artificial intelligence as, “The science of making machines do things [solve problems and achieve goals] that would require intelligence if done by men”. Artificial Intelligence, or AI for short, has matured with the twenty-first century to such an extent that gamers now can often be heard inquiring, “Yes, it looks gorgeous. Yes, the polygon counts are enormous. Yes, the lighting effects are outstanding. But we don't care about that here. We want to know how smart it is” (Woodcock). To create that illusion of intelligence in any given entity, it is essential for its artificial intelligence system to repeatedly go through a process of acknowledging what it perceives, making an appropriate decision, and implementing that decision in the virtual world while constantly living by the laws of reality.

      As the idea of artificial intelligence has been chased through novels, movies and games, it has become clear that a believable and acceptable AI system must have very clear boundaries when it relates to its perception of the world around it. The AI must be limited in what it acknowledges in such a way that is acceptable to both the common player and the expert gamer. If, for example, you run right past an enemy, that enemy should visually demonstrate that it now acknowledges your presence. However, in a similar situation, that enemy should not be able to see you slowly sneaking through a dark area. In short, the enemy should be neither omniscient, nor senseless, unless that is specifically its role within its reality. Thus, in an effort to create intelligent beings, it must be established what is practical for that specific entity. If, for instance, a canine was programmed, it would have an enhanced sense of hearing, but its vision would not acknowledge colors. “Without good perception, there is no relevant decision or action” (Pontevia, Open the eyes). Perception is defined as becoming aware of something via the senses, but what is relevant information and for how long should it be kept before it is forgotten forever? The closer these values relate to reality the more the AI will seem accurate, correct, and believable. According to an accredited freelance programmer specializing in the techniques crucial to programming game AI, “Modeling perception accurately is one of the keys to maintaining the illusion of intelligence” (Buckland 316). Mat Buckland continues by explaining how, in a 2-Dimensional world, each entity should be created with access to all the geographical information that relates to the virtual world in which it resides. Having complete geographical information is necessary in order to prevent the entity from unintentionally leaving its environment. In 3D, however, it is more effective to use ray-casting to help each entity to understand the world. Ray-casting, also known as ray-tracing, is a technique used to transform a limited form of data, like a floor plan, into a 3D projection by tracing rays from the view point into the viewing volume (Permadi). This sonar-like system is entirely based on the entity and its position and heading. In most scenarios, it also becomes necessary to add a listening system to the AI’s perception. Sounds, however, are different from visual objects mainly due to the fact that sounds are based on a fixed location and don’t require an entity. For example, if a tree fell in a nearby forest, all NPCs in a given radius would receive a notice of this sound, while NPCs outside the sound radius would remain completely unaware of the sound. To handle sounds, Mat Buckland suggests a telegram-like system that alerts everyone/everything in a given radius and all the NPC has to do is respond. Beyond the acknowledgment of its surroundings, an AI must also maintain a type of short-term memory so that an elusive prey is not forgotten the instant he steps around a corner, or into a shadow. “In order to be convincing, an agent must also be bestowed with a mechanism for simulating short-term memory. Without short-term memory an agent is incapable of considering potential opponents that lie outside its sensory horizon” (Buckland 317). A short-term memory system is simply created by creating new virtual unseen objects that self terminate after a given time limit. Without a short-term memory, an NPC would either immediately forget about what it has seen or hear, or it would wander around forever looking for someone/something that may no longer exist. For example, if an NPC had an everlasting memory is could theoretically see someone disappear around a corner and would then search endlessly until it found its prey.

      Once the NPC understands its surrounding geography, and its location within it, it then moves on to a process of deciding its main goals and choosing one to execute. To maintain the illusion of intelligence, an AI system must rapidly choose, from a list of goals, the goal that most satisfies its current needs. It is a fact that, “The behavior necessary for a bot to win a game is decomposed into several high level goals” (Buckland 315). These goals, in an effort to uphold a small-scale short-term memory of the NPC’s actions, are grouped in a hierarchical fashion that also allows for sequenced, scripted goals. Creating main goals from smaller, composite and atomic goals, allows for certain goals and their sequences to be executed repeatedly out of turn when necessary. While composite goals can be composed of both atomic goals and more composite goals, atomic goals on the other hand are merely simple commands designed to work when executed individually. For example, a creature might have a main goal, “Wake up” which would contain another composite goal “Scan sleeping area” which could contain numerous atomic goals, such as, “Scan area1”, ”Scan area 2”, and “Scan area 3”. Placing smaller goals within larger goals gives the NPC the capability to end a goal, at any time necessary, and return to the previous task. This could be evidenced by that creature, for instance, if the creature left and returned with food, he could execute the existing composite goal, “Scan sleeping area”, without the other “Wake up” goals, followed by the new composite goal, “Make fire”. By using a hierarchical, layered structure, a short-term memory system builds itself with access to all the goals that were recently executed. This hierarchical, layered system also makes it very easy to insert new emergency goals to be handled immediately. To handle the emergency, the new goal is placed on the list before the current goal, and is assessed before the existing goals in the next “Think” process. If the new emergency goal is inferior to the current goals, it is postponed to be re-handled the next time the current goals are evaluated. If, for example, a man is driving home after work and sees a nice yard sale he will create a new goal “Visit yard sale” and place it in front of his old goal “Return home” to be handled. The handling process is used to prevent any possible new emergencies from overtaking the existing emergencies. After completing, or denying, the emergency goal the short-term memory kicks in and the NPC resumes what it was doing before the event occurred. This goal-based system closely resembles the workings of a finite state machine in that both systems have grouped commands that are executed in specific orders. “State Machines are probably the oldest, most reliable, most oft-used game AI technology on the planet, and they're likely to stay that way for quite some time” (Woodcock). State machines are so reliable and most common because they are more like regular programming than they are to AI programming. In a state machine, for example, if the NPC’s health dropped too low it would enter a survival state to accommodate the harsh conditions. A finite state machine is simply a state machine that has a finite, or non-infinite, amount of states. This is different from a goal-based system because it relies solely on given events like an ammo shortage or a high hunger level. Goals on the other hand are more scripted and controlled. Both systems could be viewed as intelligent beings, but the limits of a finite state machine only go so far, where goals seem to stretch on forever, held back by nothing but the creator’s imagination. One additional attribute of both systems is the ability to handle “messages”. Messages act as telegrams from one entity to another. For example, as a miner gets home from the mine, his wife should be notified that he is home so that she may greet him. Without these messages, the two beings would have almost no record of each other. Messages could also be used in conjunction with a delay system for certain tasks. For example, a chef would start a meal and send himself a delayed message so that he would be reminded to remove the meal from the oven. However, messages are not limited to human entities. Messages are used whenever anything in the virtual world interacts with anything else. A gun for example would send a message to the user when it becomes empty, or jammed, and would also send a message to the projectile to start its journey, which would in turn send a message to the target that gets hit. Each message is handled at an appropriate time depending on the current state or goal that is being executed.

      After a goal has been selected it must be executed. The appropriate sub-goal must be executed in conjunction with a simple movement command. For example, if a soldier’s AI decides to attack, it then must decide to rush or to flank the opponent. After a decision is reached, the appropriate movement is chosen and planned for. Path planning is one of the most important actions in any game to date. “Moving is the foundation of action: an NPC that cannot move will not pick up objects, attack, hide, implement tactics, etc.” (Pontevia, Pathfinding). When path planning, the NPC must guide itself over various terrain while avoiding walls, holes, water, and even other NPCs along the way. All this must be done at a very efficient rate as well, or else an NPC could be left waiting as the CPU struggles to find the most efficient way to climb a mountain. To keep the game going, most NPCs will immediately start moving in the general area of their target as the planner continues to deliberate in the background. As the path planner calculates the most efficient, complete path, it becomes clear how important good perception can be. For example, an NPC must understand where it can and cannot go in order to prevent unreachable goals. As the goals are carried out, and the NPC goes on with its life, a reoccurring thought process must be repeated several times a second in order to ensure that it is still doing the right thing and the circumstances have not changed. Just as a human would debate issues in its head, an NPC must often check for alternate objectives to carry out.

      Once all the parts of the entity come together it becomes no longer just segregated lines of code but instead a fully functioning AI that will act as a human, a bird, or anything else that the creator wishes it to be. While the illusion is complete it may still seem somewhat clumsy. With minor tweaking and editing, the AI will become more and more realistic as time goes by. The final product is not omniscient nor is it incapable of fulfilling its duties. As the player plays he slowly focuses his attention towards playing his opponent instead of critiquing its design. Sadly, however, it takes only one mistake by the AI and the illusion of intelligence disappears. When the player loses faith, and rejects the concept, the player soon loses interest in the now discredited opponent.

Works Cited

Buckland, Mat. Programming Game AI by Example. Plano: Wordware Publishing, Inc., 2005.
Copeland, Jack. Artificial Intelligence A Philosophical Introduction. Malden: Blackwell Publishing, 2001.
Goodale, Gloria. "Video-game industry mulls over the future beyond shoot-'em-ups." CSMonitor.com. 03 Jun. 2005. The Christian Science Monitor . 01 Dec. 2005 .
Jackson, Philip. Introduction to Artificial Intelligence. Second Edition. New York: Dover Publication, Inc., 1985.
Permadi, F. "Ray-Casting Tutorial." www.permadi.com. 1996. 12 Dec. 2005 .
Pontevia, Pierre. "Open the eyes of your Non Player Characters." RenderWare.com. RenderWare. 01 Dec. 2005 .
Pontevia, Pierre. "Pathfinding is not ‘A-star’." RenderWare.com. RenderWare. 01 Dec. 2005 .
Woodcock , Steve. "State Machines & Agents" GameAI. 16 Oct. 2005 .

Copyright © 2017 Dougie Fresh