← Back to Babylon.js · project planning pack

Skill · Version 1.0.0

Unity utility decisions

Makes Unity NPC choices explainable through valid options and comparable scores. Adds commitment and emergency interruption rules so small score changes do not cause constant switching.

unity-utility-ai-decisions

Agents using this skill

See how it helps

When is it useful?

Use it when many actions compete and small score changes cause erratic switching or impossible choices.

What does it help you do?

  • Excludes impossible actions before normalizing score inputs.
  • Defines combination rules, tie handling and reproducible selection.
  • Adds commitment against oscillation while keeping scoring side-effect-free.

Try asking this

Build a Unity enemy that chooses between attacking, taking cover and retreating. Exclude unreachable cover and unavailable attacks before scoring health, distance and danger. Record the selection reason, test near-equal and all-zero scores and verify that commitment prevents jitter while an immediate threat can still interrupt the chosen action.

Detailed documentation

Read the skill’s original instructions, examples and checks in their authored language.

Details…Show less

Utility AI Decisions

Identify the current decision model and the player-facing choice: target, attack, need, cover or tactical role. Utility scoring is useful for graded trade-offs; preserve a simpler existing rule when it already expresses the task.

  • Filter impossible actions before scoring. Represent missing/stale facts explicitly; zero distance, missing target and an unavailable weapon must not accidentally produce an excellent score.
  • Map raw measurements through documented response curves with declared units/ranges. Normalize considerations consistently and clamp/validate invalid values before combining them.
  • Choose a combination rule deliberately. A weighted sum allows compensation; a product can veto an action with one zero and penalizes actions with more factors. Document any compensation formula and compare actions with different consideration counts.
  • Select max, weighted random or softmax according to the intended behavior. Define zero-total-score and tie handling; use a controlled random source for reproducible scenarios and stable ordering when required.
  • Add commitment/hysteresis where near-equal scores would cause action thrashing. Specify emergency interrupts separately so commitment does not block an essential reaction.
  • Keep scoring free of action side effects. Starting/cancelling actions, spending resources and reserving positions belong to an explicit execution boundary and must occur once per accepted transition.
  • Expose raw facts, normalized considerations, combined score and selection reason. Sample decisions on a measured cadence and avoid per-candidate allocation in the hot path.

Verify boundary values, unavailable actions, all-zero scores, unequal factor counts, near-ties, interrupts and repeatability with a recorded seed. Tune against a scenario and trace; do not present example curve constants as universal balance values.

The adapted source documents both BT and Utility patterns; this skill is self-contained and does not require that source's helper files.

Included files 2

  • LICENSE.txt
  • SKILL.md