320 likes | 441 Views
Lecture 25 - Strategy. CS 490/590 Wesley Kerr. Final Presentation. Two Parts Presentation Time : 5 minutes total – teaser to convince people to play your game Potential outline Team: who you are and who did what Game concept/pitch Technology What languages/libraries
E N D
Lecture 25 - Strategy CS 490/590 Wesley Kerr
Final Presentation • Two Parts • Presentation • Time: 5 minutes total – teaser to convince people to play your game • Potential outline • Team: who you are and who did what • Game concept/pitch • Technology • What languages/libraries • Platforms supported • Timeline • Screenshots from prototypes • Screenshots from now
AI Model AI gets information AI gets a slice of processor time AI turned into on-screen action
Tactical Locations • Retreat (rally) points • Used by military simulations to prevent routs • Cover points • Marked locations behind barrels, crates • Shadow area • Stealth games use the shadowed areas to hide • Sniper locations • Other points that provide tactical advantage for one side • ambush points, hot spots, sinking sand
One Step Further • What are the qualities of a good sniper position? • Good cover • Good view of approaching enemy • Construct a tactical graph that contains multiple pieces of information for each tactical waypoint • Supports both types of points necessary for a sniper position • Choose the locations that achieve both cover and neighbor with a reconnaissance location. • Types of waypoints in a tactical graph • Cover / Shadow / Exposed • What can we decide with this? • Ambush points • Sniper locations • Close cover points • For reloading and hiding
Reasoning • Tactical graphs are useful for reasoning • Imagine that you want to perform a hit and run on the enemy. • Lots of visibility • Lots of exit routes • An algorithm for automatic detection with this type of reasoning is very complicated and sophisticated • For instance, the node C is a has several exits available and good visibility. • You don’t perform a hit and run in the middle of the room • Have the level designer mark these nodes for you! • This is what tends to happen.
Tactical Waypoints • Issues so far • Context Sensitivity • Cover waypoints • Not simply a matter of being behind the barrel • To get good cover, you need to place the barrel between you and the enemy • Sniper locations • Only good when they haven’t been discovered • Easy solution • Add directional information to the waypoint graph • Cover – N,S,E,W • Additional information as well – crouched, standing • Harder solution • One state per waypoint • Do line of sight queries to determine amount of cover as needed
Tactical Information • Treat tactical information as regular information • Incorporate tactical information into your decision tree/FSM/HFSM • IF cover point close THEN go to it • Incorporate tactical waypoint graph into pathfinding • When you need to have sneaky AI, choose the path that minimizes your exposure • When you need to have dumb AI, choose the path that maximizes your exposure
Collecting Tactical Information • Human Level Designers • Humans are very good at quickly selecting a subset of the points that offer cover, etc. • This is the primary reason we use level designers to do this for us. • Issues • Level designers should be concerned with the flow of the level and making sure that it is fun to play. • They should not be concerned with inputting all of the information that your AI need to mount a successful attack.
Automatic Generation of Tactical Information • Cover points • Randomly select points in the room and cast rays to see if they would hit a character stationed at the tactical waypoint • Gotchas: • How do you handle multiple heights in the level? • Visibility points • Perform many line of sight tests • Rough approximation of the volume of the level that can be seen from the waypoint. • Shadow points • Requires an illumination model of the scene • Naive: For each waypoint, test several random points around it to calculate the average light intensity • Better: You are only as hidden as the brightest part of your anatomy • If your head is lit up and your body is hidden, then you aren’t hidden!
Automatic Generation of Tactical Information • Other techniques • Record player traces (i.e. make your testers work for you!) • Reveals locations where players are making use of cover • Condense a pathfinding waypoint grid • Start with a very, very fine grained grid • Keep waypoints that have the highest values. • Keep waypoints that have high values and are hard to reach • Two close nodes separated by a wall • Issues • Recording traces requires lots of people to play the game and more time to process the trace information • Condensing a pathfinding grid isn’t a cheap algorithm
Tactical Analyses • First task: Decide on representation of level • Chunk the level such that all of the area within the chunk has the same properties • Example: In a shadow map, all of the points in the chunk will have roughly the same illumination level • Techniques • Tiles, floor polygons, navigation meshes, etc.
Influence Maps • Keeps track of the current balance of military influence at each location • Contributing factors • Proximity of enemy unit • Proximity of a base • Duration since last occupied • Current weather • Surrounding terrain • Financial state of each military • Equations of influence
Terrain Analysis • Extract useful data from the structure of the landscape • Difficulty of the terrain • Useful for pathfinding • Avoid marching through the swamp if there are other options • Visibility of each location • Similar to waypoint analysis • Degree of shadow • Ease of escape • Choke points
Terrain Analysis • Frag-map • Each node in a grid has two pieces of information • The number of people killed or shot in this square • The number of people shot or killed from this square • AI can query this map and have it influence where they move to. • Notable example of this type of analysis • Team Fortress 2
Types of Strategic Analysis • Category 1: Unchanging properties of the level • Gradients in outdoor landscapes (assumes static landscape) • Shadow calculation (assumes constant lighting model) • Generally computed offline • Category 2: Slowly changing properties of the level • Updates that work slowly, or consider only a handful of locations at a time • Military influence in an RTS • Coverage of a fire station or a police station in a city simulation game • Category 3: Quickly changing properties of the level • Almost the whole level needs to be recomputed each frame • Techniques to limit computation time • Only perform calculations on most important areas • For example: For an AI looking for defensive cover, we only need to consider those enemies that are currently attacking it
Combining Information • We’ve covered several different analysis techniques • How secure is a square in the game? • How much visibility is available from a square in the game? • Other details about the environment • Distance to other units • Allows us to avoid clustering everyone into the same area • How do we combine the terms?
Combining Information • Option 1: • Quality = Security * Visibility * Distance • Option 2: • Quality = (Security * Visibility) / Tower Influence
Potential Fields • Like an influence map • Two types of charges • Positive charges attract the AI agent to them • Negative charges repel the AI agent away from them
Additional Information • Army field manuals • http://www.globalsecurity.org/military/library/policy/army/fm/ • Terrain Analysis • Terrain Analysis for Realtime Strategy Games • Dave Pottinger, Game Developer Conference 2000 • Tactical Analysis • Lars Liden, 2001 Talk • http://ai.eecs.umich.edu/people/laird/game-seminar/Liden.ppt • Terrain Reasoning for 3D action games • William van der Sterren, GDC 2001 • http://www.cgf-ai.com/docs/gdc2001_paper.pdf • Conference Proceedings • AIIDE ‘09 • A Multi-Agent Potential Field-Based Bot for a Full RTS Game Scenario • Johan Hagelback, Stefan J. Johansson • Books • Game Programming Gems 1-7 • AI Game Programming Wisdom 1-4 • Potential Fields • http://aigamedev.com/open/tutorials/potential-fields/