7.2. AI E NGINE AND S TEERING B EHAVIOUR I Design of an AI Engine and introduction to steering in game AI.

Slides:



Advertisements
Similar presentations
7.1. O SCARS & A RTIFICIAL I NTELLIGENCE Interim awards and introduction to game AI.
Advertisements

7.3. S TEERING B EHAVIOUR II Steering behaviours in game AI.
Mechatronics 1 Weeks 5,6, & 7. Learning Outcomes By the end of week 5-7 session, students will understand the dynamics of industrial robots.
Mechanisms Design MECN 4110
3.3. Introduction to Real-time Physics III
Flocking References: xxx.
Forward and Inverse Kinematics CSE 3541 Matt Boggus.
Trajectory Generation
Mechanics of Machines Dr. Mohammad Kilani
Artificial Intelligence in Game Design Introduction to Learning.
3.6. R ESTING C ONTACTS AND F RICTION Exploration of resting contacts and friction.
CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Lecture V Higher Level Motion Control CS274: Computer Animation and Simulation.
Steering Behaviors For Autonomous Characters
Games Programming III (TGP2281) – T1, 2010/2011 Movement AI John See 19, 26 Nov 2010.
Intelligent Steering Using PID controllers
3.7. O THER G AME P HYSICS A PPROACHES Overview of other game engine physics approaches.
ME451 Kinematics and Dynamics of Machine Systems Review of Elements of Calculus – 2.5 Vel. and Acc. of a Point fixed in a Ref Frame – 2.6 Absolute vs.
Rotational Dynamics Angular Momentum. Collisions. o Rotational Dynamics  Basic Concepts Rotation Angular speed Torque Angular Acceleration  Nature of.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
9.1. B OARD G AMES AND A IMING AI Common board game AI approaches and Aiming AI.
Constraints-based Motion Planning for an Automatic, Flexible Laser Scanning Robotized Platform Th. Borangiu, A. Dogar, A. Dumitrache University Politehnica.
Section 13.4 The Cross Product. Torque Torque is a measure of how much a force acting on an object causes that object to rotate –The object rotates around.
Chapter 10 Rotation of a Rigid Object about a Fixed Axis.
Geometric Transforms Changing coordinate systems.
Flow Fields Hao Li and Howard Hamilton. Motivation for Flow Fields Multiple AI algorithms in a computer game can produce conflicting results. The AI must.
Finish Momentum Start Spinning Around
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
An Iterated Method to the Dubins Vehicle Travelling Salesman Problem OBJECTIVES Develop an algorithm to compute near optimal solutions to the Travelling.
Review IMGD Engine Architecture Types Broadly, what are the two architecture types discussed for game engines? What are the differences?
Math / Physics 101 GAM 376 Robin Burke Fall 2006.
Kinematics in 2-D Concept Map
DESCRIBING MOTION: Kinematics in One Dimension CHAPTER 2.
Maths & Technologies for Games Animation: Practicalities CO3303 Week 3.
Multimedia System and Networking UTD Slide- 1 University of Texas at Dallas B. Prabhakaran Rigging.
ME451 Kinematics and Dynamics of Machine Systems Vel. And Acc. of a Fixed Point in Moving Frame Basic Concepts in Planar Kinematics February.
Artificial Intelligence in Game Design Complex Steering Behaviors and Combining Behaviors.
Character Setup In addition to rigging for character models, rigging artists are also responsible for setting up animation controls for anything that is.
Introduction to Particle Simulations Daniel Playne.
Games Development 2 Entity Update & Rendering CO3301 Week 2, Part 1.
Chipmunk Physics Remember that we talked about this a bit when we did collision handlers for the space ship integration task (SpritesActionsPhysicsSound).
Basic Steering of Game Agents Featuring Guest professors Stephen Sheneman & Michael Wilkens 1.
REFERENCES: FLOCKING.
Computer Graphics Basic Maths for Graphics in C++ CO2409 Computer Graphics Week 4.
City College of New York 1 John (Jizhong) Xiao Department of Electrical Engineering City College of New York Mobile Robot Control G3300:
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
Advanced Games Development Game Physics CO2301 Games Development 1 Week 19.
Graphics for Games Particle Systems CO2301 Games Development 1 Week 23.
CSCI 4310 Lecture 5: Steering Behaviors in Raven.
Demonstration of Simple Movement using Python AI for Gaming 2013, SCU.
Dynamics. Motion with Regard to Mass Particle Dynamics Mass concentrated in point Newton’s Equation Governs Motion f = M x.
Advanced Games Development Physics Engines 2 CO2301 Games Development 1 Week 21.
Review IMGD Engine Architecture Types Broadly, what are the two architecture types discussed for game engines? What are the differences?
Computer Graphics Basic Maths for Graphics in C++
行動 (Movement) 靜宜大學資工系 蔡奇偉 副教授.
Character Animation Forward and Inverse Kinematics
Introduction To Robotics
3.7. Other Game Physics Approaches
CIS 488/588 Bruce R. Maxim UM-Dearborn
Manipulator Dynamics 2 Instructor: Jacob Rosen
CIS 488/588 Bruce R. Maxim UM-Dearborn
Steering behaviours in game AI
Robot Kinematics We know that a set of “joint angles” can be used to locate and orientate the hand in 3-D space We know that the joint angles can be combined.
9.1. Board Games and Aiming AI
© Sharif University of Technology - CEDRA By: Professor Ali Meghdari
Advanced Games Development Game Physics
Special English for Industrial Robot
Chapter 4 . Trajectory planning and Inverse kinematics
Introduction to Artificial Intelligence Lecture 22: Computer Vision II
Presentation transcript:

