Clipping Your Level
Not to be confused with the CSG clip operation you can perform on brushes, clipping your level will help optimize player collision and help avoid stuck spots, both for players and AI.
You can see in this comparison shot how drastically the collision landscape of your level might become after a clipping pass. We'll get into specifics on this later, but first, an overview of the clip texture types available to you:
Quake 4 makes use of a host of varying clip textures, including a couple additions over the Doom 3 set. These textures can all be found in textures/common/ and are listed by material name. Keep in mind that these textures are defined in materials just as with any others, so you can mix and match these keys in your own materials:
clip: Generates collision for players and monsters. Generates AAS information.
full_clip: Generates collision for all players and monsters, and blocks all weapons fire. Generates AAS information and tactical features. Blocks monster line of sight.
player_clip: Generates collision for players only.
monster_clip: Generates collision for monsters. Generates AAS information.
monster_full_clip: Generates collision for monsters. Generates AAS information and tactical features. Blocks monster line of sight.
moveable_clip: Generates collision for physics objects and ragdolls.
shot_clip: Blocks all weapons fire.
largeshot_clip: Blocks only weapons fire specified with "clipmask_largeshot" "1" set on the projectile/hitscan entityDef (see rocket launcher, grenade launcher, etc).
trigshotclip: Only used on teleporters to allow weapons fire to teleport in multiplayer.
vehicle_clip: Generates collision for vehicles.
fly_clip: Remnant clip type from previous version of Strogg Hornet AI. No longer used in favor of standard monster_clip variants.
In addition to standard clip textures, a pair of AAS-specific textures can be found in textures/editor/:
aassolid: Generates no collision (despite 'solid' in the name)
aasobstacle: Used on func_aas_obstacle entities.
Single Player Clipping and AAS Generation
An important phase of every single player level is a clipping pass for AAS generation. While AAS data is generated for the level on every standard compile, a careful pass will prevent navigation issues and help the AI take full advantage of your level's layout.
Notes on AAS Generation:
- AAS only generates on the tops of brushes.
AAS floods from all monsters placed in the world as well as the spawn points on func_spawners. AAS flooding will spread across parallel surfaces, up ramps, and over small steps. In almost all cases, this covers all areas where AI of a given AAS size will be navigating.
If AAS for some reason fails to flood in a zone, an aas_flood entity exists for each AAS size. Place one of these in the non-flooded area to force AAS data of that size to flood.
- AAS flooding generates tactical features around solid geometry, monster_full_clip, and full_clip that can be used as cover points by tactical AI - the Strogg tactical transfers and the friendly marines. Cover points can either be full height or half height (half height is between 24-64 units and works best with the animations in the 40-48 unit range , full height cover is 64 units or taller). Cover points are best generated against right angles, so try to keep your monster_full_clip brushes as squared off as possible, and use additional monster_full_clip brushes to square off other appropriate cover points.
- Models and patch meshes do not generate AAS and require clipping if AI will be navigating on or near them.
- Terrain, as it is done as a model, poses some problems for AAS generation. Typically you will need to generate AAS under the terrain - AI will path over the terrain surface using the data generated below. For large elevation changes, you may need to create ramps of monsterclip under the terrain to link AAS areas.
Some additional notes on clipping you may find useful:
- If a player can stand on top of something, make sure that object's monsterclipping only goes as high as the player can go, and not to the ceiling - melee units will otherwise have trouble continuing their attacks, and any enemy will lose the player entirely if he becomes hidden in a monster_full_clip brush.
- To generate cover points around complex shapes, start with a squared-off monster_full_clip, then layer a more precise monster_clip brush over it. Cover points will generate based off the monster_full_clip locations, but AAS will be generated around the monster_clip brush. (Take care that monsters can still fire their weapons accurately from the cover points.)
When creating elevators, place an AASSolid brush (with an aas_flood entity, if needed) and a func_aas_obstacle at each floor. The AASSolid brush will allow AAS to generate, allowing AI to path on and off of the elevator when it is present, and func_elevators automatically toggle func_aas_obstacles when their origin enters one, preventing AI from entering the elevator shaft if no elevator is present.
In long elevator shafts such as the one in the Nexus Core level (game/core1.map), monsters may lose AAS much like described for terrain above. To allow monsters to path on the elevator as they do after jumping through the windows on the side of the shaft, place AASSolid brushes at regular intervals through the shaft, each with the appropriate aas_flood entity on top. By the time your monster would have lost AAS data, another layer is available:
- Patch meshes will not generate AAS, but will generate collision on the 'visible' face. You can use clip textures on patch meshes to create one-way barriers, though it's best avoided for non-flying monsters. Patch mesh clips were used in a couple instances to allow Strogg Hornets to enter, but not leave, confined areas in the Construction Zone (game/walker.map) level.
Clipping in multiplayer is generally a much less involved task. Most important is player mobility - players should not get stuck on anything they're not intended to. A good rule is if something isn't large enough to hide behind, you should clip it off. A common practice in clipping multiplayer levels is to place angled clip brushes on small protrusions from walls to allow players to bounce off with no loss in speed:
Stairs are known to interrupt strafe jumping, which we remedied by ramp-clipping stairways in the stock maps. This prevents hitches in movement in addition to opening more ramp-jumping opportunities, which of course we all love.
Since AAS is not an issue, you can in some cases get away with clipping that would fail in a single player environment - one-way or curved patch mesh clipping, for example.
Community-made multiplayer bots may make use of AAS hulls for bot navigation. Consult individual bot documentation files for information on preferred clipping methods - they may differ slightly from what is described here.
Back to LevelEditor