21
Character Artificial Character Artificial Intelligence Intelligence CE00875-6 CE00875-6 Introduction to Module Introduction to Module Lecture 1 Lecture 1 1

Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Embed Size (px)

Citation preview

Page 1: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Character Artificial Character Artificial IntelligenceIntelligenceCE00875-6 CE00875-6

Introduction to ModuleIntroduction to Module

Lecture 1 Lecture 1

11

Page 2: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Module Team And Module Team And AssessmentAssessment

• Teaching TeamTeaching Team– Bob Hobbs – K354 – [email protected] Hobbs – K354 – [email protected]– Di Bishton – K229 – Di Bishton – K229 –

[email protected]@staffs.ac.uk– Steve Foster – K215 – [email protected] Foster – K215 – [email protected]

• AssessmentAssessment– 100% coursework100% coursework– Partly from report, Partly from report, – Partly from small projectPartly from small project

22

Page 3: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

ScheduleSchedule

33

Bob Hobbs Intro to Module

Di Bishton Behaviour, Empathy and Emotions

Di Bishton Gestures and non-verbal communication

Di Bishton Empathy and Cognition

Bob Hobbs State Machines

Bob Hobbs Neural Networks

Steve Foster Fuzzy Logic

Steve Foster Fuzzy Logic II

Steve Foster Genetic Algorithms

Bob Hobbs Collaborative Intelligence

Bob Hobbs Crowd Behaviour

All Emotion in games

Page 4: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Computer Games, AI and AI Computer Games, AI and AI in Gamesin Games• Computer games todayComputer games today• What is AI, anyway?What is AI, anyway?• The uses of AI in gamesThe uses of AI in games• Brief history of AI in gamesBrief history of AI in games• AI methodologiesAI methodologies• Heroes of AIHeroes of AI• What we want from AIWhat we want from AI• What we’ll do in this moduleWhat we’ll do in this module

See also http://www.aigamedev.comSee also http://www.aigamedev.com44

Page 5: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Computer Games – Some Computer Games – Some TermsTerms

• Video gamesVideo games are any sort of game played primarily via a are any sort of game played primarily via a video display such as a monitor or televisionvideo display such as a monitor or television

• Video games include:Video games include:

- computer games, - computer games, ie software designed to run on PCs (eg ie software designed to run on PCs (eg Doom, Sim CityDoom, Sim City) )

- - console gamesconsole games, which are software/firmware designed to , which are software/firmware designed to work work with proprietary boxes that typically plug into a television with proprietary boxes that typically plug into a television set set such as Sony Playstation, Xbox etc. (eg such as Sony Playstation, Xbox etc. (eg C.O.D, Heavenly C.O.D, Heavenly Sword Sword ))

- games that work on mobile phones or PDAs (eg - games that work on mobile phones or PDAs (eg Tour of Tour of DutyDuty))

• Most of the games we will consider in this module are Most of the games we will consider in this module are computer gamescomputer games

55

Page 6: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Computer Games – The Computer Games – The MarketMarket• The world market was $24.5 billion in 2003, and The world market was $24.5 billion in 2003, and

is expected to grow every year by about 5%is expected to grow every year by about 5%

• What was once a small part of the software What was once a small part of the software market has now become quite significantmarket has now become quite significant

• Older purchasers (>30s) now play as much as Older purchasers (>30s) now play as much as teenagersteenagers

• With increasing maturity and better technology With increasing maturity and better technology comes increasing demands on the quality and comes increasing demands on the quality and sophistication of sophistication of gameplaygameplay

• This makes it increasingly difficult and expensive This makes it increasingly difficult and expensive to deliver the required real-time performance to deliver the required real-time performance

66

Page 7: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Computer Games – by Computer Games – by GenreGenre• PlatformPlatform - player has to climb up and down, or jump from and to, platforms and ledges, while fighting enemies and - player has to climb up and down, or jump from and to, platforms and ledges, while fighting enemies and

collecting collecting objects eg objects eg Donkey KongDonkey Kong

• First person shooterFirst person shooter – player with gun hunts through a world, shooting enemies. POV is first person– player with gun hunts through a world, shooting enemies. POV is first person

• Third person shooterThird person shooter – same as FPS, except that the view is outside of, and thought of as usually being – same as FPS, except that the view is outside of, and thought of as usually being behind,behind,

the main player character. the main player character.

• AdventureAdventure – player embarks on a mission or quest across an imaginary world of puzzles– player embarks on a mission or quest across an imaginary world of puzzles

