Character Artificial Intelligence CE00875-3

34
Character Artificial Character Artificial Intelligence Intelligence CE00875-3 CE00875-3 Introduction to Agent-based AI Introduction to Agent-based AI Lecture 2 Lecture 2

description

Character Artificial Intelligence CE00875-3. Introduction to Agent-based AI Lecture 2. Agents, Animats and Game Platforms. What are agents and artificial life? Considerations for game AI Goal orientation, planning and control Reactive techniques for games Reflective vs Reactive behaviour. - PowerPoint PPT Presentation

Transcript of Character Artificial Intelligence CE00875-3

Page 1: Character Artificial Intelligence CE00875-3

Character Artificial Character Artificial IntelligenceIntelligenceCE00875-3CE00875-3

Introduction to Agent-based AI Introduction to Agent-based AI

Lecture 2Lecture 2

Page 2: Character Artificial Intelligence CE00875-3

Agents, Animats and Game Agents, Animats and Game PlatformsPlatforms • What are agents and artificial life?What are agents and artificial life?• Considerations for game AIConsiderations for game AI• Goal orientation, planning and controlGoal orientation, planning and control• Reactive techniques for gamesReactive techniques for games• Reflective vs Reactive behaviourReflective vs Reactive behaviour

Page 3: Character Artificial Intelligence CE00875-3

AgentsAgents• Arguably the most important development in AI of Arguably the most important development in AI of

the last decade has been the notion of agentsthe last decade has been the notion of agents• Comes from the philosophical notions of action, Comes from the philosophical notions of action,

and the notion of Rational Economic Manand the notion of Rational Economic Man• An agent is a self-contained bundle of software An agent is a self-contained bundle of software

with the characteristics of with the characteristics of autonomyautonomy, , actionaction and and rationalityrationality

• Related to, but more sophisticated than, the notion Related to, but more sophisticated than, the notion of an object in OOL. Higher level of abstraction, in of an object in OOL. Higher level of abstraction, in which what counts is the choice of action in which what counts is the choice of action in response to goals and situation.response to goals and situation.

• Newell’s concept of Newell’s concept of behavioural lawsbehavioural laws governing governing action egaction egAn agent will choose the action most likely to lead to an outcome that matches one of its An agent will choose the action most likely to lead to an outcome that matches one of its goals. goals.

• In a In a multi-agent systemmulti-agent system complex behaviour complex behaviour emerges as the result of the interactions between emerges as the result of the interactions between many, relatively simple agents according to many, relatively simple agents according to social social principlesprinciples

Page 4: Character Artificial Intelligence CE00875-3

• A-life shares some elements with agent research, especially the multi-agent approachA-life shares some elements with agent research, especially the multi-agent approach

• Earliest forms were a class of game called Earliest forms were a class of game called cellular automatacellular automata eg Conway’s Life eg Conway’s Life

• A few rules control the birth, survival and death of counters on a rectangular grid, to A few rules control the birth, survival and death of counters on a rectangular grid, to produce growing, complex patterns over cyclesproduce growing, complex patterns over cycles

Artificial Life – Cellular Artificial Life – Cellular automataautomata

Cells can be either live (contain counter) or dead (no counter). Each cell has 8 neighbours. To decide what will happen in a cell for each cycle, count the number of live and dead cells

1) A dead cell with exactly 3 live neighbors becomes a live cell (birth).

2) A live cell with 2 or 3 live neighbors stays alive (survival).

3) In all other cases, a cell dies or remains dead (overcrowding or loneliness).

Page 5: Character Artificial Intelligence CE00875-3

Artificial Life - NornsArtificial Life - Norns

Image: Cyberlife/New Scientist

• However, A-life today is about making biologically plausible software models

•Some of this work has resulted in extremely valuable creatures which may be used in game-playing scenarios eg Norns in Cyberlife’s Creatures

• Norns have a simulated body, with a ‘digestive system’ and ‘biochemistry’

Page 6: Character Artificial Intelligence CE00875-3

Considerations for Game Considerations for Game AIAI• Are the AI approaches applicable to the Are the AI approaches applicable to the software design of NPCs? software design of NPCs?

