How to use Base64 tweakdefs in BAR lobbies without errors
Fix the tweakunits encoding errors that pop up in custom battles and shared lobby configs.
Tags: bar modding, tweakunits, base64 encoding, modoptions, lua, battle settings
Where modoptions logic lives
The game option definitions that actually control what settings the lobby accepts sit in gamedata/alldefs_post.lua. If you are trying to understand what tweakunits can be passed through a lobby and why certain values get rejected, that file is the source of truth. The UI layer reads from it, not the other way around.
URL-safe Base64 encoding for tweak strings
BAR mod configs that get shared through lobby settings use Base64 encoding. You need URL-safe mode, not standard Base64. The standard variant includes forward slashes and plus signs that break URL parsing. URL-safe Base64 swaps those for hyphens and underscores.
Once encoded, strip any trailing equals signs (the padding characters). The tweak system expects clean strings without the padding, and leaving them in causes the config to fail silently or throw errors depending on how the preset processes the input.
The tweakunits error and how to avoid it
When a lobby throws the error about battle setting tweakunits not being allowed with the current mod or preset, the fix usually comes down to one of three things:
- The preset type running in that lobby does not permit custom tweak values, which happens on default presets that lock out unit modifications.
- The Base64 input got corrupted by encoding with the wrong variant, producing characters that the preset parser rejects.
- The tweak string references unit keys that do not exist in the loaded modset, which causes a hard validation failure.
Check the preset first. If you need a flexible tweak environment, start with a custom preset that explicitly allows unit tweaks, then test the Base64 string separately in a decoder before pasting it into the lobby field.
Workflow for sharing tweak configs safely
Build your tweak definition in plain Lua first. Validate it runs clean against alldefs_post.lua references. Encode with URL-safe Base64. Strip trailing equals sign padding. Paste into the lobby tweakunits field. If the lobby rejects it, decode the string back to Lua and compare against the current mod's unit definitions. The mismatch is almost always obvious once you look at both sides.
Creed of Champions
Custom lobbies run smoother when everyone shares clean configs and communicates clearly about what mods and tweaks are active. That is the kind of organized, low-chaos environment Creed of Champions builds around. New players who want teammates willing to share settings and explain what each tweak does tend to find a better fit in groups that value teaching and patience over quick dismissals. Better teammates make every lobby better.
Being able to communicate with a team, share tips and constructive feedback, and keep things good-spirited is what makes a community worth playing in.