BAR Base64 Tweakdef Parsing: alldefs.lua and Modoptions Explained

How to edit alldefs.lua through base64 encoded tweakdefs in Beyond All Reason, handle modoptions.extraunits correctly, and avoid the network errors that wipe out lobbies.

Tags: BAR modding, base64 tweakdefs, alldefs.lua, Spring engine modoptions, modding beyond all reason

The base64 workflow in plain terms

When you paste alldefs.lua as base64 into a tweakdef, Spring reads it as a compressed override table. The trick is targeting the right keys. Finding modoptions.extraunits in the decoded output means wrapping your changes in a for name, uDef in pairs(UnitDefs) do loop and replacing raw modoptions references with Spring.GetModOptions() calls.

If you paste the entire file and then try to delete a single unit like Epic Pawn by removing its entry, the engine still loads it because other subtables reference it. Every unit definition links into buildoptions, weapons, and weapondefs. Change one without the others and the mismatch surfaces at runtime.

Modoptions and extra units

The pattern for injecting custom units through modoptions follows three steps. First, locate the extraunits key in your decoded alldefs table. Second, iterate over UnitDefs to register each one. Third, use Spring.GetModOptions() to read lobby-provided values at runtime instead of hardcoding them in the tweakdef.

Hardcoded modoptions values work in local testing. They break when another player joins the lobby with different parameters because the Spring engine synchronizes modoptions across all clients through the network layer.

Tweakdefs and network synchronization

Tweakdef crashes are rarely about the Spring or Recoil engine directly. They come from network desynchronization when one client loads a modified unit definition that another client does not have. Adding a custom explosion to the Corak commander looks harmless until the engine tries to serialize that weapondef to every player in the match.

Area of effect values around 700 and camera shake above 500 do not cause crashes on their own. The crash happens when the modified weapondef travels through the lobby network stack and a client without the tweakdef cannot parse the incoming unit definition.

Required subtables revisited

Every tweakdef that touches unit definitions needs buildoptions, customparams, weapondefs, and weapons populated. This is the same rule from any other modding guide, but it matters more with base64 tweakdefs because the encoding obscures which subtables exist after decoding. Validate the decoded output before loading it into the game.

Obj loaders and widget reuse

Cleaned up obj loaders are shared in the community for custom widget development. The RecoilOceanWaves project includes a usable loader that works as a starting point for reading 3D model data into Lua widgets. These utilities sit outside the tweakdef pipeline but help modders build visual effects without touching the core unit definition files.

Clean modding habits

Decode your base64 payloads before submitting them. Cross-reference every unit you add or remove against buildoptions and weapons lists. Test in a multiplayer lobby, not just single player, because network sync catches errors that local play misses.

Creed of Champions

"Creed of Champions rekindled my joy in Beyond All Reason. I had burned out on the game, and the friendly, no-toxicity environment caused me to start enjoying it again." — Crd-009