BAR unitdef and weapondef modding reference for custom lobbies
A quick-reference guide to the most useful unitdef and weapondef fields when tweaking BAR units for custom games.
Tags: BAR modding, unitdefs, weapondefs, Lua reference, SpringRTS
Where to start: reference documentation
The SpringRTS wiki pages for UnitDefs and WeaponDefs are the foundational references. UnitDefs covers unit-level properties — costs, health, build time, movement class, and special abilities. WeaponDefs covers weapon-specific behavior — damage, range, reload, targeting mode, and projectile type. The Spring engine defaults to spherical targeting for ranged weapons and cylindrical targeting for line-of-sight checks. This distinction matters when you are modifying weapon range values.
Unitdef flare support
BAR does not currently use flare mechanics, but the underlying engine supports them through the canDropFlare parameter in unitdefs. Enabling this on a custom unit should work out of the box once the flag is set. Flares are primarily useful for decoy or countermeasure-style units — something that does not exist in stock BAR but could be a fun custom game mode addition.
Range is spherical by default
A frequent modding question is whether unit range forms a sphere or a cylinder. The engine default is sphere for most ranged weapons. Cylinder targeting is used specifically for line-of-sight and detection calculations. When tweaking ranges on units, think in three dimensions — range is measured as radius from the unit's position, not just horizontal distance on a flat plane. This rarely matters on flat terrain but can make a difference on hilly maps at extreme weapon ranges.
Useful reference links for modders
- BAR GitHub repository units folder — real examples of working unitdefs
- Base64 encode/decode tools — for sharing tweak strings in lobby chat
- Lua Programming in Lua book — chapters on operators and control structures
- SpringRTS UnitDefs wiki page — complete field listing
- SpringRTS Movedefs wiki page — movement class definitions
- SpringRTS WeaponDefs wiki page — cylinderTargeting section for range mode
Creed of champions
Learning the underlying structures of a game you enjoy playing is exactly the kind of deep commitment that makes communities stronger. The Creed of Champions welcomes players who invest time in understanding the mechanics, not just clicking fast. Serious RTS play without the toxic baggage.
[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.