7.2. AI E NGINE AND S TEERING B EHAVIOUR I Design of an AI Engine and introduction to steering in game AI

Design of a game Artificial Intelligence Engine

In simple games, AI tends to be bespoke and individually written for each character (e.g. embedded within the layer/object update method). In more complex games there is a need to have a set of general AI routines that can be controlled by level designers, etc. There is often a need to manage CPU/memory constraints. Aside: Unless you explicitly wish to do so, you do not need to define a separate AI engine in your relatively simple game.

The AI gets some time to perform / progress its routines. Higher-level AI applies to groups, whilst lower-level AI operates on individual game objects. The AI engine can query the world to obtain information. The output of the AI engine is turned into actions that update the game state. AI receives processor time AI output is turned into action AI obtains world information Aside: Not all games need all types of AI, e.g. Board games may only need strategic AI, whilst a scrolling shooter may only need simple movement AI.

The movement component contains a range of algorithms that make decisions about motion. There are a range of movement algorithms, from very simple, to very complex.

Each game character will typically have a range of different behaviours that can be performed. The decision making process determines which behaviour is best at a given point in time. Selected behaviours are then translated into action (possibly making use of movement AI, or simply triggering an animation).

In order to coordinate the behaviour of multiple game objects some form of strategic AI is often needed. In other words, strategic AI controls/ influences the behaviour of a group of characters, often devolving the execution of the group behaviour to individual decision making / movement algorithms.

Introduction to the different forms of movement AI Execution Management World Interface Movem ent Strat egy Decision Making AnimationPhysics

The aim of movement AI is to sensibly move game objects around the level. All movement algorithms take as input data about the state of the world and output geometric data about the desired form of movement. Some algorithms only require the object’s position and a target position. Others algorithms require lots of interaction with objects (e.g. collision avoidance, etc.). Some algorithms directly output a new velocity (termed kinematic movement), others output an acceleration/force used to update the object’s velocity (termed dynamic or steering behaviours)

All game objects can be defined as having a position and an orientation. In some game types a movement algorithm can directly update the position/orientation (e.g. tile-based). However, this will look unrealistic in other types of game (e.g. driving). In order to permit continuous (2D) movement it is necessary to store: Vector position float orientation ; Vector velocity ; float rotation ; Steering algorithms output an acceleration (or force) applied to directional or rotational velocities. Using the Newton Euler equations, the variables can be updated as follows: velocity += acceleration * time_delta rotation += angular_acc * time_delta position += velocity * time_delta orientation += rotation * time_delta Aside: In most 3D games, characters are usually under the influence of gravity, with movement effectively constrained to just two dimensions