• ie able to provide:ie able to provide:– control of primitive behaviours control of primitive behaviours

• eg picking things up, pressing switches, using objects, etc.eg picking things up, pressing switches, using objects, etc.

– movement movement • move around the game world, dealing with obstacles and navigating move around the game world, dealing with obstacles and navigating

to target destinationsto target destinations

– decision-making decision-making • working out what tasks to perform, and in what orderworking out what tasks to perform, and in what order

• Traditionally, these things were done by Traditionally, these things were done by laborious, detailed, procedural laborious, detailed, procedural programming - now becoming more difficult programming - now becoming more difficult as games evolveas games evolve

• From a games point of view, use of AI not From a games point of view, use of AI not importantimportant

Page 7: Character Artificial Intelligence CE00875-3

Considerations for Game Considerations for Game AIAI• In nouvelle game AI, we consider how the needs of In nouvelle game AI, we consider how the needs of game designers work for (and against) AI methodsgame designers work for (and against) AI methods

• In games, some NPC characters need to behave In games, some NPC characters need to behave intelligently to be intelligently to be believablebelievable and and entertaining – entertaining – maybe easiermaybe easier to accomplish with AI programs...to accomplish with AI programs...

• ...but only if the program can really ...but only if the program can really performperform (very (very fast response to new situation) - challenging for AIfast response to new situation) - challenging for AI

• Software control of actions within a game has until recently needed to be explicit – ie scripting• For each of a number of situations arising in the game, a standard behaviour response is rigidly encoded• More recently, agent and other AI technologies have enabled implicit control – NPC assesses situation, chooses its action with respect to its own goals

Page 8: Character Artificial Intelligence CE00875-3

Considerations for Game Considerations for Game AIAI• Basic conflict for game design: Building in intelligence allows NPC Basic conflict for game design: Building in intelligence allows NPC characters to behave autonomously, yet human designers need to characters to behave autonomously, yet human designers need to control them, to make the game work as expectedcontrol them, to make the game work as expected

• Eg many games follow a script like a movie, so that a certain Eg many games follow a script like a movie, so that a certain sequence of events happens to unfold a story line. If NPCs sequence of events happens to unfold a story line. If NPCs (especially learning ones) can run their own show, they might not (especially learning ones) can run their own show, they might not stick to the script!stick to the script!

• What role would intelligent decisions have in a scripted storyline?What role would intelligent decisions have in a scripted storyline?

• One idea would be implicit design – no explicit script, just the One idea would be implicit design – no explicit script, just the elements of an interesting world and both player and NPC elements of an interesting world and both player and NPC improviseimprovise

• Another is to Another is to alternate sequencesalternate sequences of scripted action (in which the of scripted action (in which the NPCs intelligence is switched off) with free form action (in which the NPCs intelligence is switched off) with free form action (in which the intelligence is on). Might be difficult to keep on track though!intelligence is on). Might be difficult to keep on track though!

Page 9: Character Artificial Intelligence CE00875-3

Goal-orientation, planningGoal-orientation, planning• Goals may be defined as a representation of a state of affairs Goals may be defined as a representation of a state of affairs

which is marked as somehow desirable, to be achievedwhich is marked as somehow desirable, to be achieved

• Maintenance goals involve making sure some state of affairs Maintenance goals involve making sure some state of affairs is not lost (eg keep breathing)is not lost (eg keep breathing)

• Achieving a goal may involve a number of actions to move Achieving a goal may involve a number of actions to move the actual state of the world closer to the desired state (eg the actual state of the world closer to the desired state (eg move toward a source of food or target)move toward a source of food or target)

• It might not be clear what to do next to get closer to a goal – It might not be clear what to do next to get closer to a goal – planning is needed to planning is needed to select and order individual actionsselect and order individual actions

• All this requires collecting and maintaining models of the All this requires collecting and maintaining models of the world-state, comparing them to goal states and then making world-state, comparing them to goal states and then making decisionsdecisions

• This can take a lot of design and a lot of computationThis can take a lot of design and a lot of computation

• Planning programs exist, but they tend to be slow and Planning programs exist, but they tend to be slow and complexcomplex

Page 10: Character Artificial Intelligence CE00875-3

