Strategies for implementing cover Behaviors
[Game ai] masking strategy Share this | September 3rd, 2007 | combat | Alex J. champandard Address: http://aigamedev.com/combat/cover-strategies Author: Alex J. champandard Translator: Lai Yonghao Whilst catching up with recent discussions about game AI on the web, I stumbled on this thread about cover. implementing Good combat behaviors using cover isn' t always straightforward, but game developers often use the same tricks to solve this problem... I occasionally found this discussion, and finally caught up with the recent online discussion about game AI. Using the bunker to achieve good combat behavior is not easy, but game developers do not have much idea about this issue ...... Screenshot: Finding and taking cover in Gears of War. : The Role in Gears of War knows how to find and use the bunker Cover Behaviors
Masking The actual behaviors are the most important part of the cover AI. if you get these right, the rest of the AI doesn't have to be perfect as there'll always be an appropriate fallback behavior when no cover is available nearby. Realistic behaviors are the most important part of masking ai. If you do this well, AI does not need to be perfect, after all, it is not inappropriate to let the role retreat when there is no available bunker around. Most actors require the following behaviors: Most roles need these actions: 1. Reacting to weapon fire by looking surprised for a short amount of time. In a short time, I was surprised to respond to the fire. 2. Assuming a intermediate position to search for cover, e.g. Like dropping down on one knee. Assume that a middle location is used to search for a bunker, such as a single knee 3. Playing a short animation while looking for cover, and signaling the threat to team mates. Play a small animation while searching for a bunker to signal teammates. 4. Moving swiftly but carefully into the most appropriate position, Quickly and carefully move to the most appropriate location. 5. Or alternatively, lying down on the spot for protection. Another option is to perform local sleep. Once you have the combat behaviors work correctly without using context sensitive cover, you can start thinking about scanning the environment for places to hide. When your combat behavior is no longer sensitive to masking environments and can work properly, you can start to think about scanning environments to find hidden places. Manually placing cover points
Manually identify masking points The simplest solution to allow actors to find cover locations in the world is to manually place them while editing the level. it's a simple workflow that requires very little technology, so it's often the best compromise. A simple solution for a role to reach the bunker is to manually identify the masking point when editing the level. This simple workflow requires only a few technologies, so it is often the best compromise. Advantages
Advantages Manual placement is a great way to fine tune the behaviors by placing cover locations exactly where you want them. so if you have special geometry, or need to customize the cover location per-level to fit in with a story, then manually adding cover locations to the level ideal. One advantage of manual placement is that you can adjust behavior by changing the position of the masking point. Therefore, if you have a special geometric structure or need to create different masking points for different stories, you can manually add masking points. Disadvantages
Disadvantage The only down side of this approach is that it requires more work by the level designers. to remedy this, You shoshould consider attaching cover points to the object geometry (pillars, boxes, etc .), rather than for each instance in the world. then, only add cover locations to static geometry as a fallback. The only bad thing about this method is that the level designer needs to do more work. To compensate for this shortcoming, you can consider attaching masking point information (such as columns and boxes) to a geometric object rather than manually editing each instance in the game world. Then, the masking point is added to the Static geometric structure as a backup. Ideally, you should start with manual cover point placement, then design your software to support multiple sources for cover spots. This will allow you to automatic part of the process where possible. Ideally, you should first use the method of manually placing masking points, and then design your software to support multiple masking point sources, which may achieve partial automatic processing. Terrain Analysis
Ground Object analysis If you feel confident about extending your level geometry pipeline, then terrain analysis becomes an option too. the idea is to use the structure of the world itself to find cover locations automatically. this process typically involves two steps: generating candidates and filtering out the bad ones. If you are confident that you can expand your level structure pipeline, ground feature analysis becomes available. The idea is to use the structure of the game world to automatically search for masking points. This process usually involves two steps: generating candidate masking points and removing poor ones. 1) generate cover candidates from the geometry
1) generate candidate masking points To achieve the first step of generating cover candidates, you can use any of the 3D data available for each level. this includes des the collision mesh (low and high detail), the navigation mesh, or even a waypoint graph. The first step in generating candidate masking points is that you can use any 3D data in the level. Includes a collision mesh (including high and low details), a navigation grid, or a path map. Typically, the navmesh provides the most useful information as it models the floor of the environment very closely. each external edge of the navmesh can be assumed to be around und an obstacle of some kind, so generating cover points at fixed intervals along those edges is a very good strategy. concave navmesh corners also provide you with information about leaning from cover, which wocould be very hard to determine otherwise. Generally, the navigation network can provide the most useful information because it is most closely related to the environment ground model. Every outer side of the navigation mesh can be considered as the edge of an obstacle. Therefore, it is a good strategy to generate masking points along the outer side of a fixed interval. The concave angle of the navigation grid can provide information about the tilting side of the masking point, otherwise this is difficult to calculate. Using the waypoint graph also works, but it doesn't have as good a sense of the floor as the navmesh. the result is that the waypoints are rarely placed perfectly up against the cover locations. it's also much harder to annotate the cover points as places where leaning is supported. The path map can also work well, but it is worse than the navigation grid. Because the path is rarely "close" to the masking point, it is difficult to mark the support of the masking point for the aspect. 2) filter out invalid or bad choices for cover.
2) Remove unavailable and insufficient options The algorithm for generating cover candidates is typically very overeager, so it's necessary to filter most of them out. to do this, you need to compute if each provides sufficient cover from any area of fire. A zone around each cover point shoshould be scanned using line of sight (LOS) checks, either limited by a maximum radius or using the potentially visible set (PVs) in the level. if a cover location is hidden from a minimum area (customizable), then it shoshould be saved for use at runtime as it may be useful. The Algorithm Many of the generated masking points are unavailable or not good enough, so most of them need to be removed. To complete this step, you need to calculate whether the role can be masked to withstand bullets from anywhere, the visual moment with the maximum radius or the potential visible set of the level should be used for scanning around each masking point. If the position of the masking point is hidden in a small area, it should be saved at runtime because it is quite useful. Cover Selection
Masking Point Selection Pre-processing cover locations helps greatly, but since most game situations change dynamically, there's always some checking necessary at runtime. Typically, the cover selection algorithm takes into account: The Preprocessing of masking points is huge, but as more games support dynamic changes, it needs to be tested at runtime. Generally, the masking algorithm considers the following two aspects: Position and orientation of the enemies to determine the source of fire. The enemy's position and direction are determined as fire points. Accessibility of cover points, and is return fire possible. The accessibility of masking points and the possibility of counterattack. A good place to start for cover selection is to implement a scoring mechanic for neighboring locations. you can add different heuristics to rank the cover points as necessary, and the actor will always try to pick the best. An excellent way is to implement a scoring Mechanism for the surrounding locations. If necessary, you can add different heuristic ranking for the masking points. Then the role will always be the best among them. What techniques do you use to find cover for your actors?
What technology do you use to locate masking points for a role?