46
Artificial Intelligence in Video Games Jason Fuller 1

Artificial Intelligence in Video Games

  • Upload
    amil

  • View
    98

  • Download
    3

Embed Size (px)

DESCRIPTION

Artificial Intelligence in Video Games. Jason Fuller. What is Game AI?. Imitate intelligence in the actions of non-player characters (NPCs). Make the game “feel” real. Obey laws of the game Show decision making and planning. Goals of Game AI. Be fun! - PowerPoint PPT Presentation

Citation preview

Page 1: Artificial Intelligence in     Video Games

1

Artificial Intelligence in Video GamesJason Fuller

Page 2: Artificial Intelligence in     Video Games

2

What is Game AI? Imitate intelligence in the actions of non-player

characters (NPCs). Make the game “feel” real. Obey laws of the game Show decision making

and planning

Page 3: Artificial Intelligence in     Video Games

3

Goals of Game AI Be fun! Be challenging but not

overwhelming (unless the hardest difficulty is selected)

Make sure the AI does not cheat! (At least do not get caught)

AI often get bonuses when difficulty increases

Do not hog all the resources! (CPU time)

Page 4: Artificial Intelligence in     Video Games

4

Types of Games

1. Action games Shooters (FPS and Third-Person) Racing, Sports

2. RPG games (Role Playing Game) Often include many

action game aspects of AI

3. RTS games (Real Time Strategy)

Page 5: Artificial Intelligence in     Video Games

5

Game AI Types Action and RPG AI tend to work better with Finite State

Machine based AI RTS AI used Finite State Machines in the early years of AI

development. RTS AI work best with Artificial Neural Networks and Fuzzy

Logic Both contain path finding components

Page 6: Artificial Intelligence in     Video Games

6

AI Path Finding

Dijkstra’s Algorithm

A* Algorithm Most commonly used Finds the shortest path The world or map of the game is represented by a grid of points

Page 7: Artificial Intelligence in     Video Games

7

A* Algorithm Allows for high optimization

Either by changing the search algorithm to better suit the game or by changing the data structures.

Very similar to how people move between locations in a city.

Page 8: Artificial Intelligence in     Video Games

8

Finite State Machines (FSM) Simplest and most basic AI model. Consists of:

States

State Transitions

Most common for Action games! Not many different actions for NPCs

Page 9: Artificial Intelligence in     Video Games

9

Finite State Machines Among the States and State Transitions there are 4

components: States which define behavior

State transitions which are the movement from one state to another

Conditions which must be met for state transition

Events/Actions which are internally or externallygenerated which may lead to a state transition

Page 10: Artificial Intelligence in     Video Games

10

FSM Example

Page 11: Artificial Intelligence in     Video Games

11

FSM Disadvantages Very predictable Too many states get tough to organize Since there are such crisp rules between states, NPC does not

feel natural

Page 12: Artificial Intelligence in     Video Games

12

FSM within a State States have a FSM within them

Page 13: Artificial Intelligence in     Video Games

13

Modern FSM Example

Page 14: Artificial Intelligence in     Video Games

14

History of Finite State Machines In 1952, the game Nim used AI to play against an opponent. 1960’s & 1970’s Spacewar!

Pong

Space Invaders

1980’s Simcity

Page 15: Artificial Intelligence in     Video Games

15

History Continued1990’s Dragon Quest IV

Warcraft

Half-Life

Page 16: Artificial Intelligence in     Video Games

16

Artificial Neural Networks (ANN) No agreed definition, most common one is “a network of

simple processing elements, which can exhibit complex global behavior, determined by the connections between the processing elements and element parameters.”

Mathematical model inspired by biological neural networks. An adaptive structure that can learn.

Page 17: Artificial Intelligence in     Video Games

17

ANN Structure Very similar to the structure of our brain.

Input layer, processing (hidden) layer, output layer

Learns by example

Page 18: Artificial Intelligence in     Video Games

18

ANN Structure The hidden layer is not just a straight line of nodes Each node in the hidden layer will contain just a small part of

the overall calculation The nodes have connections

between each other withcertain weights

Page 19: Artificial Intelligence in     Video Games

19

ANN Structure The weight of the connections between the nodes determine the outcomes

of the calculations

If a node is triggered by 2 different nodes it can then determine which one is more important

Page 20: Artificial Intelligence in     Video Games

20

ANN Learning

Page 21: Artificial Intelligence in     Video Games

21

Page 22: Artificial Intelligence in     Video Games

22

Page 23: Artificial Intelligence in     Video Games

23

Black & White Came out in 2001 First to effectively use

Artificial Neural Networks

Page 24: Artificial Intelligence in     Video Games

24

Halo Wars Came out in 2009 Featured a “Custom” difficulty level that used Artificial Neural