The problem of planningThe problem of planning• Conventional AI planning program requiresConventional AI planning program requires• i) a list of goals represented using a knowledge i) a list of goals represented using a knowledge

representationrepresentation• ii) a problem in the form of some data ii) a problem in the form of some data

representing opportunities or problemsrepresenting opportunities or problems• iii) a set of possible actions which the machine iii) a set of possible actions which the machine

can choose fromcan choose from iv) a planning algorithm which organises actions iv) a planning algorithm which organises actions

into a optimal planinto a optimal plan

The program would then do standard The program would then do standard information processing:information processing:

1) accepts these as data files1) accepts these as data files 2) process the data2) process the data 3) prints out an optimal plan, ie ordered list of 3) prints out an optimal plan, ie ordered list of

actionsactions

Page 11: Character Artificial Intelligence CE00875-3

Reflective vs Reactive Reflective vs Reactive BehaviourBehaviour

• This distinction is important to game development, mostly This distinction is important to game development, mostly because of the need for fast reactionsbecause of the need for fast reactions

• Early AI tended to be Early AI tended to be reflectivereflective – meaning that a problem- – meaning that a problem-solving algorithm would exhaustively consider all possible solving algorithm would exhaustively consider all possible courses of action, then choose the optimal (in terms of goal courses of action, then choose the optimal (in terms of goal satisfaction) one satisfaction) one

• Humans don’t really do that, though. They Humans don’t really do that, though. They satisficesatisfice, which , which means come up with a “good enough” solution, but more means come up with a “good enough” solution, but more quickly, especially when time is an issue. Saves mental quickly, especially when time is an issue. Saves mental effort effort

• Reflective programs Reflective programs build representational modelsbuild representational models from from input data, evaluate or reason about them, plan a course of input data, evaluate or reason about them, plan a course of action then output it – expensive in computing poweraction then output it – expensive in computing power

• Reactive programs Reactive programs use the world as their modeluse the world as their model. They . They interact directly with the world, exploiting simple signals interact directly with the world, exploiting simple signals and regularities there, to get behaviour which is not perfect, and regularities there, to get behaviour which is not perfect, but fastbut fast

• Now game AI tends to be mostly reactive Now game AI tends to be mostly reactive

Page 12: Character Artificial Intelligence CE00875-3

<train bearing down>

Image: Mike Williams

One does not want to be stuck in high-level planning when there’s an emergency bearing down on you

Maybe it’s quicker and easier to sense the world and act directly on it, instead of building and maintaininginternal models of the world

This is how insects are able to do a lot of clever things without a bigbrain and lots of memory

Image: Benjamin Hobson, The Canal Gallery

Page 13: Character Artificial Intelligence CE00875-3

AnimatsAnimats• To simplify writing of AI code, the environment and To simplify writing of AI code, the environment and

integrating the two, we can use a standard development integrating the two, we can use a standard development platform, Unreal Development Kit, UDKplatform, Unreal Development Kit, UDK

• Creates Creates embodiedembodied bots ie that have a (simulated) body, are bots ie that have a (simulated) body, are subject to physical constraints in the (simulated) world and subject to physical constraints in the (simulated) world and do not have full information about the gamedo not have full information about the game

• Just as human game players has an Just as human game players has an avatar avatar in the game in the game world, so a disembodied AI software controls its own avatarworld, so a disembodied AI software controls its own avatar

• Unreal is designed to support development of an first Unreal is designed to support development of an first person shooter games.person shooter games.

• The game developer specifies the interfaces, modules and The game developer specifies the interfaces, modules and architectures of an bot in a given world, in a architectures of an bot in a given world, in a domain-specific domain-specific languagelanguage called Uscript but has a myriad of other features called Uscript but has a myriad of other features which support various game-specific AI concepts.which support various game-specific AI concepts.

Page 14: Character Artificial Intelligence CE00875-3

Reactive Techniques for Reactive Techniques for GamesGames

• Another advantage of reactive designs is that they tend Another advantage of reactive designs is that they tend to be to be deterministicdeterministic – fully specified by inputs – fully specified by inputs

