Understanding BAR yardmap options and writing clear tweakdefs

Yardmap options control where units can move and build. Adding readable comments to tweakdefs helps others understand what your configuration does.

Tags: BAR modding, yardmap options, tweakdef comments, buildoptions, lobby configuration

Yardmap options beyond the wiki

The SpringRTS wiki lists basic yardmap flags like BLOCKED and BUILDABLE. BAR adds a few extras through source code modifications. YARDMAP_GEO blocks movement and building unless the unit is placed over a geothermal feature. YARDMAP_GEOSTACKABLE can be built on top of YARDMAP_BLOCKED and requires a geo flag underneath. YARDMAP_OPEN is always free for walking and building, overriding block settings. These options matter when designing custom factory layouts or modded structures that interact with terrain features.

Adding comments to tweakdefs

Tweakdef comments work differently than in regular Lua scripts. Because tweakdefs get encoded to base64 for lobby sharing, comments must be placed before the encoding step. The convention is to add a comment string at the start of the tweak table — the lobby displays the first 25 characters as a preview label. This means the comment is visible to players applying your tweak but does not affect execution. A clear label like "T2 naval AA rebalance v1.2" tells users exactly what they are loading.

Adding units to buildoptions

To add a unit to a factory's build menu without overwriting existing options, target the buildoptions table directly with a slot index. For example, adding an anti-air platform to a seaplane's build menu uses the format corcsa.buildoptions[47] = "coraap". This inserts the unit at position 47 without disturbing other build options. Getting the slot index right matters — too high and it falls off the visible menu, conflicting with an existing slot and overrides whatever was there before.

Creed of champions

Clear documentation and well-labeled configs help entire teams learn faster. The Creed of Champions community includes players who share clean, readable modifications rather than inscrutable scripts. Better teammates mean better games for everyone.

[Crd] It is so easy to get on with everyone and there is zero toxicity. Just fun games of BAR which can have quite a toxic community usually.

Advertisement