Monday, December 2, 2013

AI



Artificial Intelligence
 

            Artificial Intelligence or AI has a big role in games. The goal of AI is to emulate a being so well that it is indistinguishable from a real one. Perfect emulation is very hard to pull off. For games having the basic properties and behaviors is often acceptable. Below I will talk about the basic properties and behaviours.

            AI properties define things like how fast the AI moves, how smart it is, how strong it is, and so on.

            AI works in finite states. The states in the AI define the current behavior the AI is acting. Some of the basic states would be: seek, flee, attack, communicate, wonder, Idle, and so on. A game’s will AI require the states that make its actions feel natural. Depending on the game’s needs there may be less or more states. 

            To look deeper in the states listed above the seek behaviour would work like so. The main behaviour of seek is to seek out an objective or simply put, move to a location. Once switched to it would need to take an objective. This objective is usually a location but can be anything. The seek state would need to know about a waypoint list or nav-mesh and any other objects that can be its target. The AI will move to the location assuming it can actually move there. If the AI actually gets there, gets stopped or if anything interrupts it on the way it would switch states to suit the situation. 

            The Flee behaviour is self-explanatory. The main behaviour of this state is to move away from an object. The simplest way to implement this is to get a vector from the AI to the object it’s fleeing from and move the opposite direction. When switched into this state the AI would require an object to flee from. Using the above method to move away the AI would do this until a range or when the AI feels safe from the object. Upon feeling safe the AI would switch to the appropriate state to suit its situation.

            The Attack behaviour is needed in almost every game. The main behaviour of this state is to attack the player or other AIs. Then method of attack is completely up to the game’s needs. Entering this state needs an enemy or enemies to attack. Depending on what the game needs it would attack until killed or it kills the enemy. There is room for interesting AI here because there could be different attack types or commitment levels. For example an AI with a low commitment level might flee when the health goes below a certain level.

            The communicate behaviour is a behaviour that some games might not require. The main behaviour of this state is to communicate to the other AI. The Communication could be about enemy locations or to give orders to other friendly AI or of course receive orders. Once Communications finish the AI would act on the information and change its state to suit it.

            The Wonder behaviour is a special seek/idle state. In this state the AI focuses on picking a random location then moving to it. This state is usually used when the AI doesn’t have anything to act upon but to act natural needs to move around. The AI will leave this state if anything acts upon it or a situation accrues which requires it to interact with.

            The final state I want to talk about it the idle state. This state is for the AI to do nothing in but wait until it needs to do something. This state is the AI’s fall back meaning that this state is almost always the default state. 
 
            Hopefully this gives a basis to create basic AI from. In my game this semester we have no plans for AI apart from turrets that can shoot. So in our situation all we would need is an idle and Attack state.
 

No comments:

Post a Comment