Presentation on theme: "1 CO3301 - Games Development 2 Week 15 Terrain Analysis Gareth Bellaby."— Presentation transcript:
1 CO Games Development 2 Week 15 Terrain Analysis Gareth Bellaby
2 Terrain analysis ●Pre-processing ●Analysis by eye or by experimentation. ●Smart objects and locations. ●"I am a sniping point" ●"I am cover"
3 Applicability ●A wide variety of approaches. ●Team based games ●Squads ●Enemy AI. ●Moving into cover ●Adopting good firing position, e.g. sniping point ●Provide covering fire, e.g. firing at windows and doors ●Provide supporting fire.
4 Specifically ●Require a representation of the terrain. ●Also require the means to reason about that representation. ●Difficult to generalise. ●Typically custom built. ●But general points can be made.
5 Initial analysis ●As with all AI you need to decide the attributes being used in the reasoning. You cannot recognise a choke point or a sniping point unless you have already decided that these are of use to your game and things you desire to recognise.
6 Waypoints ●Reasoning using waypoints. ●This is a simplification. You need a representation of the world. ●For each waypoint calculate its offensive and defensive value. ●Directional information is needed. Shooting out of a window is different from shooting up at a window. A wall provides cover for one direction, but not for another.
7 Waypoints ●You can take various factors into consideration. ●Sterren suggests (among others): ●cover ●lack of cover at target ●distance to objects such as power-ups ●lighting level ●locations which restrict movement ●observed approaches
8 Static and dynamic ●Some static analysis is comparatively easy. Hills, shores, etc. This analysis can be pre- processed. ●Things are more difficult with dynamic terrain.
9 Clustering ●One approach is clustering. You have looked at this already. ●Here's an example, in a strategy game need to be able to recognise dynamic areas, e.g. towns and forests. You can think about these areas as composed of lots of things that touch each other. Place a small radius around each tree. A forest is an area of contiguously touching radii. ●The region is complex. Better to convert into a convex hull.
12 Convex hulls ●Convex hulls are good. They are easy to reason with and about. ●Nice example of optimisation in Higgins. ●Need to know what points are inside the convex hull. It would be extremely inefficient to store all of the points. Instead store one point for each x value. Associated with each x value is a series of y values indicating the start or end of the sequence.
13 Convex hulls
14 Convex hulls
15 Choke points ●Choke points. Use an influence that can grow. Each region is surrounded by uniform area. Grow this out to your required distance. Any areas that overlap can be considered to be choke points. ●The analysis can be extended to show where to hide as well. Take the centre of the choke point. Trace a route along the edge of the region going away from the choke point, until there is no direct line-of-sight to the choke point.
16 Choke points
17 Choke points
18 Influence maps ●This leads back to influence maps. This method of growing a region is a version of an influence map. You are extending the influence of the area out in order to calculate an area of interest. Influence maps have been used for terrain analysis, e.g. Age of Empires to identify locations such resource points, building placement as well as staging areas for attack, and routes for attack.
19 Influence maps and routes ●Find a route through an enemy's domain that avoids any possible early warning to the enemy. ●Similar to the identification of choke points. ●You can see the range of applications that this approach lends itself to.
20 Influence maps and routes
21 Cover behind objects ●Simplest case is single opponent firing at you. You trace a line-of-sight to the edges of the object. Any point in between the two edge points is in cover. ●Can be extended for multiple opponents but you must take account of the case where there is no cover point. ●Perfect location for cover can be calculated by calculating the centre of gravity of the object. ●Can assume that the object is 2d and that mass is evenly distributed. ●The simply trace a line from centre to opponent or opponents.
22 Sources & further reading ●Sterren, William van der, "Terrain Reasoning for 3D Action Games", Game Programming Gems 2, ●Sterren, William van der, "Terrain Reasoning for 3D Action Games", rrain_reasoning_for_3d_action_.php ●Not same article, but covers similar grounds. ●Higgins, D., "Terrain Analysis in an RTS-The Hidden Giant", Game Programming Gems 3, 2002.
23 Sources & further reading ●Dill, K., & Sramek, A., (2003), "Performing Qualitative Terrain Analysis in Master of Orion 3", AI Game Programming Wisdom 2. ●Kent, T., (2003), "Multi-Tiered AI Layers and Terrain Analysis for RTS Games", AI Game Programming Wisdom 2. ●Woodcock, S., (2002), "Recognizing Strategic Dispositions: Engaging the Enemy", AI Game Programming Wisdom.
24 Sources & further reading ●Paanakker, F., (2008). "Risk-Adverse Pathfinding Using Influence Maps", AI Game Programming Wisdom 4. ●Obelleiro, J, Sampedro, R, & Hernandez Cerpa,D., (2008), "RTS Terrain Analysis: An Image-Processing Approach", AI Game Programming Wisdom 4. ●Darken, C., & Paull, G., (2006), "Finding Cover in Dynamic Environments", AI Game Programming Wisdom 3.