BAR tweakdefs guide: changing unit stats locally

A practical walkthrough for tweaking unit definitions, weapon stats, and energy generation in Beyond All Reason without breaking your game.

Tags: beyond all reason, tweakdefs, modding, local changes, unit stats, customization

What are tweakdefs in BAR

Tweakdefs are small Lua scripts that let players modify unit definitions, weapon behavior, and economy parameters for local testing. Every unit in BAR lives inside a large merged table called UnitDefs, where corak gets its health value and armhwk gets its damage numbers. Tweakdefs reach into that table and change specific fields without touching the base game code.

This works for testing balance ideas, trying out custom scenarios, or just experimenting with weapon ranges and unit health. Changes only affect local games.

Setting up the development environment

The BAR repository on GitHub has a development quick-start guide in the README. Clone the master branch, create a new branch for your experiments, and point your local game to read from that branch. The setup takes a few minutes the first time.

A common stumbling block is not knowing where to make changes. All unit def files merge into one giant UnitDefs table at load. You cannot just drop a new file with a unit name into a folder. Tweakdefs must reference the existing table structure.

Writing your first tweak

A minimal tweak returning modified stats looks like this:

return { corak = { health = 4500, }, }

That overwrites the corak health to 4500. The key detail is that tweak units only specify the values you want to change. The loader merges those fields into the existing UnitDefs entry. You are not rewriting the entire unit definition.

For weapon tweaks the syntax follows the same pattern. Weapondef keys with special characters like hyphens need bracket notation: ["missiletrailmedium-starburst"] instead of bare keys. The weapon names come from the actual game weapondef table, not from CEG tags or particle names. Something like armtruck_rocket is a valid weapondef name.

Common mistakes with tweakdefs

  • Trying to loop over UnitDefs directly in a tweak file instead of returning override values
  • Using raw weapon or particle names instead of the actual weapondef identifier
  • Forgetting bracket syntax for keys containing hyphens or special characters
  • Expecting tweakdefs to work in multiplayer, where they are ignored
  • Modifying windGenerator on the wrong property name, since some unit entries use different casing

A practical example: fixed energy generators

One player wanted wind turbines to produce a flat energy rate instead of wind-dependent output. The approach requires changing energymake and zeroing out windGenerator. The tricky part is that some unit entries store wind properties under different keys. Testing in a local scenario before sharing tweaks saves headaches.

Cred of Champions

Players who experiment with tweakdefs learn BAR's inner systems faster. That hands-on curiosity is the same mindset that makes strong team players. Communities that encourage learning without judgment help people improve. As one Creed member put it:

[Crd] The removal of toxicity, the goal of fun and learning, makes for a refreshing spot to play and spend time. It has also made a game with plenty of complexity a bit less daunting to dive into.

Whether you are tweaking weapon damage or learning eco management, having a supportive group around accelerates progress.

Advertisement