1 / 36

Announcement

Announcement. Mr. Todd Howard Design, Director and Producer at Bethesda Game Studios will be speaking about the 'Future of Commercial/Entertainment Video Games '. October 8th @ 7:00PM in Harris Theater. CS425 Lecture 5. Jan M. Allbeck. Preliminary Notes. No class next week!

ova
Download Presentation

Announcement

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. Announcement Mr. Todd Howard Design, Director and Producer at Bethesda Game Studios will be speaking about the 'Future of Commercial/Entertainment Video Games'. October 8th @ 7:00PM in Harris Theater

  2. CS425 Lecture 5 Jan M. Allbeck

  3. Preliminary Notes • No class next week! • No office hours next week, but send email anytime. • Make sure you can receive GMU email. • Code due Oct. 16th: • Working code integrated into our game code base • Way point navigation and A* • Reasonable class structure for the characters and objects • Loading and placement of objects from the environment setup • Animations on the characters • Ability to constraint objects to characters • Code should be well/clearly documented • Code will represent 10% of your grade (a part of the 50% for the final project).

  4. Game AI • Scripting • Finite State Machines • Fuzzy Logic • Rule-based AI • More AI • AI for RAMbot

  5. Scripting • What is scripting? • Scripting Opponent Attributes: CREATURE = 1; If (LEVEL < 5) INTELLIGENCE = 20; SPEED = 50; ELSE INTELLIGENCE = 5; SPEED = 25; • Need to parse these files and link them to program variables.

  6. Scripting Opponent Behavior If (PlayerArmed == TRUE) DoFlee(); Else DoAttack(); • Patterns of movement • Explicit paths for characters to follow

  7. Scripting Verbal Interactions If (PlayerArmed == DAGGER) Say(“What a cute little knife”); • Dark GDK can load and playback WAV files. • Of course these can be varied to take into account the nature of the characters involved. • They can also convey information or respond to inquiries: If Ask(“What is your name?”) Say(“I am Merlin.”); • More robust if keyword scripting is used. • Essentially search the string for a few keywords to match to.

  8. Script Events If (PlayerLocation(120, 76) Trigger(Explosion1); If (PlayerLocation(10, 45) Trigger(TrapDoor7); • Can we be a bit smarter about this? • Link to objects, not locations • Program/Implement a list of “effects” and reference them in a script • Package scripts with environment files

  9. Finite State Machines

  10. Finite State Machines t1 S1 S2 t2 t3 t4 S3 S5 t5 S4 t5

  11. Ghost Controller See = false Roam See = false See = false See = true blue = true Evade Chase See = true blue = true blue = true See = true

  12. Implementation Switch(currentState) { Case Roam: If (See(Blue) == true) currentState = Evade; Else if (See(player) == true) currentState = Chase; Else if (See(player) == false) currentState = Roam; Case Chase: … Case Evade: … }

  13. Implementation 2 • We could also create or use a general finite state machine software package. • Define states or nodes (WE LOVE NODES!). • Define transitions • Associate states with transitions • Define a method that “advances” the state machine. • Parallel state machines • State machines can be nodes in other state machines.

  14. Hostile State Machine? • States or behaviors? • Guarding • Patrol • Frozen • Sneak and flip • Captured • Escape • Transitions or percepts? • See robot (non-flipped) • Seen by commander or robot • Commander says captured • Out of building

  15. Fuzzy Logic

  16. Fuzzy Logic • What is it? • “The essence of fuzzy logic is that everything is a matter of degree.” • Imprecise • Uncertainty • “Very smart, but kind of slow” as opposed to intelligence = 170 and speed = 1.2mph • Allows us to think more normally • There are degrees of fuzziness (0 to 1)

  17. Fuzzy Logic Crisp Input --- Fuzzy Input Fuzzy Rules --- Fuzzy Output Defuzzification--- Crisp Output

  18. Fuzzy Logic in Games • Control • Threat Assessment • Classification

  19. Fuzzy Control • Entity traveling toward a target (waypoint, enemy unit, treasure, home base, etc). • Smoother path motions • Instead of using exact coordinates use fuzzy concepts such as to the left, a little to the right, etc. • Relate relative headings to Far Left, Left, Ahead, Right, and Far Right.

  20. Relative Heading Fuzzy Sets From AI for Game Developers

  21. Membership Calculation Results for 33 deg Right is a trapezoid membership function and Far right is a grade membership function. http://powerelectronics.tkk.fi/education/s81270/ex7.pdf NetForce = FarLeft * MFL + Left * MFL + Right * MFR + FarRight * MFR; Where, MFL = maximum force left = -100 MFR = maximum force right = 100 Steering force = 77! http://www.red3d.com/cwr/steer/gdc99/

  22. Fuzzy Threat Assessment • Range = near, close, far, very far, etc • Size = tiny, small, medium, large, massive, etc • Results in: no threat, low threat, medium threat, high threat • Models the computer as having less-than-perfect knowledge • Allow, for example, the size of a defensive force to vary smoothly and less predictably.

  23. Fuzzy Classification • Rank characters according to combat prowess • Strength, weapon proficiency, number of hit point, armor class, etc. • Yield: wimpy, easy, moderate, tough, etc

  24. Rule-Based AI

  25. Rule-Based AI • If-then style statements • Expert systems • Medical diagnosis, engineering fault analysis, etc • Anticipation • 2 components • Working memory: what is true about the world • Rules: what can be inferred from what is true.

  26. Inference • Forward Chaining • Match rules to facts in working memory • Conflict resolution: determine what rule we want to fire • Fire rule: assert a new fact, trigger event, call function • Backward Chaining • Have a goal and try to determine how to reach it • Open the door

  27. State Machines and Rules • What can Finite State Machines do that Rule-Based systems can’t? • What can Rule-Based systems do that Finite State Machines can’t?

  28. More AI • Map perceptions (sequences) to actions • Simple reflexes • Characters with memory • Goal-based characters • Utility-based characters • Environment-based AI • Crowd sims • Smart-objects • Searching and search algorithms • A*, backgammon, chess, etc • Learning • Neural and belief networks • Reinforcement learning • Communication between characters

  29. RAMbot AI? • Player • Robots • Innocents • Hostiles • Objects?

  30. Search and Rescue Robots (SR-Bots) • Needs a snappy name • Basic Scenario • A team of robots controlled by a commander are tasked with clearing a building. The buildings may contain weapons and bombs, innocents, bad guys, and furniture and debris. Robots can move weapons to secure locations, detonate bombs, free innocents, and observe bad guys. The commander (i.e. player) instructs the robots to clear the building as quickly as possible.

  31. Rules • Robots can defuse/detonate bombs without damage. • Bombs defused/detonated in the same room or hallway as humans will kill them all, causing the player to loose the game. • If seen by a robot, bad guys cannot move. • If they approach from behind, bad guys can disable robots (by flipping them upside down). • Frozen bad guys can be captured by the commander.

  32. Rules continued • The goal of the bad guys is to escape the building. • Paths may be blocked such that the robots cannot pass. The commander can unblock paths by moving the furniture or debris. • Innocents will remain where they are until their location is visited by a robot or commander. They then exit the building. • If the commander enters a room with bombs, the commander dies. • If the commander enters a room with a bad guy and not a robot, the commander dies.

  33. Characters • Robots: • a team of robots • number of robots varies with size and complexity of environment • capable of moving through the environment • can set off bombs • can pickup and move small items such as guns • cannot move larger items such as furniture • little intelligence, and hence most be commanded • able to navigate from one location to another • vulnerable to bad guys if approached from behind • Commander: • the player of the game • controls the robots • vulnerable to bombs and bad guys if not frozen • needs to move blockages for robots

  34. Characters continued • Innocents: • when released by the commander or a robot, they exit the building • while exiting, they are unaffected by anything else in the environment • Bad guys: • want to escape the building • cannot move if seen by a robot • if seen by a robot, can be captured by the commander • can disable robots by approaching them from behind • will kill commander if in a room alone with him

  35. Environment • World • Building is laid out on a grid. • Objects • Weapons • Bombs • Furniture/blocks/debris

  36. Actions • Walk to location • Exit building • Stay • Turn • Pickup • Drop • Defuse/detonate • Capture • Kill

More Related