• That means reactive code can very simple, easy to That means reactive code can very simple, easy to test and be highly optimised for speed egtest and be highly optimised for speed eg

- lookup tables- lookup tables - scripts- scripts - rule-based systems- rule-based systems - Finite State Machines- Finite State Machines

•Benefits of bots

- fits in with the idea of embodiment very well- environment can be enriched which provides more information to the bot- most learning techniques are based on reactive mappings- easy to create, test and maintain

Page 15: Character Artificial Intelligence CE00875-3

Environments, simulations, Environments, simulations, platformsplatforms • According to the notion of According to the notion of embodimentembodiment, the best place for , the best place for

an AI in immersed in the world, connected to it by many an AI in immersed in the world, connected to it by many sensorssensors and and actuators actuators Eg Eg a robot roams about a house, sensing a robot roams about a house, sensing with cameras, microphones andwith cameras, microphones and using motorised limbs to moveusing motorised limbs to move

• Game AI modifies this slightly, and says the ‘world’ doesn’t Game AI modifies this slightly, and says the ‘world’ doesn’t have to be physical – it have to be physical – it can be a computer simulation of the can be a computer simulation of the real worldreal world– AdvantagesAdvantages

• Cheaper and smaller than robots in the real worldCheaper and smaller than robots in the real world• Can develop and make changes faster in simulationCan develop and make changes faster in simulation• Can’t do any harm if it goes wrong Can’t do any harm if it goes wrong

– DisadvantagesDisadvantages• world may be too simple to properly challenge an AI programworld may be too simple to properly challenge an AI program• world may not be realistic, or even logically consistentworld may not be realistic, or even logically consistent• may have to build - or at least configure - an artificial world; extra workmay have to build - or at least configure - an artificial world; extra work

• In game AI, we are more or less forced use to a simulated In game AI, we are more or less forced use to a simulated world. But this is still better than prepared, cut-and-dried world. But this is still better than prepared, cut-and-dried data setsdata sets

Page 16: Character Artificial Intelligence CE00875-3

Reactive animat, search and Reactive animat, search and obstacle avoidanceobstacle avoidance

• Game’s “Physical” EnvironmentGame’s “Physical” Environment• Machine VisionMachine Vision• Representing Space in the Game Representing Space in the Game

WorldWorld• Movement in the Game WorldMovement in the Game World• Navigation in the Game WorldNavigation in the Game World• Obstacle AvoidanceObstacle Avoidance• A Reactive Control SystemA Reactive Control System

Page 17: Character Artificial Intelligence CE00875-3

Game’s “Physical” Game’s “Physical” EnvironmentEnvironment

• We may distinguish between two aspects of a game environment:We may distinguish between two aspects of a game environment:

