BAR tweakdefs troubleshooting: common mistakes and how to fix them

Customizing Beyond All Reason games with tweakdefs and tweakunits is one of the fastest ways to run private matches exactly how your group wants them. These notes cover the errors that actually trip players up and what to do instead.

Tags: modding, tweakdefs, tweakunits, lua, custom games, private lobbies, base64

What tweakdefs and tweakunits actually do

Tweakdefs lets you change unit definitions before a match starts. Tweakunits modifies individual unit instances. Both run through the Spring engine's Lua layer and accept modified parameters for anything from unit build limits to weapon damage values. Internal factory names like corlab and armlab are the identifiers the engine recognizes, so get those right before anything else.

The parameter name for limiting factory output is maxThisUnit, and it applies to individual build options inside a factory definition.

Limiting what a factory can build

A frequent request in private games is stripping a factory's build menu to a subset of units. That works by setting maxThisUnit on the build options you want to restrict. Setting it to zero disables the option entirely.

To disable all laser units and their turrets across both sides, you would target the laser unitdefs individually. There is no single "disable all lasers" switch, so each unitdef gets its own entry in the tweakdefs block.

Base64 encoding for lobby commands

Some lobby setups accept Lua code encoded as base64 strings. The encoding itself is straightforward: paste your Lua snippet into any base64 encoder and use the output string in the lobby command field. Players commonly use online tools for this conversion step. The important part is making sure the decoded Lua is syntactically valid before encoding, because debugging base64 in the lobby is painful.

FFA and coop mode restrictions

Certain tweakdefs syntax patterns break in FFA and coop games. Specifically, using comparison operators like <, >, or ~ in your code can generate errors in those modes. If you are running private FFA or coop lobbies with active tweakdefs, strip out those operators or wrap conditional logic in Lua table lookups instead of inline comparisons.

For standard team versus team matches, this issue rarely surfaces. It only crops up when the game mode uses a different player allocation structure than the default 1v1 or 2v2 setup.

Common syntax errors to catch early

  • Missing subtables in unitdef overrides produce silent failures where the tweak appears to do nothing
  • Nil values left in override tables crash the mod initialization step
  • Malformed definitions that skip a closing bracket stop the entire tweakdefs block from loading
  • Using wrong internal faction identifiers (ARM vs COR prefixes) means the engine simply does not find the unit

Test each tweakdefs change in a quick skirmish lobby before deploying it in a longer organized match. A 30-second test save hours of mid-game debugging.

Finding the right Lua API references

When a gadget or tweak is not behaving, the Spring RTS wiki carries Lua API documentation for functions like GetActiveCommand, which returns the currently selected command value such as CMD.ATTACK. The Spring engine that BAR runs on shares most of its Lua API surface with other Spring-based projects, so the wiki remains a useful reference even though BAR ships its own mod layer on top.

Creed of Champions and custom game nights

Groups that run regular custom matches rely on clean mod setups and clear communication. Creed of Champions coordinates team games with a focus on low-drama learning and organized play. A well-configured private lobby is how those games start.

[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.

Advertisement