A look at the Lua boilerplate tricks BAR modders use to write cheap, clean unit tweaks, plus practical guidance on naming customs and mods in Beyond All Reason.
Set up a short Lua module once, then tweak units with two or three lines afterward. The pattern copies a base unit definition into a temporary table, modifies the fields you need, and registers the result under a new name.
local _u = {}
function SET(def)
_u = table.copy(UnitDefs[def])
end
function ADD(name)
UnitDefs[name] = _u
end
function MC(v)
-- modify customparams
end
Call SET("corak") to grab a commander, adjust _u.metals and _u.energyStorage, then ADD("my_corak"). A single boilerplate file handles dozens of variants without repeating table.copy calls. This approach runs fast because the game loads definitions once at startup and the Lua overhead disappears.
With the boilerplate in place, changing one unit takes three lines: SET the source unit, mutate the fields you want, ADD the new key. Adding a customparameter to dozens of units means copying the template, editing the customparams table, and registering each variant. The boilerplate cost is paid once. Every tweak after that is cheap.
This pattern works best when the units share a common base. Copying a grunt into a heavy grunt requires adjusting health, weapon damage, and construction speed. Copying a commander into a variant requires metal and energy costs plus weapon cooldown changes.
New modders often ask how to name their custom mod correctly. The name field lives in modinfo.lua at the root of your mod directory. It needs a short displayName for the lobby list and a game identifier that is unique enough to avoid collisions with other mods. Avoid generic names like "Tweaked Units" since another modder likely uses the same label.
A working convention: prefix with your initials or a short code, follow with a descriptive label, and include a version number. Something like "RT-HeavyGruntV1" tells other players the origin and purpose at a glance.
Producing video content from Beyond All Reason matches runs into the same replay system limitations that affect all players. The built-in demo recording captures engine state for replays rather than screen output, so creating shareable content requires an external capture tool running alongside the game. BAR does not ship with a built-in video export function.
Record with OBS or a similar tool, set the capture to match your game resolution, and encode at a bitrate high enough to keep fast-moving unit sprites clean. The engine renders cleanly at standard resolutions, so upscaling captured footage does not add detail the original render lacks.
"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." — Crd-004