StructureStructure - topography of the environment as it constrains movement (physics and layout of walls, paths, - topography of the environment as it constrains movement (physics and layout of walls, paths, obstacles etc.obstacles etc.

DetailDetail – graphical appearance of the game world and placement of objects which don’t impede movement – graphical appearance of the game world and placement of objects which don’t impede movement

• What about players, NPCs and monsters? Really need to consider moving What about players, NPCs and monsters? Really need to consider moving things as a things as a third categorythird category, especially when interactions go beyond simply , especially when interactions go beyond simply destroying everything you see destroying everything you see

• Humans perceive the world mostly Humans perceive the world mostly visually through detailvisually through detail, while AI sees , while AI sees the world a as the world a as simplified data structuressimplified data structures and must interpret these as well and must interpret these as well as it canas it can

• We can try to make an AI interpret the graphical world directly, as if it was We can try to make an AI interpret the graphical world directly, as if it was seeing through eyes, but such seeing through eyes, but such machine vision machine vision has proven to be very has proven to be very difficult to program and expensive to compute (at least at a human level of difficult to program and expensive to compute (at least at a human level of skill)skill)

• It is an important concept of nouvelle game AI that an animat should only It is an important concept of nouvelle game AI that an animat should only have local, not global, knowledge of the game (like a human) have local, not global, knowledge of the game (like a human)

• Having complete, perfect knowledge of the world is not good for AI or Having complete, perfect knowledge of the world is not good for AI or gamesgames

Page 18: Character Artificial Intelligence CE00875-3

Machine VisionMachine Vision

• To get more sophisticated output information requires more To get more sophisticated output information requires more complex processing. Eg. scene analysis to aid robot navigation – complex processing. Eg. scene analysis to aid robot navigation – hard hard

• The output for that would be information enabling the robot to The output for that would be information enabling the robot to identify particular objects, or find their range and bearing, to help identify particular objects, or find their range and bearing, to help navigate around themnavigate around them

• Getting a machine to see is a traditional sub-discipline of AIGetting a machine to see is a traditional sub-discipline of AI

• A typical system might involve a camera returning a digitised A typical system might involve a camera returning a digitised image, interpretive software and some kind of output image, interpretive software and some kind of output arrangementarrangement

• Eg handwritten letter recogniser – easyEg handwritten letter recogniser – easy

ASCII for ‘2’00110010

digitalcamera

patternrecognitionsoftware

data representationraw image

Page 19: Character Artificial Intelligence CE00875-3

Face recognition from security video is now a mainstream application of machine vision

Page 20: Character Artificial Intelligence CE00875-3

Representing Space in the Game Representing Space in the Game WorldWorld• How space is represented is importantHow space is represented is important

• 2D vs 3D – how the location of objects is encoded in the 2D vs 3D – how the location of objects is encoded in the structure, not how the detail makes the world appearstructure, not how the detail makes the world appear

• Discrete vs continuous – meaning whether objects are placed Discrete vs continuous – meaning whether objects are placed in a grid or matrix with a finite number of locations or not (eg in a grid or matrix with a finite number of locations or not (eg chess vs marbles)chess vs marbles)

• Representation of time - also discrete (turn-taking) or Representation of time - also discrete (turn-taking) or continuous (stream of consciousness)continuous (stream of consciousness)

• Conversions – discrete vs continuous is a relative matter, since Conversions – discrete vs continuous is a relative matter, since a fine enough unit size (grid or time-steps) may be considered a fine enough unit size (grid or time-steps) may be considered continuous in practicecontinuous in practice

• In fact, all representations in computers must ultimately be In fact, all representations in computers must ultimately be discrete, approximating continuous to a greater or lesser discrete, approximating continuous to a greater or lesser degree!degree!

Page 21: Character Artificial Intelligence CE00875-3

Movement in the Game Movement in the Game WorldWorld

• At present, game engines provide a At present, game engines provide a locomotion layerlocomotion layer which abstracts which abstracts basic movement actionsbasic movement actions away from the away from the strategic control of directionstrategic control of direction

• Physics simulation is required to handle gravity, throwing, fire, water Physics simulation is required to handle gravity, throwing, fire, water etc.etc.

• Low level motion might nowLow level motion might nowbe handled by the AIbe handled by the AI

Simulation loop(walking, running)physics handles displacementanimation handles limb cycling

Integrationsignals from environmentalter behaviour as appropriate (eg falls)

Control(forward/backward, turns)signals from user orparameters via API fromthe decision-making AI

locomotion layer

Collision detectionPhysics in the game signals a collision halting(forward) motion

Image: Chris Bayliss

Page 22: Character Artificial Intelligence CE00875-3

Representing Space in the Game Representing Space in the Game WorldWorld

• In a classical AI navigation experiment, travel paths in the In a classical AI navigation experiment, travel paths in the world model might be represented at design-time as a world model might be represented at design-time as a graph,graph, with nodes representing rooms and arcs with nodes representing rooms and arcs representing passages or doors between themrepresenting passages or doors between them

• Finding an Finding an optimal pathoptimal path from a current location to a target from a current location to a target was then a matter of was then a matter of search search on the graphon the graph

• There are well-studied and good There are well-studied and good search algorithmssearch algorithms available available

Page 23: Character Artificial Intelligence CE00875-3

Search - BasicsSearch - Basics• UninformedUninformed search algorithms simply follow a pattern to search algorithms simply follow a pattern to

examine all nodes until one containing the goal is found examine all nodes until one containing the goal is found (aka “brute force”)(aka “brute force”)

• Depth-firstDepth-first search - start at a root and explore as far as search - start at a root and explore as far as possible along each branch before backtracking until goal possible along each branch before backtracking until goal is foundis found

• Breadth-first Breadth-first search - start at a root and explore all search - start at a root and explore all neighbouring nodes, then for each neighbour, explore their neighbouring nodes, then for each neighbour, explore their unexplored neighbours, and so on until goal is foundunexplored neighbours, and so on until goal is found On this graph, starting at A, choosing

left nodes before right and remembering previously visited nodes:

- Depth First Search visits nodes in this order: A,B,D,F,E,C,G

-Breadth First Search visits nodes in this order: A,B,C,E,D,F,G

Page 24: Character Artificial Intelligence CE00875-3

Search – Using Domain Search – Using Domain InformationInformation• InformedInformed search algorithms use some method to choose search algorithms use some method to choose

intelligently which node to search nextintelligently which node to search next

• Best-first searchBest-first search – modifies breadth-first method to order all – modifies breadth-first method to order all current paths by a heuristic which estimates how close the end of current paths by a heuristic which estimates how close the end of the path is to a goal. Paths that are closest to a goal are the path is to a goal. Paths that are closest to a goal are extended first. extended first.

• A* searchA* search - is a best-first method that calculates a cost and an - is a best-first method that calculates a cost and an estimate for the path leading to each node: estimate for the path leading to each node:

• Cost is zero for the first node; for all others, cost is the cumulative Cost is zero for the first node; for all others, cost is the cumulative sum associated with all its ancestor nodes plus the cost of the sum associated with all its ancestor nodes plus the cost of the operation which reached the node (e.g. linear distance)operation which reached the node (e.g. linear distance)

• An estimate measures how far a given node is thought to be from An estimate measures how far a given node is thought to be from a goal state (e.g. intensity on a sensory gradient)a goal state (e.g. intensity on a sensory gradient)

• Cost and estimate are summed to score each path for eligibility Cost and estimate are summed to score each path for eligibility for explorationfor exploration

• For more detail, view the ‘Graph Search Methods’ link on the For more detail, view the ‘Graph Search Methods’ link on the websitewebsite

Page 25: Character Artificial Intelligence CE00875-3

Navigation in the Game WorldNavigation in the Game World• There are problems with this kind of classical search however:There are problems with this kind of classical search however:

– Depends on global information at design-time, soDepends on global information at design-time, so– Question of realism arises – not comparable with the limited Question of realism arises – not comparable with the limited

viewpoint of real biological creaturesviewpoint of real biological creatures– A lot of information may overwhelm decision-making processesA lot of information may overwhelm decision-making processes– Information does not update dynamically via sensors, so cannot track Information does not update dynamically via sensors, so cannot track

changes (eg moving creatures in the world) changes (eg moving creatures in the world)

• Nouvelle game AI animats are (virtually) embodied, which Nouvelle game AI animats are (virtually) embodied, which implies thatimplies that

- They have a (simulated) limited perceptual system which updates the - They have a (simulated) limited perceptual system which updates the AI AI continuously continuously

- They need more plausible navigation algorithms which can work on - They need more plausible navigation algorithms which can work on limited information and in real time limited information and in real time

• For now, we are interested in reactive solutionsFor now, we are interested in reactive solutions

• Fortunately, such solutions have been studied for the design of Fortunately, such solutions have been studied for the design of robotsrobots

Page 26: Character Artificial Intelligence CE00875-3

Modelling a Bot’s State in SpaceModelling a Bot’s State in Space• For many (but not all) AI models, need a description of the For many (but not all) AI models, need a description of the

animat’s position and orientation in space, as well as how it will animat’s position and orientation in space, as well as how it will movemove

(0,0)World Origin

Animat(3,3)

Object(6,1)

Absolute Coordinate System (0,0)Egocentric Origin

Animat

Object(3,2)

Relative Coordinate System

Continuous moves and turns

any distance

any angle

Discrete moves and turns

unit distance

90 deg angles

Page 27: Character Artificial Intelligence CE00875-3

Obstacle Avoidance – Basic Obstacle Avoidance – Basic functionalityfunctionality• Finding one’s way around obstacles is fundamental to Finding one’s way around obstacles is fundamental to

navigationnavigation

• Well suited to implementation by a reactive control Well suited to implementation by a reactive control systemsystem

• Begins from general principles: Begins from general principles: 1. When no obstacle is sensed, move

ahead normally (straight or wandering randomly)

2. If wall detected on one side, veer away slowly

3. If obstacle detected ahead, turn to one side to avoid it

4. When stuck in a corner, a more radical turn is needed

1

23

4

Page 28: Character Artificial Intelligence CE00875-3

A Reactive Control SystemA Reactive Control System• A reactive system requires three elements:A reactive system requires three elements:

• 1) a 1) a set of perceptual and action functionsset of perceptual and action functions, which apply in a , which apply in a particular situationparticular situation

