Using bset lobby tweaks and avoiding modrules mistakes in beyond all reason

How to apply lobby tweak commands, why tweakdefs cannot change modrules, and Lua performance tips for BAR mods.

Tags: beyond all reason lobby commands, tweakdefs, bset, modrules, flanking bonus, lua performance

The bset command in BAR lobbies

BAR lobbies accept tweak commands starting with !bset. The syntax is !bset followed by the tweak slot name and an encoded value. Players used this to adjust parameters like flanking damage before the option was removed from direct access.

When a specific !bset slot gets retired, the alternative is switching to tweakdefs. Modders submit a tweakdefs file that changes the relevant unit parameters. The tweak runs when the game loads, replacing the old lobby command approach. Hosts need to make sure the tweakdef file is shared with all players in the lobby.

Why modrules cannot use tweakdefs

A common misconception is that modrules.lua parameters can be changed through tweakdefs. They cannot. Modrules define global game behavior that sits outside the unit definition pipeline. Tweakdefs operate on unitdefs, weapondefs, and similar per-unit tables only.

If you need to override a modrule setting, the answer is not tweakdefs. Instead, check whether the modrule is a default that can be overridden at the unit level. Most modrule values, like flanking bonus defaults, are fallback values. Setting the equivalent parameter inside individual unitdefs makes the modrule default irrelevant for that unit.

Lua performance tips for BAR modding

Lua performance matters when widgets or mods run inside the Spring engine. The Spring wiki maintains a Lua performance guide at springrts.com/wiki/Lua_Performance. The top tip: localize variables inside functions instead of reaching for globals on every call.

For BAR modding specifically, this means caching references to frequently used tables like UnitDefs or WeaponDefs in local variables at the start of your widget file. The lookup savings add up across hundreds of calls per frame.

Clear information, clean execution

Getting BAR settings right the first time saves the whole team from avoidable problems. Creed of Champions values players who take the time to set things up properly and share knowledge. That mindset extends from widget configs to game strategies.

[Crd] One of the few places where you can for sure coordinate with people in matches with a good supportive attitude. Everybody tends to be understanding and constructive.

Better teammates. Better games.