Cross-reading Zero-K gadgets that port well into BAR, from area guard commands to shield guard widgets and the gotchas you will hit.
Zero-K ships an cmd_areaguard.lua gadget in LuaRules that lets you assign units to guard an area rather than a single unit. This is the reference implementation that BAR modders point to when they want area guard behavior. The gadget listens for the command, then distributes guarded units across the designated zone.
The problem is that it does not handle mixed-speed unit groups well. Fast units arrive at their patrol positions and the slow units are still moving. A more robust solution would stagger deployment times based on unit speed class or use a convoy-order arrival pattern.
Zero-K also provides a unit_shield_guard.lua widget in LuaUI that handles shield behavior. BAR shares the same Spring engine DNA, so the approach is portable. The widget manages which shielded units take priority when incoming fire targets them.
If you are building custom shield behavior or want to modify existing shield logic, studying this widget saves hours of reinvention. The core pattern is the same: detect incoming projectiles, position shield generators, and manage energy allocation.
Shield areas are determined by three points. When those points nearly form a straight line, the shaded area collapses into something barely visible. Modders working on custom shield visualizations hit this edge case. A practical fix is to enforce a minimum triangle area proportional to the longest side, so degenerate shapes still render at a readable size.
Both of these patterns come from Zero-K, but the engine is shared. BAR modders do not need to write area guard or shield logic from scratch. Read the Zero-K gadget and widget code, port the patterns into the BAR file structure, and test. The engine callins are compatible and the Lua patterns translate directly.
"Creed of Champions is a great place to learn and play BAR in a friendly atmosphere. Training sessions, team gameplay, even some non-BAR stuff. Large cross section of abilities, time zones, and game mode interests."