• Fighting/ActionFighting/Action – player beats up other players, gets into car chases, sets off explosions, etc.– player beats up other players, gets into car chases, sets off explosions, etc.

• Real time strategy, god-gamesReal time strategy, god-games – player has a god like overview of a virtual world, and builds up – player has a god like overview of a virtual world, and builds up

communities, cities, colonies and observes or guides them through feast and famine, wars, natural disasters, etc.communities, cities, colonies and observes or guides them through feast and famine, wars, natural disasters, etc.

• SimulationsSimulations – player operates or drives a simulated machine or event eg. an aircraft– player operates or drives a simulated machine or event eg. an aircraft

• SportsSports – player engages virtually in a real or imaginary sport– player engages virtually in a real or imaginary sport

• Role-playing gameRole-playing game – any of a number of games in which player plays the role of a character and interacts – any of a number of games in which player plays the role of a character and interacts with a with a

world and other characters operated by the machineworld and other characters operated by the machine

• Online versions MUDs, MMORPGsOnline versions MUDs, MMORPGs – evolutionary forms of role-playing games, in which many – evolutionary forms of role-playing games, in which many

players go on-line and extend their communities, meet player in other places, battle for control, fall in love, trade, players go on-line and extend their communities, meet player in other places, battle for control, fall in love, trade, fight, etc. fight, etc.

77

Page 8: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Brief History of AI in Brief History of AI in GamesGames• Artificial intelligence has a long and peculiar relationship with Artificial intelligence has a long and peculiar relationship with

gamesgames

• Chess was mentioned in some of the first published works on Chess was mentioned in some of the first published works on the subjectthe subject

• Traditionally, (from late1950s) board games were used as “toy Traditionally, (from late1950s) board games were used as “toy worlds” – simplified, bite-sized problems which could be easily worlds” – simplified, bite-sized problems which could be easily represented a data structures eg. checkers, chess, represented a data structures eg. checkers, chess, backgammonbackgammon

• After years of this, AI was criticised in the 80s as being After years of this, AI was criticised in the 80s as being insufficiently general and so applicable to real-world problemsinsufficiently general and so applicable to real-world problems

• The discipline then went in search of successes in industrial, The discipline then went in search of successes in industrial, commercial and scientific commercial and scientific domainsdomains (application problems) (application problems)

• During the 90s, as computer games become more During the 90s, as computer games become more sophisticated and required more built-in intelligence, so sophisticated and required more built-in intelligence, so various kinds of games again became one of its main various kinds of games again became one of its main applicationsapplications

Semester 2 2008/9Semester 2 2008/9 88

Page 9: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

What is AI?What is AI?• IntelligenceIntelligence is the ability to think and learn in order to deal with is the ability to think and learn in order to deal with

the world and solve problems the world and solve problems

• In order to do that, someone (or something) needs the a brain (or In order to do that, someone (or something) needs the a brain (or its equivalent) to do what is thought to be at least partially a its equivalent) to do what is thought to be at least partially a sophisticated information processing tasksophisticated information processing task

• The rise of the computer made it conceivable that a machine The rise of the computer made it conceivable that a machine might be able to perform some of the mental processing formerly might be able to perform some of the mental processing formerly reserved for the brainreserved for the brain

• Artificial intelligence Artificial intelligence is an applied science, that combinesis an applied science, that combines· computer science,· computer science,· cognitive science (esp. psychology)· cognitive science (esp. psychology)· philosophy (not a science)· philosophy (not a science)

• More broadlyMore broadly: AI is a general investigation of the nature of : AI is a general investigation of the nature of intelligence and the principles and mechanisms required for intelligence and the principles and mechanisms required for understanding or replicating it.understanding or replicating it.

99

Page 10: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

The Uses of AI in GamesThe Uses of AI in Games• There is a certain skepticism about the value of AI There is a certain skepticism about the value of AI

methods among some designers. But some game makers methods among some designers. But some game makers have been forced to AI techniques, because they can be have been forced to AI techniques, because they can be used to do things that can’t (easily) be done otherwise used to do things that can’t (easily) be done otherwise

• For example, many role-playing games have Non-Player For example, many role-playing games have Non-Player Characters (characters in the game but not controlled by a Characters (characters in the game but not controlled by a human player). Ideally, these would still act reasonably human player). Ideally, these would still act reasonably intelligently. AI can help achieve thisintelligently. AI can help achieve this