Basic forms of kinematic movement algorithm Execution Management World Interface Movem ent Strat egy Decision Making AnimationPhysics Based upon Artificial Intelligence for Games

Kinematic movement algorithms operate using positions and orientations. The output is a target velocity (speed + orientation). The speed may simply vary between full speed and stationary, i.e. kinematic algorithms do not use acceleration. This section will explore the following basic forms of kinematic movement algorithm: Seek() Flee() Arrive() To do: Consider if applicable

Seek takes as input a current and target location. The algorithm calculates the direction from the current to the target location and defines a matching velocity. The velocity can be used to define the output orientation if needed. Seek ( Vector source, Vector target, float maxSpeed ) { Vector velocity = ( target – source ).normalise() * maxSpeed; return velocity; } DetermineOrientation ( Vector velocity, float currentOrientation ) { if( velocity.length() == 0 ) return currentOrientation; else return Math. atan2( -velocity.x, velocity.y) } Current velocity Target velocity normalise() will return vector of unit length and same direction See common on next slide for atan

Flee is the opposite of Seek, i.e. the object moves away from their target. It can simply be defined as the opposite of the velocity returned by Seek, i.e: Flee ( Vector source, Vector target, float maxSpeed ) { Vector velocity = ( source – target ).normalise() * maxSpeed; return velocity; } Aside: Why atan2 on last slide? atan2 computes the arctangent of y/x in a range of (−π, π), i.e. it determines the counter clockwise angle (radians) between the x-axis and the vector in 2D Euclidean space. The normal atan function returns a range of (−π/2, π/2) This is useful to find the direction from one point to another.

A problem with Seek is that it can keep overshooting the target, never reaching it. One means to overcome this is to provide a buffer ‘close enough’ region around the target. Another is to reduce the speed as the target comes close. Both approaches can be combined as follows: Arrive ( Vector source, Vector target, float maxSpeed, float nearRadius ) { float slowingFactor = 0.2; Vector velocity = [0,0,...]; Vector separation = (target – source); if ( separation.length() < nearRadius ) return velocity; velocity = separation / slowingFactor ; if( velocity.length() > maxSpeed ) velocity = velocity.normalise() * maxSpeed; return velocity; } vel = max vel= max * 0.75 vel= max * 0.6 vel= max * 0.4 Closeness threshold Aside: As with seek, etc., the returned velocity can be used to provide the object’s orientation if desired. slowingFactor = slowing strength Determine velocity, and cap at max speed if needed Return initial velocity = 0.0

Forms of dynamic (or steering) movement algorithm Execution Management World Interface Movem ent Strat egy Decision Making AnimationPhysics Based upon Artificial Intelligence for Games

Steering behaviours extend the kinematic movement algorithms by determining acceleration (both forward movement and rotation) In many game types (e.g. driving games) steering algorithms are often used. In other games, they may not be useful. We will consider the following forms of steering behaviour: Seek() Flee() Arrive() Wander() To do: Consider if applicable Face() Separate() PathFollow() AvoidObstacle() Jump() Pursue() Evade() Interpose() Align()

Basic steering algorithms operate by trying to match some kinematic property of the target to the source, e.g. this might be the target’s position, velocity, orientation, etc. Matching steering algorithms take source and target kinematic properties as input. More advanced steering behaviours try to match a combination of properties, potentially with additional constraints. Typically for each matching behaviour there is a readily defined opposite behaviour (e.g. Seek vs. Flee, etc.). Flee pathSeek path

The next lecture will consider the steering behaviours in detail. As part of completing the Question Clinic for this week, please do think about the role of AI (including movement based AI) in your game and identify current areas of uncertainty. To do: Think about movement

To do: Complete Question Clinic Iterate/refine your game design to define AI needs Continue to plan what you hope to do for the Alpha handin Today we explored: The design of an AI engine Kinematic forms of movement AI Introduction to steering forms of movement AI