140 likes | 338 Views
AI for Games CM-0328D. Video Games and Real Time AI. Video Game Early History. 1958 – Willy Higinbotham invents a tennis-like game on an oscilloscope 1961 – Steve Russell creates Spacewar on a PDP-1 1968 – Ralph Baer patents a TV video tennis game
E N D
AI for GamesCM-0328D Video Games and Real Time AI
Video Game Early History • 1958 – Willy Higinbotham invents a tennis-like game on an oscilloscope • 1961 – Steve Russell creates Spacewar on a PDP-1 • 1968 – Ralph Baer patents a TV video tennis game • 1971 – Nutting release a video game cabinet (for Spacewar). It bombs. • 1972 – Atari formed and Pong released – test units get flooded with quarters • 1977 – Atari releases VCS home video console • 1978 – Nintendo releases computer Othello, Atari releases football (using a trackball), Midway imports Taito’s Space Invaders
Video Game Genres • Abstract, Adaptation, Adventure, Artificial Life, Board Games, Capturing, Card Games, Catching, Chase, Collecting, Combat, Demo, Diagnostic, Dodging, Driving, Educational, Escape, Fighting, Flying, Gambling, Interactive Movie, Management Simulation, Maze, Obstacle Course, Pencil-and-Paper Games, Pinball, Platform, Programming Games, Puzzle, Quiz, Racing, Role-Playing, Rhythm and Dance, Shoot ’Em Up, Simulation, Sports, Strategy, Table-Top Games, Target, Text Adventure, Training Simulation, and Utility The Medium of the Video Game (Mark J. P. Wolf)
Video Game AI • Mostly a mix of: • Scripting (e.g. shooting games) • Rule-based systems • Pathfinding • Finite state machines (with/without a stack) • Simple planning • Environmental Triggers
Rule-based AI • Build a flowchart for a simple plant-eating organism • Then build a flowchart for a meat-eating organism that would beat your plant-eater • Then build a flowchart for a plant eating organism that would be successful against your meat-eating organism
Pathfinding Start Finish
A* search (1) • 1) Add the starting square to the open list. • 2) Repeat the following: • a) Look for the lowest F cost square on the open list. We refer to this as the current square. • b) Switch it to the closed list. • c) For each of the 8 squares adjacent to this current square … • If it is not walk able or if it is on the closed list, ignore it. Otherwise do the following. • If it isn't on the open list, add it to the open list. Make the current square the parent of this square. Record the F, G, and H costs of the square. • If it is on the open list already, check to see if this path to that square is better, using G cost as the measure. A lower G cost means that this is a better path. If so, change the parent of the square to the current square, and recalculate the G and F scores of the square. If you are keeping your open list sorted by F score, you may need to resort the list to account for the change.
A* search (2) • d) Stop when you: • Add the target square to the open list, in which case the path has been found, or • Fail to find the target square, and the open list is empty. In this case, there is no path. • 3) Save the path. Working backwards from the target square, go from each square to its parent square until you reach the starting square. That is your path.
Finite State Machines Switch up ON OFF Switch down And so much more…