• Even in games that do not include NPCs, AI techniques Even in games that do not include NPCs, AI techniques can be applied eg a rule-based system might be used to can be applied eg a rule-based system might be used to manage the physics of interaction between inanimate manage the physics of interaction between inanimate objects in the gameobjects in the game

• Two coming revolutions for game design: Two coming revolutions for game design: - technological revolution- technological revolution – application of AI methods to – application of AI methods to

achieve standard design goals for gameplay, only faster and achieve standard design goals for gameplay, only faster and more efficientlymore efficiently

- design revolution - design revolution –– building on the successes in AI-driven building on the successes in AI-driven intelligent NPCs, new kinds of gameplay can be designed inintelligent NPCs, new kinds of gameplay can be designed in

1010

Page 11: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Game Development MethodGame Development MethodInformal view:Informal view:• Analysis – figure out how the existing design and platform affect the general task, Analysis – figure out how the existing design and platform affect the general task,

investigate possible restrictions and assumptions.investigate possible restrictions and assumptions.• Understanding – precisely define the problem and decide high-level criteria for testingUnderstanding – precisely define the problem and decide high-level criteria for testing

Formalisation:Formalisation:• Specification – define the interface between the AI stuff and the game engineSpecification – define the interface between the AI stuff and the game engine• Research – find or invent AI techniques and express your problem in its terms to allow a Research – find or invent AI techniques and express your problem in its terms to allow a

solutionsolution

Programming:Programming:• Development – actually implements the theory as an AI software moduleDevelopment – actually implements the theory as an AI software module• Application – places the AI module into the game software to get it to solve the problem Application – places the AI module into the game software to get it to solve the problem

Testing Loop:Testing Loop:• Experimentation – informally assess the prototype by trying it out on arbitrary problem Experimentation – informally assess the prototype by trying it out on arbitrary problem

casescases• Testing –systematically evaluate the solution with a test bank derived from the high level Testing –systematically evaluate the solution with a test bank derived from the high level

criteria criteria

Post-production:Post-production:• Optimisation –refine the actual implementation to make it “lean and mean”Optimisation –refine the actual implementation to make it “lean and mean”

1111

Page 12: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

What is AI?What is AI?Traditionally, AI has divided into two competing camps:Traditionally, AI has divided into two competing camps:

1. Conventional Artificial Intelligence (“Good Old-Fashioned 1. Conventional Artificial Intelligence (“Good Old-Fashioned AI”)AI”)

• Symbol manipulation according to logical rulesSymbol manipulation according to logical rules• Algorithms and heuristicsAlgorithms and heuristics• Knowledge-based systems, expert systems, case-based reasoningKnowledge-based systems, expert systems, case-based reasoning• Logic-driven Logic-driven

2. Computational Intelligence (“Soft Computing”)2. Computational Intelligence (“Soft Computing”)• Brain-like machines inspired by biology of living creaturesBrain-like machines inspired by biology of living creatures• Emphasis on learning and adaptationEmphasis on learning and adaptation• Artificial Neural NetworksArtificial Neural Networks• Fuzzy Set Theory / Fuzzy LogicFuzzy Set Theory / Fuzzy Logic• Evolutionary Computation / Genetic AlgorithmsEvolutionary Computation / Genetic Algorithms• Data-drivenData-driven

• More recently More recently a third campa third camp, which emphasises embodied, active , which emphasises embodied, active engagement with the world, situatedness and robotics has arisen. engagement with the world, situatedness and robotics has arisen. Our own approach combines parts of all of these camps in a very Our own approach combines parts of all of these camps in a very modern way.modern way.

1212

Page 13: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

What is AI, Anyway?What is AI, Anyway?People approach the subject in different ways, but we can pick People approach the subject in different ways, but we can pick

out 3 main goals of AI research:out 3 main goals of AI research:

• Empirical:Empirical: Experimental modeling of existing intelligent systems Experimental modeling of existing intelligent systems - work done in collaboration with work in psychology, linguistics, - work done in collaboration with work in psychology, linguistics, philosophy etc. eg a computer model of human speechphilosophy etc. eg a computer model of human speech

• Theoretical:Theoretical: Analysis and exploration of possible intelligent Analysis and exploration of possible intelligent systems, towards theories helping our understanding of how systems, towards theories helping our understanding of how intelligence worksintelligence workseg Brook’s subsumption architectureeg Brook’s subsumption architecture

