1 / 24

Artificial Intelligence in Game Design

Artificial Intelligence in Game Design. Camera Control. The Camera as a NPC. Good camera placement vital to good gameplay! Must maintain clear view of selected character Must highlight significant events to the player

clyde
Télécharger la présentation

Artificial Intelligence in Game Design

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. Artificial Intelligence in Game Design Camera Control

  2. The Camera as a NPC • Good camera placement vital to good gameplay! • Must maintain clear view of selected character • Must highlight significant events to the player • Must anticipate player movements, providing clear view of where the player’s character is moving • Best approach: Treat like an intelligent character • Must move in logical ways to perform goals • Movement must be smooth, not “jerky” or discontinuous • Best actions often depend on state of game

  3. Categories of Camera Perspective • First person: From perspective of player’s character • Implemented by parenting camera to “head” of character • Few AI-related problems, since camera totally controlled by player

  4. Categories of Camera Perspective • Third person: From point of view of “user” observing world and its inhabitants • Often “birds eye” view showing world around character • Few AI-related problems, since camera usually fixed above player

  5. Categories of Camera Perspective • “First and a half person” • From POV slightly behind and to side of player • Combines character POV with view of character

  6. “First and a Half” Person • Usually implemented by parenting camera to position relative to player character • Maintains same relative position/angle to player as player moves

  7. Problems • Must make sure no obstacles between camera and character • Will have to move camera around obstacles to keep character visible • Must make sure camera shot includes all relevant characters • Current opponent NPCs • Player themselves!

  8. Camera Position Selection • Usually have many viable camera positions for first-and-a-half person perspective • Choose the “best” one based on current situation

  9. Raycast Method • Project “rays” in different directions from character relative to camera angle (xangle, yangle) • (xangle + Θ, yangle) • (xangle - Θ, yangle) • (xangle, yangle + Θ) • (xangle, yangle - Θ)

  10. Raycast Method • Use raycasting to see if any intersect an obstacle atdistance shorter than distance from camera to character • These are potential situationswhere camera may be blocked in future dependingon how character moves • Example: Vector B intersects obstacle

  11. Raycast Method • Camera should flee vectors that are potential problems • Change relative angle • Potentially change distance/height • Should arrive at original angle once obstacle cleared

  12. Multipoint Method • Generate points in region where camera is moving to • Evaluate suitability of each point • Move camera to most suitable point

  13. Defining “Suitability” • Primarily based on constraints on relative position to character • Distance constraint: Penalty proportional to how far camera is from desired distance to character • Height constraint: Penalty proportional to how far camera is from desired height relative to character • Orientation constraint:Penalty proportional to how far camera is from desired angle relative to character

  14. Defining “Suitability” • Collision detection and visibility constraints • 0 if all characters visible • 1 if main character not visible • Possibly defined as “more than half of torso/head occluded” • 0 <n≤ 1 based on degree to which other important characters in area of player not visible

  15. Defining “Suitability” • Different components usually weighted Suitability = WDdistance constraint +WHheight constraint +WOorientation constraint +Wvvisibility constraint +(Wv usually larger than others) • Key idea: Developers can “tune” weights • Can experiment with different values by playing game • Which give most “intuitive” camera behavior?

  16. Regional Constraints • May want to constrain camera to specific area in space • Example: Showing dialog between two characters should keep camera locked in torus around the characters • Points to search limited to those that fall within this region

  17. Smoothing • Potential problem: Several nearby points might have similar suitability measures • Camera may oscillate back and forth between them as character moves • “Jerky camera” appearance

  18. Smoothing • Apply smoothing (averaging) to suitability function • Suitability (x, y) = 0.5 * Suitability (x, y) + 0.125 * Suitability (x+1, y) + 0.125 * Suitability (x-1, y) + 0.125 * Suitability (x, y+1) + 0.125 * Suitability (x, y-1) + • Usually results in one point consistently best over period of time

  19. State-based Suitability • Different constraint weights best in different game situations • Driving: Fixed angle relative to player most important • Jumping: Correct height most important to keep player from jumping out of camera • Multicharacter battle: Keeping all characters in frame

  20. State-based Suitability • Can use finite state machine for camera to choose appropriate weights/constraints Area with pits Jumping constraints Walking constraints Car reached Driving constraints

  21. Multicharacter Games • Some games allow player to swap control between several different characters • Camera must show world from perspective of current character • Transition should be smooth to avoid player confusion Don’t just jump

  22. Multicharacter Games • Move camera to new character in smooth transition • May have to use steering behaviors • Arrive at position behind next player character • Flee obstacles, positions where character not visible

  23. Multicharacter Games • Best approach may be to move over obstacles • Temporarily take “third person” approach

  24. Camera Events • Camera must often respond to other game events • Example: Off-screen explosion should cause “camera shaking” • Camera must be part of game messaging system • List of current world events maintained • Camera must regularly poll list for relevant events, take appropriate action Game Engine

More Related