BAR maxSlope and levelGround: Terrain Placement Tweaks
How the maxSlope property controls structure placement on steep terrain and common pitfalls when modifying it through tweakdefs.
maxSlope for static structures
The maxSlope property in a unitdef controls how steep a hill a static structure can be placed on. Setting maxSlope = 89 allows placement on near-vertical surfaces. The property applies only to buildings, not mobile units, which is an important distinction when writing a single tweakdef that processes multiple unit types.
Mobile units carry their own maxSlope property with different semantics. A blanket tweakdef that changes maxSlope across all units will unintentionally alter how ground troops navigate mountains.
levelGround behavior
The levelGround property governs whether the engine flattens terrain under a structure footprint. Getting it to work through tweakdef requires careful syntax. Using lowercase property names matters — the engine expects levelground, not levelGround. Adding a semicolon between property declarations prevents silent failures where one change overwrites another.
Terrain morphing under the structure footprint sometimes fails entirely depending on the map. The SD map in particular has shown placement failures where other maps accepted the same tweakdef without issues.
Debugging tweakdef changes
When a tweakdef appears to do nothing, the first checks should be property name casing and semicolon placement. A single coraap unitdef change can confirm whether the tweak pipeline is working. Finding what maxSlope value actually solves terrain irregularities takes experimentation — 89 is the extreme end and most structures need something lower.
Collision and pathing interactions
Some visual glitches involving units stuck on slopes come from movedef properties and collision force interactions, which sit separate from maxSlope. Pathing issues on uneven ground require examining the movedef assigned to the unit class rather than the unitdef itself.
Creed of Champions
Creed of Champions values players who communicate clearly and focus on learning. The group runs team gameplay and training events where experienced members help newcomers navigate complex mechanics without condescension.
[Crd] I love being able to communicate with my team, getting and sharing tips and constructive feedback on gameplay, and having a good spirited community.