• 2) a 2) a mapping showing which percepts release which behavioursmapping showing which percepts release which behaviours. . That means a theory about how the animat behave (note related That means a theory about how the animat behave (note related to idea of behavioural laws for agents). See previous slide. to idea of behavioural laws for agents). See previous slide.

• An if-else-if-else structure could be used to order calls to An if-else-if-else structure could be used to order calls to perceptual perceptual and motor functions – proceduraland motor functions – procedural

• A rule-based system (later topic!) is another possibility – A rule-based system (later topic!) is another possibility – declarativedeclarative

• UDK is based on the UDK is based on the client-server modelclient-server model. Requests by a client . Requests by a client are made and do not return until the server has computed a are made and do not return until the server has computed a result. Usually based on simple function calls. Commonly used result. Usually based on simple function calls. Commonly used for the delegation of tasksfor the delegation of tasks

Page 29: Character Artificial Intelligence CE00875-3

A Reactive Control SystemA Reactive Control System• Could also use Could also use asynchronous eventsasynchronous events. Based on something called . Based on something called

the observer design pattern: have a set of behaviours ready to the observer design pattern: have a set of behaviours ready to go and a set of events that will trigger them. A kind of go and a set of events that will trigger them. A kind of event-event-based processingbased processing

• These can interrupt another routine and transfer control when These can interrupt another routine and transfer control when something comes up unexpectedlysomething comes up unexpectedly

