Vixen
caa30e12
csharp
public struct UtilityState

What one agent remembers about a set between decisions.

Read the guide page for this →

Remarks

⚠ Every field here is inertia, and none of it is optional. An agent re-scoring every frame with two actions at 0.51 and 0.49 oscillates, and oscillation is the single most visible failure mode of a utility agent — it is what makes the technique look broken to anybody watching.

A plain struct, so that it fits in a span as easily as in a field. A utility set has two hosts: AiSystem, where it is the agent's planner and the memory is a managed object beside the slot, and RunUtilitySetTask, where it is a leaf of a behaviour tree and everything has to live in the Span<byte> that task was given. One shape for both is what stops the two of them growing different inertia.

Fields and properties (5)

  • public int Current

    Which action is running, or -1 for none.

  • public float Elapsed

    Seconds since the last decision.

  • public float Clock

    The agent's own clock, which cooldowns are stamped against.

  • public int Decisions

    How many decisions it has made.

  • public static UtilityState Fresh

    Nothing chosen, no time passed. ⚠ Not default, which would mean action zero.

Methods (1)

  • public UtilityState(int Current, float Elapsed, float Clock, int Decisions)

    What one agent remembers about a set between decisions.

Used by (6)

  • AiSnapshotsVixen.Ai
  • RunUtilitySetTaskVixen.Ai
  • UtilityInertiaTestsVixen.Ai.Tests
  • UtilityMemoryVixen.Ai
  • UtilityOscillationTestsVixen.Ai.Tests
  • UtilitySetVixen.Ai