Sein Player Controller
Class · ASeinPlayerController : APlayerController
#include "Player/SeinPlayerController.h"
can be subclassed in Blueprint
The RTS player controller. It handles selection (click, marquee, control groups, focus cycling), turns right-clicks into orders using each unit’s Default Commands, and tracks the Shift, Ctrl and Alt modifiers. It never changes the simulation directly; orders reach it as commands.
Input is wired in Blueprint with the usual Enhanced Input pattern: a Blueprint subclass adds its Input Mapping Context on Begin Play and calls the Handle and Set Held functions from its input action events.
Functions
Section titled “Functions”Selection
Set Selection
Section titled “Set Selection”Set the current selection to a new list of actors. Handles deselecting old actors and selecting new ones. Logs a SelectionChanged observer command.
void SetSelection(const TArray<ASeinActor*>& NewSelection);Add To Selection
Section titled “Add To Selection”Add actors to the current selection (Shift+click).
void AddToSelection(const TArray<ASeinActor*>& ActorsToAdd);Toggle Selection
Section titled “Toggle Selection”Toggle an actor in/out of the selection (Ctrl+click).
void ToggleSelection(ASeinActor* Actor);Resolve Selection Targets
Section titled “Resolve Selection Targets”Resolves each actor to the actor that should actually be selected: a game can redirect a pick to another actor, such as a squad member to its squad. Returns the results without duplicates or nulls.
static TArray<ASeinActor*> ResolveSelectionTargets(const TArray<ASeinActor*>& Input);Clear Selection
Section titled “Clear Selection”Clear the entire selection.
void ClearSelection();Cycle Focus
Section titled “Cycle Focus”Cycle active focus: -1 → 0 → 1 → … → N-1 → -1
void CycleFocus();Get Focused Actor
Section titled “Get Focused Actor”Get the currently focused actor, or nullptr if focus is “All”.
ASeinActor* GetFocusedActor() const;Get Hovered Actor
Section titled “Get Hovered Actor”Get the actor currently under the mouse cursor.
ASeinActor* GetHoveredActor() const;Get Selection Count
Section titled “Get Selection Count”Get the number of currently selected actors.
int32 GetSelectionCount() const;Get Valid Selected Actors
Section titled “Get Valid Selected Actors”The selected actors that are still alive, owned by this player and selectable. Does not change the selection.
TArray<ASeinActor*> GetValidSelectedActors();Assign Control Group
Section titled “Assign Control Group”Assign current selection to a control group (Ctrl+number).
void AssignControlGroup(int32 GroupIndex);Recall Control Group
Section titled “Recall Control Group”Recall a control group (number key).
void RecallControlGroup(int32 GroupIndex);Get Control Group
Section titled “Get Control Group”Get the entity handles in a control group (0-9). Returns empty if out of range.
TArray<FSeinEntityHandle> GetControlGroup(int32 GroupIndex) const;Get Control Group Count
Section titled “Get Control Group Count”Get the number of entities in a control group.
int32 GetControlGroupCount(int32 GroupIndex) const;Command
Issue Smart Command
Section titled “Issue Smart Command”Issue a smart command to all selected entities (or focused entity). Resolves per-entity ability tags via the entity’s DefaultCommands list.
void IssueSmartCommand(const FVector& WorldLocation, ASeinActor* TargetActor);Issue Smart Command Ex
Section titled “Issue Smart Command Ex”Issue a smart command with an optional formation guide.
click). Converted to fixed-point + nav-projected sim-side.
void IssueSmartCommandEx(const FVector& WorldLocation, ASeinActor* TargetActor, bool bQueue, const TArray<FVector>& GuidePoints, FGameplayTag FormationTag);Issue Targeted Ability
Section titled “Issue Targeted Ability”Orders an ability whose targets were picked with the targeter. The targeter calls this once all points are captured. Owner Leader is the entity that acts on the ability, and Points are the captured targets. An empty Points list fires the ability without a target. Respects the Shift queue modifier.
void IssueTargetedAbility(FGameplayTag AbilityTag, FSeinEntityHandle OwnerLeader, const TArray<FSeinTargeterPoint>& Points);Get Ground Point Under Cursor
Section titled “Get Ground Point Under Cursor”Finds the ground point under the mouse cursor. Units and props under the cursor are ignored, so hovering a unit still returns the ground beneath it. Use this for move destinations. Falls back to a physics trace when the level has no baked ground data. Returns false only when the cursor is off the world.
bool GetGroundPointUnderCursor(FVector& OutWorld) const;Input
Reset Input State
Section titled “Reset Input State”Abort every in-progress input gesture and clear the modifier latches, committing nothing: no selection change, no order issued, and any active targeter session is cancelled. Call from project code whenever gameplay input is interrupted mid-gesture — opening a pause or UMG menu, losing window focus, switching input mode — so no click, drag, or modifier stays stuck held when input returns.
void ResetInputState();Handle Select Pressed
Section titled “Handle Select Pressed”Primary-select press (LMB down): targeter confirm, else arm click/marquee tracking.
void HandleSelectPressed();Handle Select Released
Section titled “Handle Select Released”Primary-select release (LMB up): finish marquee, else resolve the single-click selection.
void HandleSelectReleased();Handle Command Pressed
Section titled “Handle Command Pressed”Command press (RMB down): targeter cancel, else arm the command-drag tracking.
void HandleCommandPressed();Handle Command Released
Section titled “Handle Command Released”Command release (RMB up): interpret the click/drag gesture and issue the smart command.
void HandleCommandReleased();Handle Select Canceled
Section titled “Handle Select Canceled”Select cancel — wire the select action’s Canceled pin here. Unlatches the click and marquee state WITHOUT committing anything: no selection change, no marquee resolve. Canceled fires instead of Completed when a cancelable trigger (Tap, Hold, Chorded Action) ends without triggering; plain Down-trigger bindings never fire it, so this wiring is only needed once such a trigger is in play. If the press had been consumed as a targeter confirm, the targeter session is cancelled rather than confirmed.
void HandleSelectCanceled();Handle Command Canceled
Section titled “Handle Command Canceled”Command cancel — wire the command action’s Canceled pin here. Unlatches the command-drag state WITHOUT issuing an order; the sampled drag path is discarded. Canceled fires instead of Completed when a cancelable trigger (Tap, Hold, Chorded Action) ends without triggering; plain Down-trigger bindings never fire it.
void HandleCommandCanceled();Handle Key Pan
Section titled “Handle Key Pan”Keyboard camera pan (WASD / arrows). AxisValue scaled by Key Pan Modifier.
void HandleKeyPan(FVector2D AxisValue);Handle Key Rotate
Section titled “Handle Key Rotate”Keyboard camera rotate and tilt. X rotates around the pivot (Q/E) and Y tilts the camera pitch between top-down and flat; both are scaled by Key Rotate Modifier and applied at the camera pawn’s per-second rates (Rotation Speed / Tilt Speed). Bind an Axis2D action; a yaw-only control scheme simply maps no keys onto the Y axis.
void HandleKeyRotate(FVector2D RotateValue);Handle Mouse Zoom
Section titled “Handle Mouse Zoom”Mouse-wheel camera zoom. ZoomDelta scaled by Mouse Zoom Modifier; the camera pawn steps its Zoom Step per wheel tick.
void HandleMouseZoom(float ZoomDelta);Handle Key Zoom
Section titled “Handle Key Zoom”Keyboard camera zoom (Z/X). ZoomDelta scaled by Key Zoom Modifier; frame-rate independent — the camera pawn zooms at its Zoom Rate in units per second.
void HandleKeyZoom(float ZoomDelta);Handle Camera Follow
Section titled “Handle Camera Follow”Toggle follow-camera on the focused (or first selected) entity.
void HandleCameraFollow();Handle Camera Reset
Section titled “Handle Camera Reset”Reset camera rotation to north-facing.
void HandleCameraReset();Handle Mouse Pan
Section titled “Handle Mouse Pan”Middle-mouse camera pan. MouseDelta is calibrated and scaled by Mouse Pan Modifier; ignored while LMB/RMB are held (those own the mouse delta for marquee / formation drags).
void HandleMousePan(FVector2D MouseDelta);Handle Mouse Rotate
Section titled “Handle Mouse Rotate”Mouse camera rotate (X = yaw orbit, Y = pitch tilt), per pixel of mouse movement: MouseDelta is calibrated and scaled by Mouse Rotate Modifier and the camera pawn’s Orbit Sensitivity. Ignored while LMB/RMB are held.
void HandleMouseRotate(FVector2D MouseDelta);Handle Cycle Focus
Section titled “Handle Cycle Focus”Cycle active focus through the selection.
void HandleCycleFocus();Handle Ping
Section titled “Handle Ping”Ping the location under the cursor (crosses the lockstep wire to all clients).
void HandlePing();Handle Menu
Section titled “Handle Menu”Menu / cancel key: broadcasts On Menu Pressed for the UI layer.
void HandleMenu();Set Shift Held
Section titled “Set Shift Held”Track the Shift modifier (wire Started → true, Completed → false).
void SetShiftHeld(bool bHeld);Set Ctrl Held
Section titled “Set Ctrl Held”Track the Ctrl modifier (wire Started → true, Completed → false).
void SetCtrlHeld(bool bHeld);Set Alt Held
Section titled “Set Alt Held”Track the Alt modifier (wire Started → true, Completed → false).
void SetAltHeld(bool bHeld);Handle Action Slot
Section titled “Handle Action Slot”Action-slot hotkey (0-11): broadcasts On Action Slot Pressed for the UI action panel.
void HandleActionSlot(int32 SlotIndex);Handle Control Group
Section titled “Handle Control Group”Control-group hotkey (0-9): assigns with Ctrl held, otherwise recalls.
void HandleControlGroup(int32 GroupIndex);Handle Select All
Section titled “Handle Select All”Select all of your units at once — the classic select-army hotkey. Replaces the current selection (adds to it while Shift is held), and does nothing when you own nothing selectable, so the hotkey never empties an existing selection.
Viewport Only limits the sweep to units currently on screen; the default (false) selects your whole army map-wide. Gathers with the same rules as marquee/click selection (your own, selectable, live entities; group members resolve to their group), so wire it straight to an Input Action’s Started pin.
Defaults: bViewportOnly = false.
void HandleSelectAll(bool bViewportOnly = false);Handle Select All Of Type
Section titled “Handle Select All Of Type”Select every one of your units of the same type as a reference unit — the classic double-click / select-all-of-type gesture. The reference is the unit under the cursor when it is yours (double-click wiring), else the focused unit, else the first selected; with no reference it does nothing. “Type” is the unit’s exact Blueprint class, and group members resolve to their groups, so hovering one rifle soldier grabs every group fielding that soldier type. Replaces the current selection (adds while Shift is held).
Viewport Only (default true) limits the sweep to units currently on screen, the usual double-click convention; pass false for a map-wide type sweep.
Defaults: bViewportOnly = true.
void HandleSelectAllOfType(bool bViewportOnly = true);Get World Subsystem
Section titled “Get World Subsystem”Get the world subsystem (cached).
USeinWorldSubsystem* GetWorldSubsystem() const;Targeter
Get Targeter Subsystem
Section titled “Get Targeter Subsystem”Get the local-player targeter subsystem (per-PC, survives travel). Returns null on dedicated server / no local player path.
USeinTargeterSubsystem* GetTargeterSubsystem() const;UI
Get Resource
Section titled “Get Resource”This player’s current amount of a resource, for UMG bindings. Returns 0 when the resource is not in the player’s catalog or the simulation is not ready. The value updates live as the player earns and spends.
float GetResource(FGameplayTag ResourceTag) const;Get Resource Cap
Section titled “Get Resource Cap”This player’s cap for a resource, for current-over-maximum displays. Returns 0 when the resource has no cap or is unavailable.
float GetResourceCap(FGameplayTag ResourceTag) const;Events and overrides
Section titled “Events and overrides”Match
On Match Ended
Section titled “On Match Ended”Implement in Blueprint
The match ended and this machine’s world stopped. Result is this player’s (None when the match was aborted); Reason is why it was decided, or why the match ended. Local controllers only.
void OnMatchEnded(ESeinPlayerResult Result, FGameplayTag Reason);On Defeated
Section titled “On Defeated”Implement in Blueprint
This player was defeated and the match goes on. They now watch: the view follows a teammate still playing, or the whole map once none is left, and they can give no orders. Show a defeat screen here. Fires once, also when a loaded match finds them defeated. Local controllers only.
void OnDefeated(FGameplayTag Reason);Command
Build Command Context
Section titled “Build Command Context”Overridable in Blueprint, with a native default
Builds the context tags for a right-click from what is under the cursor: Right Click, then Ground for empty ground, or Friendly (your own), Neutral or Enemy for an entity, plus that entity’s own tags. A unit’s Default Commands match on these tags. Override it to add your own context tags.
FGameplayTagContainer BuildCommandContext(ASeinActor* HitActor, const FVector& HitLocation) const;Event dispatchers
Section titled “Event dispatchers”On Selection Changed
Section titled “On Selection Changed”FSeinOnSelectionChanged OnSelectionChanged
Fired when the selection or active focus changes.
On Command Issued
Section titled “On Command Issued”FSeinOnCommandIssued OnCommandIssued · passes FGameplayTag AbilityTag, FVector WorldLocation
Fired when a command is issued (for move markers, attack lines, sound).
On Action Slot Pressed
Section titled “On Action Slot Pressed”FSeinOnActionSlotPressed OnActionSlotPressed · passes int32 SlotIndex
Fired when an action slot hotkey is pressed (0-11). UI action panel listens to this.
On Menu Pressed
Section titled “On Menu Pressed”FSeinOnMenuPressed OnMenuPressed
Fired when menu/escape is pressed. UI listens for menu toggle or cancel.
On Cursor Updated
Section titled “On Cursor Updated”FSeinOnCursorUpdated OnCursorUpdated · passes FVector CursorWorld, bool bValidTrace
Fires every frame with the world position under the cursor. Valid Trace is false when the cursor is off the world; ignore those updates.
Properties
Section titled “Properties”Camera
Section titled “Camera”Key Pan Modifier
Section titled “Key Pan Modifier”float KeyPanSpeed · default 1.0f · min 0.0
Editable in class defaults · Blueprint read and write
Scales keyboard camera panning. 1.0 uses the camera pawn’s configured pan speed unchanged.
Key Rotate Modifier
Section titled “Key Rotate Modifier”float KeyRotateSpeed · default 1.0f · min 0.0
Editable in class defaults · Blueprint read and write
Scales keyboard camera rotation and tilt. 1.0 uses the camera pawn’s configured rates unchanged.
Key Zoom Modifier
Section titled “Key Zoom Modifier”float KeyZoomSpeed · default 1.0f · min 0.0
Editable in class defaults · Blueprint read and write
Scales keyboard camera zooming. 1.0 uses the camera pawn’s configured zoom rate unchanged.
Mouse Pan Modifier
Section titled “Mouse Pan Modifier”float MousePanSpeed · default 1.0f · min 0.0
Editable in class defaults · Blueprint read and write
Scales middle-mouse camera panning. 1.0 is the intended baseline and includes the internal mouse-delta calibration.
Mouse Rotate Modifier
Section titled “Mouse Rotate Modifier”float MouseRotateSpeed · default 1.0f · min 0.0
Editable in class defaults · Blueprint read and write
Scales mouse camera rotation and tilt. 1.0 is the intended baseline and includes the internal mouse-delta calibration.
Mouse Zoom Modifier
Section titled “Mouse Zoom Modifier”float MouseZoomSpeed · default 1.0f · min 0.0
Editable in class defaults · Blueprint read and write
Scales mouse-wheel camera zooming. 1.0 uses the camera pawn’s configured zoom step unchanged.
Selection
Section titled “Selection”Selection Trace Channel
Section titled “Selection Trace Channel”TEnumAsByte<ECollisionChannel> SelectionTraceChannel · default ECC_Visibility
Editable in class defaults · Blueprint read and write
World-geometry channel for ground-position fallback. Entity selection, hover, and targeting use Sein Extents independently of collision channels.
Trace Distance
Section titled “Trace Distance”float TraceDistance · default 100000.0f
Editable in class defaults · Blueprint read and write
Maximum trace distance for mouse-to-world projection.
Active Focus Index
Section titled “Active Focus Index”int32 ActiveFocusIndex · default -1
Blueprint read-only
Active focus index within the selection. -1 = “All” (commands dispatch to entire selection). 0+ = index into SelectedActors (commands dispatch to only that unit).
Is Marquee Dragging
Section titled “Is Marquee Dragging”bool bIsMarqueeDragging · default false
Blueprint read-only
Whether a marquee drag is currently active (for HUD rendering).
Marquee Start
Section titled “Marquee Start”FVector2D MarqueeStart · default FVector2D::ZeroVector
Blueprint read-only
Screen-space start position of the marquee drag.
Marquee Current
Section titled “Marquee Current”FVector2D MarqueeCurrent · default FVector2D::ZeroVector
Blueprint read-only
Screen-space current position of the marquee drag.
Replay
Section titled “Replay”Camera Log Interval
Section titled “Camera Log Interval”int32 CameraLogInterval · default 5 · min 0
Editable in class defaults · Blueprint read and write
How often, in simulation ticks, the controller records its camera position for replays. 0 records every tick.
General
Section titled “General”Sein Player ID
Section titled “Sein Player ID”FSeinPlayerID SeinPlayerID
Blueprint read-only
The match slot this controller plays. The Game Mode assigns it and it replicates to the owning client, so selection and ownership checks work there.
Command
Section titled “Command”Is Command Dragging
Section titled “Is Command Dragging”bool bIsCommandDragging · default false
Blueprint read-only
Whether a command drag (RMB hold) is currently active.
Command Drag Start
Section titled “Command Drag Start”FVector CommandDragStart · default FVector::ZeroVector
Blueprint read-only
World-space start point of the command drag.
Command Drag Current
Section titled “Command Drag Current”FVector CommandDragCurrent · default FVector::ZeroVector
Blueprint read-only
World-space current endpoint of the command drag.
Command Drag Path
Section titled “Command Drag Path”TArray<FVector> CommandDragPath
Blueprint read-only
Distance-sampled world-space path captured during a command drag (start … current). Fed to the order gesture to build the guide.
Command Drag Sample Distance
Section titled “Command Drag Sample Distance”float CommandDragSampleDistance · default 100.f
Editable in class defaults · Blueprint read and write
Minimum cursor travel (world cm) between captured drag-path points — even spacing regardless of drag speed, no point spam on a slow drag.
Order Gesture Class
Section titled “Order Gesture Class”TSoftClassPtr<USeinOrderGesture> OrderGestureClass
Editable in class defaults · Blueprint read and write
Pluggable interpreter for right-click / drag orders → guide + formation. Null → the base USeinOrderGesture (click → blob, drag → line). Point at a subclass to author custom drag semantics (spline, box, path-march, …).
C++ members (3)
void BuildPreviewOrder(FVector CursorWorld, FVector& OutAnchor, TArray<FVector>& OutGuidePoints, FGameplayTag& OutFormationTag) const;Compute the order the CURRENT drag/cursor state would produce — the SAME gesture computation OnCommandReleased commits — exposed for the destination preview so preview === commit. OutAnchor = drag start while dragging, else CursorWorld; OutGuidePoints / OutFormationTag come from the active gesture.bool IsQueueModifierHeld() const;Current right-click queue modifier, shared with destination preview.void ReceiveMarqueeSelection(const TArray<ASeinActor*>& ActorsInBox);Called by HUD when marquee box selection completes.