BAR Lua API documentation and unitdef reference for modders

Finding accurate documentation for Beyond All Reason unit and weapon definitions means knowing where to look. The Spring engine wiki provides a starting point, but the BAR-specific Lua API has its own reference that covers current behavior.

Tags: BAR Lua API, unitdef documentation, weapondefs reference, spring lua, beyond all reason modding

Where BAR Lua documentation lives

The beyond-all-reason GitHub repository hosts a generated Lua API reference at beyond-all-reason.github.io/spring/lua-api. This is the current source for Spring engine function signatures, callback documentation, and available API calls within BAR. It covers everything from unit spawning and order giving to widget registration and team management. Bookmark this for modding work.

Spring unit definitions wiki, current state

The Spring RTS wiki page on Gamedev UnitDefs remains the broadest single reference for what every unitdef field does. The page is slightly outdated compared to current BAR behavior, but most fields still apply. Values like maxdamage, buildCostMetal, and movement properties match what you find in actual unit definition files. When the wiki and the actual unitdef disagree, trust the unitdef.

Weapon range belongs in weapondefs, not on the unit

A common tweakunits mistake is setting range as a direct unit property. Weapon range lives inside weapondefs, not on the unit definition itself. To change a unit's weapon range through tweakunits, target the specific weapon definition using the correct nesting pattern. For the armmav unit, the path is weapondefs.armmav_weapon.range with a value like 10000. Setting range on the unit directly does nothing because the engine reads range from the weapon subtable.

Reading actual unitdef files

The best way to understand what a property does is find it in the actual unit definition file. Every unit has a lua file under the units/ directory in the BAR repository. Arm mavs are in units/ArmBots/T2/armmav.lua. The structure of these files shows exactly how weapondefs, customparams, and other subtables nest under the main unit definition. Reading existing unit files teaches more than any documentation.

Creed of Champions

Understanding BAR at the code level makes you a better player too. Knowing why units behave the way they do informs better in-game decisions. Creed values that kind of depth. People here appreciate when teammates understand the game mechanics, not just the hotkeys.

[Crd] The first and only community I have seen that actually holds up to its values. I have honestly not had a single bad experience here.