1 / 14

AI in games

AI in games. Roger Crawfis/Eric Fosler-Lussier CSE 786 Game Design. AI vs. AI for games. AI for games poses a number of unique design challenges Traditional AI: Made to handle unseen inputs, large state space Too many options possible to compute an exact optimal solution

setht
Download Presentation

AI in games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AI in games Roger Crawfis/Eric Fosler-Lussier CSE 786 Game Design

  2. AI vs. AI for games • AI for games poses a number of unique design challenges • Traditional AI: • Made to handle unseen inputs, large state space • Too many options possible to compute an exact optimal solution • Engineering criteria: best possible performance • Game AI: • The game world is known, though it can still be large • In a known world, optimal solutions can be precomputed • Entertainment criteria: smart enough to pose a challenge, but not smart enough to be undefeatible

  3. Injecting AI into a Game • Friend: • autonomous, intelligent NPC helpmates • Configurable (scripted) behaviors: different characters solve a problem in different ways • Player may trade places with NPC: automation • Foe: • Opponents get better with time • Opponents are less predictable because the individuals’ behavior is not uniform • Scene Clutter • Provides a richness to your environment. • Animals grazing, birds flying, people milling about, automobiles driving, etc.

  4. Goals for your games • Prepare you for entertainment and ‘serious’ games • You must implement at least one of these features • Improve over time • Goal-driven action decomposition • A* search • for path planning, with varying cost functions for different agents (different agents have different heuristics) • Game tree search • Emergent group behavior (flocking or formations) • “Intelligent” interaction (e.g. speech/language) • Your game AI must be data-driven, i.e. it must tune itself or otherwise interoperate with an arbitrary map/level loaded at runtime

  5. Warning: AI is not an afterthought • AI elements need to be designed in from the start • Configurable/scripted behavior • Data-driven map/level layouts • AI isn’t time-consuming to create, if coded from the start

  6. Improving over time • Agent behavior needs to be composed from small, modular, context-sensitive actions • Evade-right if angle >90 and < 180 • Reward good performance/punish bad • Each re-spawn can modify control strategy • See good discussion in Buckland online book • You can either perform training and freeze optimal play, or let the agent adapt to each user

  7. Improving over time • Example from Buckland (online) Ch 10: brainy aliens • Map sensory input to behavior with a hidden layer • The time it stayed alive is fitness function • When alien dies, replace it with an evolved one

  8. Goal-driven behavior • Multiple steps required to achieve a desired effect • Useful in • Action-adventure type games -puzzles to solve • RPG - task underlings with a multi-step job • Good discussion in Buckland PGAIE ch. 9 • Each ‘goal’ is an instance of a composite class • Many different goals can be created with minimal coding

  9. Goal-driven agents • Different classes of agents solve problem in different ways, based on their abilities • “Block door”: • Strong trolls move boulders in the way • Small hobbits shovel sand into the opening • Each agent’s response to the goal depends on his abilities, available tools, etc. • Goal object contains alternative recipes • One goal at a time is active for each agent • In more complex games, might have goal queue

  10. A* path planning • Smart path planning/locomotion using waypoints/grabpoints built into the world • Board/card games like chess/poker are impossible to completely search, heuristics are required and search cutoffs

  11. flocking/formation • Agents have small goals to balance that result in emergent behavior • Flocking: stay close, navigate toward centroid of flock, avoid collision • Results in a ‘crowd’ behavior look • Formations: flanking/center/right wing, etc. • Individuals stay evenly spaced within their group • Each agent chooses a position within the formation • One agent or central planner selects formation • Results in a more disciplined/organized look (Orcs) • Depends on how organized you want the agents to appear

  12. Flocking demos • See Craig Reynold’s Steering behaviors: http://www.red3d.com/cwr/steer/

  13. “Intelligent” interaction • NPCs might communicate state via language • E.g. Wii Fit, “All your bases belong to us” • Complete job is WAAAAY too hard • Input: probably beyond scope of project • Output: May be able to do simple state-conditional things (mocking, encouragement) • Scripting languages can be used for rapid deployment

  14. Other AI principles: observability • Don’t let the agents have perfect knowledge: they have to operate in the environment like the players do • Sense and remember events in their sensory horizon, memories can have a TTL • Perhaps in more advanced levels, they can communicate with each other about what they know • See article on “adding stupidity to AI”

More Related