Vixen
c7401864
csharp
public sealed class NavigationCostModel

What a GOAP action costs to reach, asked of the navmesh.

Read the guide page for this →

Remarks

doc 37 § D12's second implementation of IActionCostModel, and the guide is supposed to say plainly what it costs, so: this is a navigation query per action per resolve. A domain of forty actions asks the mesh forty times every time an agent thinks. That is affordable at doc 28's stated scale — "the few dozen agents where emergent behaviour is the point" — and is not affordable for a crowd.

⚠ Budgeted rather than exact, for P4's reason. Vixen bakes no coarse graph, so there is no hierarchical query to ask; a search stopped at a node budget answers the same question with the same shape of cost. A destination the budget could not reach is costed as its straight line times UnreachablePenalty rather than refused, because a cost model that vetoed would turn "I could not afford to check" into "there is no way there".

⚠ NavMeshQuery holds one node pool and runs one search at a time. A cost model is shared by every agent of its domain, so a queue configured with a JobScheduler needs a model per parallel search or none at all.

Fields and properties (1)

  • public float UnreachablePenalty

    What an unreachable target's straight-line distance is multiplied by.

Methods (2)

  • public NavigationCostModel(NavMeshQuery query, float perMetre = 0.1, int budget = 128)

    What a GOAP action costs to reach, asked of the navmesh.

  • public float Cost(in AgentContext context, GoapAction action, Vector3 from, in GoapTarget target)

    What one action costs.