• PracticalPractical: : Solving real problems in the light of the above two Solving real problems in the light of the above two goals, namely: designing useful new intelligent or semi-intelligent goals, namely: designing useful new intelligent or semi-intelligent machines eg experimental robot Cogmachines eg experimental robot Cog

• All this is quite hard, and still very much work in progress.All this is quite hard, and still very much work in progress.

1313

Page 14: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Heroes of AI Heroes of AI ##1 – Alan Turing 1 – Alan Turing

1414

• Significant early paper was “Computing Machinery and Intelligence”, by the British mathematician Alan Turing (1950). In it he argues that philosophical questions such as

• Is there thought without experience?• Is there language without living?• Is there intelligence without life?are all really variations on the fundamental new question of artificial intelligence: “Can a machine think?”.

• He invented the Turing Imitation Game to help define artificial intelligence. One version of this game had a person conversing with an unseen computer via a teletype. If the person could not distinguish the computer from a person, the machine could be said to be exhibiting intelligence. Turing had defined intelligence in terms ofsymbol (word) manipulation.

• Because Turing had already advanced the Church-Turing Thesis (‘any symbol manipulation process M that can be described, can be computed’) this meant that if intelligence could be described well enough, it could be done by a machine.

Page 15: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Brief History of AI in Brief History of AI in GamesGames• Even before the beginning of AI in the 1950s, Even before the beginning of AI in the 1950s,

mathematicians had been interested in gamesmathematicians had been interested in games

• Developed Developed game theorygame theory, which is a systematic way of , which is a systematic way of analysing the logic of formal games, from chess to war – analysing the logic of formal games, from chess to war – applications in planning for economics and military applications in planning for economics and military strategystrategy

• Games can have one or many players, one or more Games can have one or many players, one or more winners, different kinds of payoff, complete or winners, different kinds of payoff, complete or incomplete information, alternating turns or concurrent incomplete information, alternating turns or concurrent play, one game or a tournament, etc.play, one game or a tournament, etc.

• One question is: given a set of rules and range of One question is: given a set of rules and range of possible moves, what is a player’s next move to possible moves, what is a player’s next move to maximise the chances maximise the chances of success?of success?

• This kind of thinking led to some useful ideas which This kind of thinking led to some useful ideas which were eventually taken up once computers became were eventually taken up once computers became availableavailable 1515

Page 16: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Brief History of AI in Brief History of AI in GamesGames• By analysing the nature of gameplay, theorists could By analysing the nature of gameplay, theorists could

come up with come up with algorithmsalgorithms or or heuristicsheuristics which could which could govern the next move, such as the minimax principlegovern the next move, such as the minimax principle

• These could be applied on paper to a game, or (more These could be applied on paper to a game, or (more fun) programmed into real machines that could playfun) programmed into real machines that could play

• By the end of the 1950’s Samuels had designed a By the end of the 1950’s Samuels had designed a computerised game of checkers which could improve by computerised game of checkers which could improve by playing an early example of playing an early example of machine learningmachine learning

• People began programming chess games as soon as People began programming chess games as soon as they could get access to a computerthey could get access to a computer

• Today, chess machines and software are cheap and Today, chess machines and software are cheap and commonly beat all but the best human playerscommonly beat all but the best human players

• And the really good ones can even do that...And the really good ones can even do that...1616

Page 17: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

Semester 2 2008/9Semester 2 2008/9 1717Image: MS Encarta Encylopedia 2000

Page 18: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

AI MethodsAI Methods• Because AI is a relatively new science, there is still debate about Because AI is a relatively new science, there is still debate about

how it should be donehow it should be done (rather than only (rather than only what are the answerswhat are the answers).).

• Neat vs Scruffy. Neat vs Scruffy. Neat AI empasises mathematical formalisation, formal Neat AI empasises mathematical formalisation, formal logic and proof by theorem. Scruffy AI emphasises purpose-built logic and proof by theorem. Scruffy AI emphasises purpose-built representations, experimentation with algorithms and heuristics and representations, experimentation with algorithms and heuristics and working programs as proof of concept.working programs as proof of concept.

• Contribution from Cognitive Sciences Contribution from Cognitive Sciences Brain science and advances in Brain science and advances in psychology have made a real contribution to AI. But brain science has also psychology have made a real contribution to AI. But brain science has also benefited from the attempt to build artificial minds, at least historically.benefited from the attempt to build artificial minds, at least historically.

