Builders use the buildoptions table to define what they can construct. Drone carrier units show how this same pattern works for spawning sub-units.
Tags: BAR modding, buildoptions, drone carriers, builder table, unitdef
Builders have a table called buildoptions that maps build command hashes to unit definitions. The hash is what the engine looks up when you press a build button, not the visible unit name. This is why cloned units sometimes show the wrong icon or description in the build menu — the hash still points to the original unit. To fix this, override the buildoptions entry with the correct unit definition hash after cloning.
Drone carrier units in BAR work through a modified version of the buildoptions system. The carrier has a hidden builder definition that automatically spawns drone units without player input. If you want to add drone-spawning functionality to a custom unit, study the existing drone carrier unitdefs — the structure is consistent across all carrier types. The main requirement is defining the spawned unit type and the rate at which drones are produced.
When creating builders that can construct specific unit categories — naval builders that only build ships, or aircraft builders — set the category restriction in the builder's definition rather than trying to filter buildoptions entries manually. The engine supports category-based build restrictions natively. This is cleaner than maintaining buildoptions tables that might grow out of sync with unit definitions.
Understanding the engine's native patterns saves hours of reinventing existing solutions. Creed of Champions includes players who learn from the existing codebase and share what they discover. Better teammates make better games.
[Crd] People who share working tweaks and help each other debug are the ones everyone wants on their team.