• These should operate in ‘parallel’, competing for control of the These should operate in ‘parallel’, competing for control of the animat’s body => need for 3) animat’s body => need for 3) arbitrationarbitration in case of a tie in case of a tie

• How are competing motor outputs combined to control the How are competing motor outputs combined to control the limbs?limbs?

- Independent sum- Independent sum – different outputs connected to different effectors – different outputs connected to different effectors so that they cannot clashso that they cannot clash

- Combination - Combination – some formula (eg weighted sum) combines two or – some formula (eg weighted sum) combines two or more outputs to blend them into output commandsmore outputs to blend them into output commands

- Suppression- Suppression – certain components get priority over others, and can – certain components get priority over others, and can replace their output with their own (eg. subsumption architecture)replace their output with their own (eg. subsumption architecture)

- Sequential- Sequential – output of different behaviours getting control at – output of different behaviours getting control at alternate timesalternate times

Page 30: Character Artificial Intelligence CE00875-3

Subsumption architecture Subsumption architecture works on real robots!works on real robots!

Cruise

Follow

Avoid

Escape

Random Act

Photosensors

IR proximity

Bump switches

Motor command

Motor load s

s

s

s

sSensory triggers

Page 31: Character Artificial Intelligence CE00875-3

Heroes of AI Heroes of AI ##3 – The Radical3 – The Radical • The radical idea that sophisticated robot behaviour could be accomplished without high-powered computing was advanced in the 1980s by ex-patriot Australian engineer Rodney Brooks. At the time robots were slow and clumsy, using classical planning to compute their motions

• Brooks argued that robots could interact directly with the world via properly designed reactive network of sensors and actuators, and created a number of behaviour-based control architectures for robots. Without the need for complex representations. In the 1990s he and his students at the MIT robotics lab demonstrated ever more ingenious robots that used his subsumption architecture. • Brooks was featured in a 1997 documentary called “Fast, Cheap and Out of Control’, the name of his paper to the British Interplanetary Society arguing that insect-like robots could be used for exploration of the solar system.