• Robotics Robotics Some argue that intelligence is not merely symbol manipulation, Some argue that intelligence is not merely symbol manipulation, but has a physical element as well. They build robot machines to help but has a physical element as well. They build robot machines to help collect, organise and deploy knowledge in the world by skilled action.collect, organise and deploy knowledge in the world by skilled action.

• A-life A-life Artificial life method involves simulating biology, and building up Artificial life method involves simulating biology, and building up colonies of artificial living creatures (multiple interacting software creatures) colonies of artificial living creatures (multiple interacting software creatures) into systems with interesting emergent behaviour.into systems with interesting emergent behaviour.

• nouvelle Game AI nouvelle Game AI Most recent methodology, related to robotics and A-life. Most recent methodology, related to robotics and A-life. Lifelike non-player characters are embodied in a challenging environment, in Lifelike non-player characters are embodied in a challenging environment, in which they can interact with the researcher or other non-player characters.which they can interact with the researcher or other non-player characters.

1818

Page 19: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

What We Want from AIWhat We Want from AI• Characteristics of an intelligent system Characteristics of an intelligent system

(a wish list)(a wish list)

- - exhibit adaptive, goal-oriented exhibit adaptive, goal-oriented behaviourbehaviour

- learn from experience- learn from experience- use vast amounts of knowledge- use vast amounts of knowledge- interact with humans using language- interact with humans using language- tolerate error and ambiguity in - tolerate error and ambiguity in

communicationcommunication- respond in real time- respond in real time- exhibit self awareness (do we need exhibit self awareness (do we need

that?)that?)

• What would it mean (philosophically, to What would it mean (philosophically, to society) if the goals of AI were to be society) if the goals of AI were to be achieved? In what relationship would a achieved? In what relationship would a truly intelligent machine stand to human truly intelligent machine stand to human beings?beings?

1919

Image: Panther Books

Page 20: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

What We’ll Do in this What We’ll Do in this ModuleModule

• We’ll try the nouvelle-game AI approachWe’ll try the nouvelle-game AI approach

• To simplify writing of AI code, the environment and integrating the To simplify writing of AI code, the environment and integrating the two, we will use a standard development platform, Unreal two, we will use a standard development platform, Unreal Development Kit UDKDevelopment Kit UDK

• Our main purpose will be to learn about AI techniques, not so much Our main purpose will be to learn about AI techniques, not so much the games themselves.the games themselves.

• We will place NPCs into game environments We will place NPCs into game environments

• The NPCs will look like enemy aliens or robotsThe NPCs will look like enemy aliens or robots

• We will write new brains for them, using AI techniquesWe will write new brains for them, using AI techniques

• We will then be able to observe AI at work, by going into the game We will then be able to observe AI at work, by going into the game world and observing how well the new brains enable the NPCs to world and observing how well the new brains enable the NPCs to survive and prosper in the game survive and prosper in the game

• We will also try out some other AI programs and demosWe will also try out some other AI programs and demos2020

Page 21: Character Artificial Intelligence CE00875-6 Introduction to Module Introduction to Module Lecture 1 1

SummarySummary• Video games, including computer games, are now an important Video games, including computer games, are now an important

part of the software industry. part of the software industry.

• There’s increasing demand from players for more sophisticated There’s increasing demand from players for more sophisticated interaction and storylinesinteraction and storylines

• One way of meeting this need is to apply AI, the general One way of meeting this need is to apply AI, the general investigation of the nature of intelligence - and the principles and investigation of the nature of intelligence - and the principles and mechanisms required for understanding or replicating it.mechanisms required for understanding or replicating it.

• Pioneers like Alan Turing established the field of AI in the 1940s Pioneers like Alan Turing established the field of AI in the 1940s and 50sand 50s

• AI has a historical association with games, since these were AI has a historical association with games, since these were regarded as simple domains – ‘toy worlds’ which it would be easy regarded as simple domains – ‘toy worlds’ which it would be easy to represent as data structures and easy to write algorithms that to represent as data structures and easy to write algorithms that could manipulate them could manipulate them

• AI has 3 basic goals: empirical, theoretical and practicalAI has 3 basic goals: empirical, theoretical and practical

• Since the popularity of computer games has increased, it has Since the popularity of computer games has increased, it has become an important application for AI, and has now formed the become an important application for AI, and has now formed the basis for a novel approach to AIbasis for a novel approach to AI

• In this module we will try to use AI to control artificial non-player In this module we will try to use AI to control artificial non-player characters, or bots, in interactive first person shooters.characters, or bots, in interactive first person shooters.