game ai
play

Game AI CS 4730 Computer Game Design Some slides - PowerPoint PPT Presentation

Game AI CS 4730 Computer Game Design Some slides courtesy Tiffany Barnes, NCSU CS 4730 The Loop of Life Games are driven by a


  1. Game ¡AI ¡ CS ¡4730 ¡– ¡Computer ¡Game ¡Design ¡ ¡ Some ¡slides ¡courtesy ¡Tiffany ¡Barnes, ¡NCSU ¡ CS ¡4730 ¡

  2. The ¡Loop ¡of ¡Life ¡ • Games ¡are ¡driven ¡by ¡a ¡game ¡loop ¡that ¡ performs ¡a ¡series ¡of ¡tasks ¡every ¡frame ¡ • Some ¡games ¡have ¡separate ¡loops ¡for ¡the ¡front ¡ and ¡and ¡the ¡game ¡itself ¡ • Other ¡games ¡have ¡a ¡unified ¡main ¡loop ¡ CS ¡4730 ¡ 2

  3. The ¡Game ¡Loop ¡ • Tasks ¡ – Handling ¡Jme ¡ – Gathering ¡player ¡input ¡ – Networking ¡ – SimulaJon ¡ – Collision ¡detecJon ¡and ¡response ¡ – Object ¡updates ¡ – Rendering ¡ – Other ¡miscellaneous ¡tasks ¡ CS ¡4730 ¡ 3

  4. The ¡Game ¡Loop ¡ • Tasks ¡ – Handling ¡Jme ¡ – Gathering ¡player ¡input ¡ – Networking ¡ – Simula:on ¡ – Collision ¡detecJon ¡and ¡response ¡ – Object ¡updates ¡ – Rendering ¡ – Other ¡miscellaneous ¡tasks ¡ CS ¡4730 ¡ 4

  5. What ¡all ¡do ¡you ¡have ¡to ¡simulate? ¡ • Physics ¡ • Environments ¡ • LighJng ¡ • Sounds ¡ • Behaviors ¡ CS ¡4730 ¡ 5

  6. Some ¡Terms ¡To ¡Know ¡ • AI: ¡ArJficial ¡Intelligence ¡– ¡does ¡not ¡have ¡to ¡ mean ¡perfect ¡human-­‑like ¡intelligence! ¡ • Turing ¡Test: ¡ ¡Can ¡a ¡normal ¡user ¡tell ¡the ¡ difference ¡between ¡interacJng ¡with ¡a ¡ computer ¡and ¡a ¡person ¡ • NPC: ¡ ¡Non-­‑Player ¡Character ¡– ¡any ¡thing ¡in ¡the ¡ world ¡that ¡needs ¡to ¡be ¡modeled, ¡can ¡make ¡ decisions, ¡and ¡can ¡potenJally ¡have ¡player ¡ interacJon ¡ CS ¡4730 ¡ 6

  7. Discussion ¡ • How ¡good ¡should ¡the ¡AI ¡be? ¡ CS ¡4730 ¡ 7

  8. Discussion ¡ • Are ¡people ¡more ¡fun ¡than ¡NPCs? ¡ ¡Why? ¡ CS ¡4730 ¡ 8

  9. AI ¡vs. ¡Game ¡AI ¡ • Modern ¡AI ¡research ¡is ¡more ¡in ¡geneJc ¡ algorithms ¡and ¡neural ¡networks ¡ • This ¡isn’t ¡really ¡an ¡opJon ¡for ¡game ¡AI ¡(right ¡ now) ¡ – We ¡value ¡efficiency ¡over ¡complexity ¡ – Too ¡much ¡other ¡stuff ¡to ¡do ¡in ¡the ¡game ¡loop! ¡ – AI ¡for ¡us ¡just ¡has ¡to ¡be ¡“good ¡enough” ¡to ¡be ¡fun ¡ • We ¡will ¡look ¡at ¡three ¡main ¡AI ¡roles: ¡ – State-­‑based ¡behavior, ¡planning/strat, ¡pathfinding ¡ CS ¡4730 ¡ 9

  10. What ¡Makes ¡“Good ¡AI”? ¡ • Perceived ¡by ¡user ¡as ¡challenging ¡ – Cruel, ¡but ¡fair! ¡ • User ¡is ¡surprised ¡by ¡the ¡game ¡ – but ¡later ¡understands ¡why ¡ • Feeling ¡that ¡reality ¡will ¡provide ¡answers ¡ – able ¡to ¡make ¡progress ¡solving ¡problem ¡ • What ¡games ¡have ¡used ¡AI ¡effecJvely? ¡ CS ¡4730 ¡ 10

  11. The ¡Bar ¡To ¡Reach ¡ • Have ¡you ¡failed ¡in ¡your ¡adempt ¡to ¡create ¡a ¡ game ¡if ¡your ¡NPCs ¡can’t ¡pass ¡the ¡Turing ¡Test? ¡ • NO! ¡ ¡Of ¡course ¡not! ¡ • SomeJmes ¡NPCs ¡can ¡pass ¡the ¡Turing ¡Test ¡in ¡ very ¡specific ¡circumstances ¡ – Computer ¡chess ¡player ¡ • SomeJmes ¡NPCs ¡will ¡never ¡pass ¡the ¡Turing ¡ Test ¡and ¡we’re ¡okay ¡with ¡that! ¡ – Koopa ¡Troopas ¡in ¡Super ¡Mario ¡Bros. ¡3 ¡ CS ¡4730 ¡ 11

  12. “Good ¡Enough” ¡ • Your ¡AI ¡needs ¡to ¡be ¡“good ¡enough ¡for ¡the ¡ player ¡to ¡be ¡challenged…” ¡ • And ¡“bad ¡enough ¡for ¡the ¡player ¡to ¡have ¡fun…” ¡ • Games ¡are ¡ogen ¡played ¡to ¡escape ¡from ¡reality ¡ • Playing ¡against ¡an ¡AI ¡that’s ¡“too ¡good” ¡is ¡ incredibly ¡frustraJng ¡ • Imagine ¡a ¡computer ¡player ¡of ¡Othello ¡or ¡ Scrabble ¡that ¡ONLY ¡took ¡opJmal ¡moves ¡ CS ¡4730 ¡ 12

  13. The ¡AI ¡Loop ¡ • Given ¡the ¡changes ¡to ¡the ¡environment, ¡what ¡ should ¡the ¡NPC ¡do? ¡ • CogniJon ¡of ¡the ¡NPC ¡ – PercepJon ¡(processing ¡the ¡state ¡of ¡the ¡ environment) ¡or ¡“Sense” ¡ – Decision ¡making ¡(decide ¡what ¡to ¡do ¡based ¡on ¡ percepJon) ¡or ¡“Plan” ¡ – Control ¡(update ¡NPC ¡one ¡Jme ¡step) ¡or ¡“Act” ¡ CS ¡4730 ¡ 13

  14. PercepJon ¡ • The ¡NPC’s ¡esJmaJon ¡of ¡game-­‑related ¡ informaJon ¡ • Includes ¡perceived ¡strategies ¡of ¡PCs ¡ • IdenJfies ¡most ¡important ¡factors ¡for ¡the ¡NPC ¡ to ¡respond ¡to ¡ • Think ¡of ¡it ¡as ¡the ¡NPCs ¡“adenJon ¡span” ¡ CS ¡4730 ¡ 14

  15. Decision ¡Making ¡ • Determining ¡a ¡course ¡of ¡acJon ¡for ¡this ¡Jme ¡ step ¡for ¡this ¡parJcular ¡state ¡of ¡the ¡game ¡ • Usually ¡requires ¡a ¡trade ¡off ¡between ¡accuracy ¡ of ¡the ¡decision ¡and ¡speed ¡of ¡computaJon ¡ • Computer ¡COULD ¡simulate ¡out ¡several ¡steps ¡to ¡ make ¡a ¡“beder” ¡decision, ¡but ¡at ¡a ¡cost ¡of ¡speed ¡ and ¡potenJally ¡“fun” ¡ CS ¡4730 ¡ 15

  16. Control ¡ • AdjusJng ¡the ¡appropriate ¡variables ¡of ¡the ¡NPC ¡ to ¡carry ¡out ¡the ¡decision ¡made ¡ – Steering ¡or ¡throdle ¡in ¡a ¡racing ¡game ¡ – Crouching ¡or ¡taking ¡a ¡shot ¡in ¡an ¡FPS ¡ – Using ¡a ¡poJon ¡or ¡casJng ¡a ¡spell ¡in ¡an ¡RPG ¡ CS ¡4730 ¡ 16

  17. The ¡Sum ¡Of ¡The ¡Parts ¡ • The ¡sum ¡of ¡all ¡these ¡parts ¡makes ¡up ¡the ¡AI ¡of ¡ an ¡NPC ¡ • It ¡can ¡be ¡incredibly ¡complex ¡ – Large ¡fight ¡in ¡a ¡tacJcal ¡shooter ¡ • It ¡can ¡be ¡padern ¡based ¡ – Behaviors ¡of ¡a ¡sentry ¡in ¡Metal ¡Gear ¡Solid ¡ – Behaviors ¡of ¡any ¡boxer ¡in ¡Punch ¡Out ¡ • It ¡can ¡be ¡… ¡well, ¡stupid ¡ – Goombas ¡or ¡Koopas ¡in ¡Super ¡Mario ¡Bros. ¡3 ¡ CS ¡4730 ¡ 17

  18. Pong ¡AI ¡ • What ¡is ¡the ¡challenge ¡in ¡creaJng ¡the ¡AI ¡for ¡ Pong? ¡ CS ¡4730 ¡ 18

  19. Chase/Evade ¡ • Consider ¡a ¡very ¡ ¡simple ¡AI ¡task ¡ • Algorithm ¡for ¡ ¡ the ¡predator? ¡ CS ¡4730 ¡

  20. Enhancements ¡to ¡Chase ¡ • Speed ¡Control ¡ – Velocity, ¡AcceleraJon ¡max/min ¡ – Limited ¡turning ¡Radius ¡ • Randomness ¡ – Moves ¡ – Paderns ¡ CS ¡4730 ¡

  21. Steering ¡Behaviors ¡ • Pursue ¡ • Evade ¡ • Wander ¡ • Obstacle ¡Avoidance ¡ • Wall/Path ¡following ¡ • Queuing ¡ ¡ • Combine ¡behaviors ¡with ¡weights ¡ • What ¡could ¡go ¡wrong? ¡ CS ¡4730 ¡

  22. AI ¡Strategies ¡ • ReacJon ¡vs. ¡DeliberaJon ¡ • When ¡having ¡the ¡NPC ¡make ¡a ¡decision, ¡how ¡ much ¡thought ¡goes ¡into ¡the ¡next ¡move? ¡ • How ¡is ¡the ¡AI ¡different ¡in: ¡ – Frozen ¡Synapse ¡ – Kingdom ¡Hearts ¡ – CivilizaJon ¡ – Halo ¡ CS ¡4730 ¡ 22

  23. AI ¡Strategies ¡ • ReacJon-­‑Based ¡ – Fast, ¡but ¡limited ¡capabiliJes ¡ • ImplementaJons ¡ – Finite-­‑State ¡Machines ¡ – Rule-­‑Based ¡Systems ¡ – Set ¡Padern ¡ CS ¡4730 ¡ 23

  24. AI ¡Strategies ¡ • DeliberaJon-­‑Based ¡ – Much ¡slower, ¡but ¡more ¡adaptable ¡ • ImplementaJons ¡ – A* ¡/ ¡Dijkstra ¡ – Roadmaps ¡ – GeneJc ¡Algorithms ¡ CS ¡4730 ¡ 24

  25. Set ¡Padern ¡ • Describe ¡the ¡AI ¡behavior ¡of ¡a ¡Koopa ¡Troopa ¡ – Or ¡any ¡other ¡bad ¡guy ¡from ¡SMB3 ¡ CS ¡4730 ¡ 25

  26. Finite-­‑State ¡Machines ¡ • An ¡abstract ¡construct ¡for ¡determining ¡the ¡ behavior ¡of ¡an ¡NPC ¡ • Any ¡given ¡behavior ¡state ¡is ¡represented ¡along ¡ with ¡rules ¡for ¡transiJoning ¡between ¡states ¡ • The ¡standard ¡bad ¡guys ¡in ¡Metal ¡Gear ¡Solid ¡are ¡ excellent ¡examples ¡of ¡this ¡ CS ¡4730 ¡ 26

  27. Switch ¡FSM ¡ CS ¡4730 ¡ 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend