230 likes | 541 Views
Artificial Intelligence for Games. Patrick Olivier & John Shearer p.l.olivier@ncl.ac.uk. What is (artificial) intelligence?. What is (artificial) intelligence?. Perception Representing Reasoning Acting Collaborating Learning …we know it when we see it…. What is a game?.
E N D
Artificial Intelligence for Games Patrick Olivier & John Shearer p.l.olivier@ncl.ac.uk
What is (artificial) intelligence? • Perception • Representing • Reasoning • Acting • Collaborating • Learning • …we know it when we see it…
Course structure • Finite state machines • Search • Heuristic search (including path planning) • Adversarial search • Rule-based systems • Multi-agent systems • Learning • Planning • Knowledge Representation
S.J. Russell & P. Norvig “Artificial Intelligence: A Modern Approach” (International Edition) 2nd or 3rd edition, Prentice Hall. Required reading
Classes of game AI… • Empirical: • hacked procedural (scripted) solutions • Principled: • classic algorithms (e.g. A* for path planning) • Real-time state-of-the-art: • newer algorithms (e.g. heuristic search planning) • newer approaches (e.g. cooperating agents)
Development context… • Game AI is hard core computer science! • Game AI is a “bounded optimality” problem • Processing time is always in demand: • common for the AI < 10% CPU time) • Efficient algorithms: • real-time • any time • Efficient representations (especially on consoles)
Don’t reinvent the wheel! • Over 80% of Game AI problems have been addressed in robotics or agent-based systems: • plan a path for a NPC within the game level • define behaviour for a NPC • define strategies and tactics in wargames • learn from an opponents behaviour • define collective behaviours for NPC
AI for Games in 30 minutes… • Finite state machines • Search & problem solving • Path planning as heuristic search • Adversarial search • Multi-agent systems • Machine learning • …
Rule-based (expert) systems • In 1970s expert systems dominated AI • Rule-bases that captured “expertise” • Rules base systems: • Data representation declarative • Data distinct from procedures for manipulation • Allows flexible description of behaviour • Encode behaviour as IF-THEN-ELSE rules • …and so…
Rule-based bots… IF enemy visible AND my health is < 20% OR his weapon >> my weapon THEN retreat
Search & problem solving • State-based representation of the world • Transform the world using operators • Transform current state desired state • Search for the right sequence of operators • Exhaustively • Heuristically • Stochastically
Path planning as search • A significant number of games involve moving in buildings, battlefields, etc. • Choosing the best path within a determined space is a classic AI problem • Algorithms have been developed that “construct” the best path by exploring possible directions using a heuristic
Path planning for NPCs • Discretise the environment (state) • Discretise the movement (operators) • Formulate a heuristic • Search algorithm (A*) • Enhance performance: • Memory (IDA*) • Real-time (RTA*)
Adversarial search • Killing is fun…but we still want to beat Kasparov! • “Serious” games were the first Game AI problems • Representation problem is easy • But the search space is humungous! • Need to search against an opponent • Minimax • Need to optimise • Alpha-Beta pruning • Singular extensions • How did Deep Blue do it?
Machine learning • Being really intelligent means be able to learn (and become cleverer)… • Learn to anticipate our opponent • How can we learn? • Remembering (rote learning) • Learning by building rules • Learning by building models • Game AI will learn more…
What about the programming? • Programming AI (in Java) • Two hour practical classes: • collaborate and learn • 2 progressive programming coursworks • 50% of the assessment for CSC3203 • 1 week turnaround for feedback
What next? • Write notes in the lectures • Buy the textbook (e.g. amazon.co.uk) • Start reading the textbook • Go to the practical classess • Program in your own time • Sign-up for a project