cs 380 artificial intelligence ai for games
play

CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES 11/25/2013 Santiago - PowerPoint PPT Presentation

CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES 11/25/2013 Santiago Ontan santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/CS380/intro.html What is Game AI? Artificial Intelligence for Computer Games Different from


  1. CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES 11/25/2013 Santiago Ontañón santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/CS380/intro.html

  2. What is Game AI? • Artificial Intelligence for Computer Games • Different from traditional AI Traditional AI: Optimality, efficiency Game AI: Fun, artificial “stupidity”

  3. What is Game AI? • Intersection of games and AI: Games AI • Two (three) main communities working on it: • Academics: • Artificial Intelligence community: how can games help us have better AI (AI centric) • Computer Game scholars: how can AI help us have better/more interesting/new forms of games?(Games centric) • Game industry: • Their goal is to make games that sell more units (games centric)

  4. Examples of Game AI Pac-Man (1980) First ever game to feature AI AI: finite state machine

  5. Examples of Game AI “Pac-Man” (1980) First ever game to feature AI AI: finite state machine

  6. Examples of Game AI “Double Dragon” AI: Finite State Machines

  7. Examples of Game AI Chess AI needs to provide a collection of difficulty levels. Only one: hardest (to be played only against grand-masters), falls into the realm of traditional AI.

  8. Examples of Game AI “The Secret of Monkey Island” “And Then There Were None” Dialogues, storytelling

  9. Examples of Game AI “Left 4 Dead 2” AI Director adjusts game pace to ensure desired dramatic effects

  10. Examples of Game AI “Black & White” Uses machine learning to simulate a learning creature

  11. Examples of Game AI “Starcraft II” Strategy, planning, path- finding, economics, etc.

  12. Types of Game AI • Inside the game: • Character control • Director (drama management) • During game development: • Help in behavior/content design • After game deployment: • Analysis of game data

  13. Typical Game AI problems • Pathfinding: • Given start/end positions, how to find a path that connects them? • Movement: • E.g. given a path, how can we control a vehicle to follow it? • Decision Making: • E.g. in a combat situation, when to attack? Who to attack? Which weapon/spell to use? • Game Adaptation: • How can we customize the game to the player at hand • etc.

  14. Pathfinding • After so many years, pathfinding is still a problem even in modern commercial games: • http://www.youtube.com/watch? v=lw9G-8gL5o0&feature=player_embedded

  15. Pathfinding • After so many years, pathfinding is still a problem even in modern commercial games: • http://www.youtube.com/watch? v=lw9G-8gL5o0&feature=player_embedded • Algorithms: • A* • TBA* • LRTA* • D* • D*-LITE • etc.

  16. Quantization and Localization • Pathfinding computations are performed with an abstraction over the game map (a graph, composed of nodes and links) • Quantization: • Game map coordinates -> graph node • Localization: • Graph node -> Game map coordinates • Example: Navigation Mesh (NavMesh)

  17. Movement

  18. Movement ? Pathfinding Movement

  19. Steering Behaviors: Uses In car racing games, Pathfinding is typically hard coded. The game designers create a set of waypoints in the track (or in the track pieces), and cars go to them in order. Pathfinding Movement

  20. Steering Behaviors: Uses Movement is in charge of driving the car to each of the waypoints, avoiding opponents, braking, accelerating, turning, etc. Pathfinding Movement

  21. AI Requirements in a Typical Game (FPS) • The two basic needs in all FPS are: • Movement • Firing • With those two you can already have a basic FPS running like: • Wolfenstein 3D (for which you most likely only need movement, since there are no projectiles, and thus firing is just line-of-sight testing) • Doom • But you need way more than that for a modern FPS!

  22. AI Requirements in FPS • In Modern FPS you don’t expect: • Enemies to get stuck behind a wall (enemies in old games like Wolfenstein do) • To stand still while you kill their camarades (they do in Wolfenstein and Doom!) • To be trapped just because you closed a door! • To move independently of each other • etc.

  23. AI Requirements in FPS • Perception • Movement and Firing • Pathfinding • Decision Making • Group Control • Camera Control • Drama Management

  24. Perception • The base of all Game AI is a good perception module • If perception is properly designed, the cost of building the rest of the AI can be significantly reduced • In FPS games perception needs to handle mainly: • Line-of-sight checks • Proximity checks • Easy access to “distance to point” and “path to point” calculations for tactical AI • Recall lecture on perception (games like “Metal Gear”, or “Commandos”)

  25. Game Engine Character AI Game Rendering State Collision Physics Input User

  26. Game Engine Character AI Game Rendering State World Collision Physics Interface (perception) Input User

  27. Movement and Firing • Movement is typically done with a combination of Steering Behaviors and animation managers: • Coordinating the animation of the 3D model of a character with its movement is sometimes complex: • Blend predefined animations (e.g. from Maya) with dynamic ones (aim) • Firing is important in modern games: • “Doom” doesn’t have any firing management: enemies have PERFECT aim. They solve it by making the bullets very slow • Modern games have aim models: • Enemies miss • They miss in a place where the player can see the bullet (show off your AI!)

  28. Game Engine Character AI Game Rendering State World Collision Physics Interface (perception) Movement Firing Input User

  29. Game Engine Character AI Game Rendering State World Collision Physics Interface (perception) At this point we Movement Firing already have the AI Input User for “Wolfenstein 3D” (It had no pathfinding)

  30. Path-finding • Not all enemies are given path-finding capabilities: • Path-finding makes characters look smart, the ones that should not be smart do not have path-finding • Representation of the navigation graph: • Navigation meshes is the most popular • Embedded navigation: • Annotate each link in the navigation graph with the action required to traverse it (walk, crawl, climb, open door, etc.) • Characters look smart knowing they have to perform those actions, but it’s all hand annotated or precomputed

  31. Game Engine Character AI Game Rendering State World Collision Physics Interface (perception) Path-finding Movement Firing Input User

  32. Game Engine Character AI Game Rendering State World Collision Physics Interface (perception) Path-finding Movement Firing Input User At this point we already have the AI for “Doom”!

  33. Decision Making • Decision Making in FPS controls what characters do at a high level: do they attack? Do they retreat? Do they execute other actions? • Classic games: Finite-state machines • Modern games: Behavior Trees • Some exceptions: • F.E.A.R.: Goal-oriented behavior • Characters have a set of goals, and each goal associated with an FSM, the most relevant goal takes control and its FSM is executed.

  34. Waypoints • (we will cover them in a couple of weeks) • Special markers in the map that indicate special locations: • Good places for cover, attack, ambush, etc. • They are hand annotated, and when close to one the AI knows how to do. • Characters look smart without requiring complex AI. • ALL modern FPS games use waypoints.

  35. Game Engine Character AI Game Rendering State Decision Making World Collision Physics Interface (perception) Path-finding Movement Firing Input User

  36. Group Control • Can be defined also using behavior trees • Most common approach: • Each tactic defines a set of “roles” • A role is filled by one character • Each tactic has a behavior tree that executes it • For example: • A “flank” tactic can have 3 roles for “left attack”, “front attack”, and “right attack” • Only 3 enemies will execute it at once (if there are more, they will wait, kung-fu style) • Enemies look smart, and do not crazily over-power the player

  37. Game Engine Character AI Game Rendering State Tactics (Group Behavior) Decision Making World Collision Physics Interface (perception) Path-finding Movement Firing Input User

  38. Game Engine Character AI Game Rendering State Tactics (Group Behavior) Decision Making World Collision Physics Interface (perception) Path-finding At this point we Movement Firing already have the AI Input User for “Half-Life”!

  39. Game Engine Character AI Game Rendering State Tactics (Group Behavior) Decision Making World Collision Physics Interface (perception) Path-finding At this point we Movement Firing already have the AI Input User for “Half-Life”! But there is more …

  40. Experience Management • Premise: • Different players have different preferences • Each player enjoys a different subset of the elements of a game • Problem: • How can a game automatically adapt to match the current player? • Maintain the dramatic arc expected by the game designer • Prevent the players from dealing with parts of the game not appealing to them • Adjust difficulty level, etc. • Solution: • Drama Management / Experience Management / AI Director

Recommend


More recommend