Networks

Page 25: Artificial Intelligence in     Video Games

25

Fuzzy Logic Introduced in 1965 for use in Artificial Intelligence research Present problems to computers in a way similar to how humans

solve problems and that everything is a matter of degree (or preference or context).

Page 26: Artificial Intelligence in     Video Games

26

Example Problem

A store owner needs to decide how much produce to order.

Elements to take in to consideration: Time of year? What is the weather like? Is there a Holiday coming up?

Page 28: Artificial Intelligence in     Video Games

28

Games

Now that the major types of AI have been covered, I will go into more detail about what games they are used in.

Page 29: Artificial Intelligence in     Video Games

29

Racing Game AI Large-scale cheating! AI already know the track and optimal path AI already has complete behavior determined before the start

of the race

Page 30: Artificial Intelligence in     Video Games

30

Racing AI graphs

General Path

Optimal Path

Page 31: Artificial Intelligence in     Video Games

31

Racing Game AI In its basic form, it is the most basic of game AI but in some of

the racing simulators, the AI are more complicated If the player is using the optimal path, the AI will actively try to

push them off of it. The AI will also use tricks such as spinning out opponents by

making their back tires lose grip.

Page 32: Artificial Intelligence in     Video Games

32

FPS Game AI Implemented with a layered structure Bottom layers control the path finding tasks and animation

selection Higher layers control the tactical reasoning which is where the

Finite State Machine would be.

Page 33: Artificial Intelligence in     Video Games

33

A* Graph of FPS or RPG World

Unplayable Zone

Playable ZoneGeneral path

Page 34: Artificial Intelligence in     Video Games

34

FPS Continued F.E.A.R. series has revolutionary AI AIs have knowledge of map elements and will flank the player AI will break through walls and windows to get to the player AI will rush when they heavily outnumber the player

Page 35: Artificial Intelligence in     Video Games

35

RPG Game AIMany encounters with AI are unscriptedGTA IV and Far Cry 2 made great leaps in “friendly” AI

Page 36: Artificial Intelligence in     Video Games

36

Elder Scrolls IV: Oblivion Released in 2006 During testing, a story important NPC kept being found dead. A mechanic of the AI was the cause.

Page 37: Artificial Intelligence in     Video Games

37

Bioshock Infinite The player companion, Elizabeth (who is an AI), is almost

entirely unscripted.

Page 38: Artificial Intelligence in     Video Games

38

RTS Game AI Started out using Finite State Machines to control AI Too many options to cover AI was “dumb” AI would build up in a strict way Once the player found a strategy that worked against the AI, it

would always work. RTS AI switched to a combination of Fuzzy Logic and Artificial

Neural Networks

Page 39: Artificial Intelligence in     Video Games

39

RTS Game AI By changing to Fuzzy Logic and Artificial Neural Networks (ANN):

Fuzzy Logic led to smarter responses to attacks

ANN led to smarter development of base and better long term decisions

Page 40: Artificial Intelligence in     Video Games

40

A* Graph of RTS Map

Page 41: Artificial Intelligence in     Video Games

41

RTS Continued Maxis is again changing the simulation landscape with the new

Simcity Every “Sim” is a full AI

Have there own agenda

Have specific wantsand needs

Page 43: Artificial Intelligence in     Video Games

43

Future of Game AI Game AI have made great leaps forward since they were first

developed. An AI that can learn how you play a game would be a great

opponent

Page 44: Artificial Intelligence in     Video Games

44

References Champandard, Alex. "Top 10 Most Influential AI Games." Aigamedev.com. N.p., 12 Sept.

2007. Web. 25 Feb. 2013. <http://aigamedev.com/open/review/top-ai-games/>.

Grant, Eugene, and Rex Lardner. "The Talk of the Town." TheNewYorker.com. The New Yorker, 02 Aug. 1952. Web. 25 Feb. 2013. <http://www.newyorker.com/archive/1952/08/02/1952_08_02_018_TNY_CARDS_000236053>.

Grzyb, Janusz. "Artificial Intelligence in Games." - CodeProject. Software Developer's Journal, n.d. Web. 25 Feb. 2013. <http://www.codeproject.com/Articles/14840/Artificial-Intelligence-in-Games>.

"Neural Networks: A Requirement for Intelligent Systems." N.p., 2007. Web. 25 Feb. 2013. <http://www.learnartificialneuralnetworks.com/#training>.

"Short Term Decision Making with Fuzzy Logic And Long Term Decision Making with Neural Networks In Real-Time Strategy Games." Hevi.info. N.p., n.d. Web. 25 Feb. 2013. <http://www.hevi.info/tag/artificial-intelligence-in-real-time-strategy-games/>.

Page 46: Artificial Intelligence in     Video Games

46

QUESTIONS?