Skip to content

Default Broker Resolver

Class · USeinDefaultCommandBrokerResolver : USeinCommandBrokerResolver

Parent: Broker Resolver

#include "Brokers/SeinDefaultCommandBrokerResolver.h"

Decides, for each unit in a selection, what a single order makes that unit do and where each one stands when it gets there. This is the resolver used out of the box, and the base a game’s own resolvers build on.

Dispatch is capability-driven, per member. If a member can service the order’s context (its own commands table maps the click context to an ability), that ability is dispatched against the order target. Otherwise the member falls back to a tag-along move toward its own slot in the formation, so non-combatants swept up in an attack order still travel with the group. The tag-along ability is configurable and can be turned off, which leaves those members idle for the order.

Positions come from a formation. The order gesture (a right-click-drag, for example) can stamp a formation tag that this resolver looks up in Formations By Tag. If nothing matches it uses its Default Formation Class, then the Default Formation in the Orders settings, and if that is also None it falls back to a blob where every member shares the destination.

Two slot re-match passes keep a moving formation from making units cross paths: the lateral pass re-ranks members left to right, and with the depth pass added the grid gets a full 2D nearest-slot assignment. Both default on; clearing them falls back to raw index order. The re-match is deterministic, so it is safe for lockstep.

TSoftClassPtr<USeinFormation> DefaultFormationClass

Editable in class defaults · Blueprint read and write

Formation used when the order names no formation, or names one that is not in Formations By Tag. When empty, the Default Formation in the Orders settings is used, and if that is None too, every member shares the single destination as a blob.

TMap<FGameplayTag, TSoftClassPtr<USeinFormation>> FormationsByTag

Editable in class defaults · Blueprint read and write

Optional map of gesture-nominated formation tag → formation class. The order gesture (e.g. a right-click-drag) stamps an FSeinOrderTarget::FormationTag; the resolver looks it up here, falling back to DefaultFormationClass. Lets a project bind “drag = line”, “alt-drag = column”, etc. without code.

bool bReassignSlotsLateral · default true

Editable in class defaults · Blueprint read and write

Formation-level slot RE-MATCH on the LATERAL (left/right) axis. OPT-OUT, default true. When a loose selection moves, members are re-matched to the grid slots by left/right rank so a rotating formation doesn’t make everyone cross to their old index slot. Clear to fall back to raw index order. (A group’s resolver supplies its own flags through GetInnerLayout.)

bool bReassignSlotsDepth · default true

Editable in class defaults · Blueprint read and write

Formation-level slot RE-MATCH on the DEPTH (front/back) axis. OPT-OUT, default true. With Lateral (the default), the grid gets a full 2-D nearest-slot assignment so a deep block converges without crossing front-to-back as well as left-to-right. Clear to drop back to a 1-D (lateral-only) match, or clear both for raw index order.

FGameplayTag TagAlongAbility

Editable in class defaults · Blueprint read and write

Ability tag dispatched for members whose own DefaultCommands table doesn’t resolve the click context (ResolveMemberAbility returned invalid). Targets the formation slot, not the order target — “tag along with the group” for non-combatants on an attack order, unmapped click types, etc. Set to an invalid tag to disable the tag-along behavior entirely (those members stay idle for the order).

C++ members (1)
  • static void ReassignSlots(USeinWorldSubsystem* World, const TArray<FSeinEntityHandle>& Members, TArray<FFixedVector>& Positions, FFixedQuaternion FormationFacing, bool bLateral, bool bDepth); Re-match members to formation slots so a rotating/translating formation doesn’t make units cross paths. Per-axis, driven by the two designer flags: - bLateral only → 1-D rank match on the formation RIGHT axis (preserve left/right order; front/back untouched — the wedge/arrow behavior). - bDepth only → 1-D rank match on the formation FORWARD axis (preserve front/back order). - both → 2-D nearest-slot assignment (greedy min-distance in centroid-aligned local space; non-crossing for deep grids — the line/block behavior). - neither → no-op (keep ResolvePositions’ index order / authored slots as-is). Reads each member’s CURRENT position and permutes Positions in place so Positions[i] becomes member i’s slot — path-independent, so consecutive moves don’t oscillate. DETERMINISTIC: every sort carries a handle/slot-index tie-break (TOTAL order → bit-identical across clients). A magnitude-only sort is unstable on ties → order-dependent → lockstep desync. The 2-D path aligns the member/slot clouds by their own centroids before squaring distances, so the bulk move translation cancels (a unit half a map from its slot can’t overflow 32.32).