Genetic Algorithms

advertisement
Movement Artificial Intelligence for Games
-
-
Movement
One of the most fundamental requirements of AI is to move characters around in the game sensibly
Resource management games and turn-based games often don’t need movement algorithms: once a decision is
made where to move, the character can simply be placed there
A movement algorithm is designed to use character properties to work out where the character should be next
Kinematic movement takes no account of how characters accelerate and slow down (only have speed)
How a movement algorithm works:
o Algorithm take geometric data about character own state and the state of the world
o After that, they come up with a geometric output representing the movement they would like to make
-
Each movement algorithm require specific inputs to do its job (i.e. if it should avoid walls then walls geometry should
be considered as input)
Also, output could differ under the required level of complexity
Dynamic movement takes account of the current motion of the character. A dynamic algorithm typically needs to
know the current velocities of the character as well as its position. A dynamic algorithm outputs forces or
accelerations with the aim of changing the velocity of the character
Craig Reynolds also invented the flocking algorithm used in countless films and games to animate flocks of birds or
herds of other animals. We’ll look at this algorithm later in the chapter. Because flocking is the most famous steering
behavior, all steering (in fact all movement) algorithms are sometimes wrongly called “flocking.”
Many movement algorithms assume that the character can be treated as a single point. Collision detection, obstacle
avoidance, and some other algorithms use the size of the character to influence their results, but movement itself
assumes the character is at a single point. This is a similar process to that used by physics programmers who treat
objects in the game as a “rigid body” located at its center of mass
Static Struct:
-
Orientation means the direction in which a character is facing. The following figure represents a character in 2D:
-
-
-
1|Page
Movement Artificial Intelligence for Games
-
In 2½D we deal with a full 3D position, but represent orientation as a single value, as if we are in two dimensions
In figure below ๐‘ค๐‘  is orientation as a scalar representation and ๐‘ค๐‘ฃ is the orientation expressed as vector
-
The velocity of a character shouldn’t change instantly this is not realistic at all!
The characters need to keep track of their linear and angular velocities (rotation). Linear velocity is the character’s
speed in x, z and maybe y components. Angular velocity (rotation) represents how fast the characters’ orientation is
changing. This is given by # of radius per second that the orientation is changing
Kinematic data of a character:
-
-
Steering behaviors operate with this kinematic data. They return accelerations that will change the velocities of a
character in order to move them around the level. Their output is a set of accelerations:
-
Examples of Kinematic Movement:
o Seek
o Flee
o Arriving
o Wandering (โ€ซ)ุงู„ุชุณูƒุนโ€ฌ
-
Steering Behaviors:
o Variable Matching
o Seek
o Flee
o Arrive
o Leave
2|Page
Download