Skip to content

Auto-Calculated Fields

Some fields are best computed rather than typed. The character’s age can be worked out from their birth date and the current world date — making the user type it manually means it’ll go stale. Auto-calculated fields take a small definition (a formula, a template, a count) and produce the value for you whenever the entity is shown.

Once you’ve set one up, the field appears on the form like any other, but greyed out — the user can’t type into it directly. They just see the result update as they fill in other fields.

Auto-calculate has five flavours. Four of them — Formula, Template, Aggregation, Lookup — cover almost every real-world use case. The fifth, Function, is an advanced escape hatch you’ll rarely need; it’s covered briefly at the end of this page.

Pick the one whose shape fits what you want to do.

If you’re not sure which to pick, here’s a quick decision tree:

  • Are you doing maths or string formatting on this entity’s own fields? → Formula.
  • Are you stitching field values into a sentence? → Template.
  • Do you want to count, sum, or average across related entities? → Aggregation.
  • Do you want to copy one specific value from a related entity? → Lookup.

The general flow is the same regardless of which kind you pick:

  1. Add the field the calculation will produce. Treat it as a normal field — pick a kind (number, text, decimal — whatever the result will be).
  2. Open Behaviours and click Add Behaviour.
  3. Choose Auto-calculate, then pick the field you just made as the target.
  4. Pick the calculation kind (Formula, Template, Aggregation, or Lookup).
  5. Fill in the kind-specific configuration (covered on each kind’s own page).
  6. (Optional) set Recalculate when to a list of fields. The system already triggers on entity save; this lets you mark specific dependencies for clarity.
  7. Save.

Once saved, the field shows on the form greyed out. As the user fills in other fields, you’ll see the calculated value update.

Some auto-calculated fields are best when the user can override them. A character’s full name is normally {first_name} {last_name} — but a character with a single name like “Cher” should let the user type it directly.

The toggle is on by default. Turn it off only when overriding would be a bug rather than a useful escape hatch.

When override is on:

  • The field shows the calculated value by default.
  • The user can click in and type a different value, which is then stored as-is.
  • An override is saved with the entity. Future recalculations won’t replace it until the user clears the field.

When override is off:

  • The field is fully read-only.
  • The displayed value always reflects the calculation.
  • No way to disagree with the formula.

Auto-calculated fields refresh whenever the entity is saved. The Recalculate when setting is mostly informational — it lets you say “this field depends on these other fields”, which:

  • Helps the editor warn you about circular dependencies (if A depends on B and B depends on A, both end up empty).
  • Documents intent — anyone editing the type later can see what feeds into the calculation.

You don’t need to set Recalculate when for the calculation to work. The system can usually figure it out from the formula or template itself. Set it explicitly if you want the documentation, or if you’re using a Function calculation that doesn’t expose its inputs.

There’s a fifth kind of calculation, Function, that lets you call a named built-in function with arguments. It’s there for unusual cases the other four can’t handle. Most users never need it. If you find yourself reaching for Function, double-check whether a Formula would work — Formula already exposes 32 built-in functions and is a much smoother experience.

Calculate the things that are derivable, not all the things. If a value can be computed from other fields or could plausibly be different in some edge case, it’s a candidate for auto-calculation with manual override on. If a value is simply what it is (e.g. the character’s hair colour), don’t auto-calculate it.

Start with a Formula. They’re the most flexible kind — maths, text manipulation, conditionals — and the FE has the best support for them (live syntax checking, function picker).

Don’t chain calculations across many entities. A field that aggregates across 50 related entities, each of which lookups across 50 of their own, can get slow. Keep the chain to one or two hops.

Read-only by default for derived facts. The character’s age is derived from their birthdate; let the user fix the birthdate, not the age.