• Formed a company called iRobot, which now provides pack-bot robots to the US military as well as mass producing Rhoomba floor-cleaning robots

• Latest and most demanding project is Cog, a behaviour-based humanoid robot

Page 32: Character Artificial Intelligence CE00875-3

Summary• Agents are an AI development which enables software to Agents are an AI development which enables software to

choose actions autonomously to achieve one or more goals choose actions autonomously to achieve one or more goals which it haswhich it has

• Artificial life is an attempt to model the more biological Artificial life is an attempt to model the more biological aspects of life, such as reproduction (Life) or the digestion aspects of life, such as reproduction (Life) or the digestion of food (eg Norns)of food (eg Norns)

• Both these technologies can be used to make lifelike, Both these technologies can be used to make lifelike, believable and entertaining NPCs for computer gamesbelievable and entertaining NPCs for computer games

• The software control of NPCs can be explicit (eg scripts) or The software control of NPCs can be explicit (eg scripts) or implicit (eg rational agent)implicit (eg rational agent)

• Good control of gameplay in interactive games is part of the Good control of gameplay in interactive games is part of the artart

• In conventional AI, accomplishment of goals required In conventional AI, accomplishment of goals required planning, which could be complex and processor-intensiveplanning, which could be complex and processor-intensive

• Conventional AI planners were reflective, which means they Conventional AI planners were reflective, which means they did not excel in time critical situations (like games)did not excel in time critical situations (like games)

• Behavioural control in games tends to be reactive, which Behavioural control in games tends to be reactive, which means less logical modeling of the world and more reacting means less logical modeling of the world and more reacting directly to stimuli directly to stimuli

Page 33: Character Artificial Intelligence CE00875-3

SummarySummary• Game virtual worlds generally distinguish structure and detail. Moving Game virtual worlds generally distinguish structure and detail. Moving

objects could be considered a third categoryobjects could be considered a third category

• Humans see detail, but game characters generally interact via structureHumans see detail, but game characters generally interact via structure

• Machine vision is an important but difficult sub-field of AIMachine vision is an important but difficult sub-field of AI

• The representation of space and time may be 2D or 3D, discrete or The representation of space and time may be 2D or 3D, discrete or continuouscontinuous

• Present game engines provide a locomotion layer which abstracts basic Present game engines provide a locomotion layer which abstracts basic movement actions away from the strategic control of direction. In future movement actions away from the strategic control of direction. In future AI may automate basic interactions with worldAI may automate basic interactions with world

• Travel paths in through space may be represented as graphs. These are Travel paths in through space may be represented as graphs. These are traditionally searched by search methods such as breadth-first, traditionally searched by search methods such as breadth-first, depth-first, or A* search. Such search is a general problem-solving depth-first, or A* search. Such search is a general problem-solving methodmethod

• Reactive control systems require 1) perceptual & action functions Reactive control systems require 1) perceptual & action functions 2) a mapping from percepts to actions representing a theory of 2) a mapping from percepts to actions representing a theory of behaviour and 3) a method to arbitrate conflicts – to resolve which action behaviour and 3) a method to arbitrate conflicts – to resolve which action will be taken in case of a tiewill be taken in case of a tie

• Could be implemented procedurally as if-else-if statement or Could be implemented procedurally as if-else-if statement or declaratively as a set of rules in a RBSdeclaratively as a set of rules in a RBS

Page 34: Character Artificial Intelligence CE00875-3

ReferencesReferences• Brooks, R. & Flynn, A. Fast, Cheap and Out of Brooks, R. & Flynn, A. Fast, Cheap and Out of

Control: The Robotic Invasion of the Solar System.Control: The Robotic Invasion of the Solar System. Journal of The British Interplanetary Society, Vol. Journal of The British Interplanetary Society, Vol. 42, 1989, 478-485.42, 1989, 478-485.

• Newell, A. The Knowledge Level, Artificial Intelligence, 1982, 18, 87-127

• Martin Gardner. The fantastic combination of John Conway's new solitaire game of “life”. Scientific American, 1970, 223, 120-123

• Cliff D. & Grand S. The Creatures Global Digital Ecosystem. Artificial Life, 1999, 5, 1, 77-93