UMassCrowdSubsystem

Subsystem that tracks mass entities that are wandering on the zone graph.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MassCrowd

Header

/Engine/Plugins/AI/MassCrowd/Source/MassCrowd/Public/MassCrowdSubsystem.h

Include

#include "MassCrowdSubsystem.h"

Syntax

UCLASS()
class UMassCrowdSubsystem : public UWorldSubsystem

Remarks

Subsystem that tracks mass entities that are wandering on the zone graph. It will create custom runtime lane data to allow branching decisions.

Variables

Name Description

Public variable

FDebugOnMassCro...

 

DebugOnMassCrowdLaneStateChanged

Protected variable

FZoneGraphTagMa...

 

DensityMask

Tag mask that represents all possible lane density tags. Built from MassCrowdSettings.

Protected variable UProperty Transient

const UMassCrow...

 

MassCrowdSettings

Protected variable

FDelegateHandle

 

OnMassCrowdSettingsChangedHandle

Protected variable

FDelegateHandle

 

OnPostZoneGraphDataAddedHandle

Protected variable

FDelegateHandle

 

OnPreZoneGraphDataRemovedHandle

Protected variable

FDelegateHandle

 

OnZoneGraphDataBuildDoneHandle

Protected variable

TArray< FRegist...

 

RegisteredLaneData

Per lane data for all registered ZoneGraph data.

Protected variable UProperty Transient

UZoneGraphAnnot...

 

ZoneGraphAnnotationSubsystem

Protected variable UProperty Transient

UZoneGraphSubsy...

 

ZoneGraphSubsystem

Functions

Name Description

Public function

int32

 

AcquireWaitingSlot

(
    const FMassEntityHandle Entity,
    const FVector& EntityPosition,
    const FZoneGraphLaneHandle LaneHand...,
    FVector& OutSlotPosition,
    FVector& OutSlotDirection
)

Acquires a slot from a specified waiting lane. Nearest vacant slot to EntityPosition is returned.

Protected function

void

 

BuildLaneData

(
    FRegisteredCrowdLaneData& LaneData,
    const FZoneGraphStorage& Storage
)

Populates the crowd lane data array with all existing lane in the zone graph.

Protected function

FCrowdBranch...

 

CreateBranchingData

(
    const int32 LaneIndex,
    const FZoneGraphStorage& ZoneGraph...
)

Creates dedicated structure to hold data of a branching lane.

Protected function

FCrowdTracki...

 

CreateTrackingData

(
    const int32 LaneIndex,
    const FZoneGraphStorage& ZoneGraph...
)

Creates and initializes the occupancy data of a lane.

Protected function

void

 

CreateWaitSlots

(
    const int32 CrossingLaneIndex,
    FCrowdWaitAreaData& WaitArea,
    const FZoneGraphStorage& ZoneGraph...
)

Public function Const

const FCrowd...

 

GetCrowdBranchingLaneData

(
    const FZoneGraphLaneHandle LaneHand...
)

Returns the branching data associated to a given zone graph lane.

Public function Const

const FRegis...

 

GetCrowdData

(
    const FZoneGraphDataHandle DataHand...
)

Returns the readonly runtime data associated to a given zone graph.

Public function Const

TOptional< F...

 

GetCrowdLaneData

(
    const FZoneGraphLaneHandle LaneHand...
)

Returns the readonly runtime data associated to a given zone graph lane.

Public function Const

const FCrowd...

 

GetCrowdTrackingLaneData

(
    const FZoneGraphLaneHandle LaneHand...
)

Returns the entity tracking runtime data associated to a given zone graph lane.

Public function Const

const FCrowd...

 

GetCrowdWaitingAreaData

(
    const FZoneGraphLaneHandle LaneHand...
)

Returns the waiting area runtime data associated to a given zone graph lane.

Public function Const

FZoneGraphTa...

 

GetDensityMask()

Public function Const

float

 

GetDensityWeight

(
    const FZoneGraphLaneHandle LaneHand...,
    const FZoneGraphTagMask LaneTagMask
)

Returns the weight for lane selection that is associated to the given lane based on its density tag.

Public function Const

ECrowdLaneSt...

 

GetLaneState

(
    const FZoneGraphLaneHandle LaneHand...
)

Return the current state of a lane.

Protected function

FZoneGraphCr...

 

GetMutableCrowdLaneData

(
    const FZoneGraphLaneHandle LaneHand...
)

Returns the modifiable runtime data associated to a given zone graph lane.

Public function Const

bool

 

HasCrowdDataForZoneGraph

(
    const FZoneGraphDataHandle DataHand...
)

Protected function

void

 

OnEnterTrackedLane

(
    const FMassEntityHandle Entity,
    const int32 LaneIndex,
    FCrowdTrackingLaneData& TrackingDa...
)

Callback to keep count of entities currently on a given lane.

Public function

void

 

OnEntityLaneChanged

(
    const FMassEntityHandle Entity,
    const FZoneGraphLaneHandle Previous...,
    const FZoneGraphLaneHandle CurrentL...
)

Callback from the lane tracker processor to indicates a mass entity changing lane.

Protected function

void

 

OnExitTrackedLane

(
    const FMassEntityHandle Entity,
    const int32 LaneIndex,
    FCrowdTrackingLaneData& TrackingDa...
)

Callback to keep count of entities currently on a given lane.

Protected function

void

 

PostZoneGraphDataAdded

(
    const AZoneGraphData* ZoneGrap...
)

Protected function

void

 

PreZoneGraphDataRemoved

(
    const AZoneGraphData* ZoneGrap...
)

Public function

void

 

RebuildLaneData()

Clears and rebuilds all lane and intersection data for registered zone graphs using the current settings.

Public function

void

 

ReleaseWaitingSlot

(
    const FMassEntityHandle Entity,
    const FZoneGraphLaneHandle LaneHand...,
    const int32 SlotIndex
)

Releases previously acquired slot from a specified waiting lane.

Public function

bool

 

SetLaneState

(
    const FZoneGraphLaneHandle LaneHand...,
    ECrowdLaneState NewState
)

Changes the state of a lane.

Protected function

void

 

UpdateDensityMask()

Overridden from UWorldSubsystem

Name Description

Protected function Virtual

void

 

PostInitialize()

Called once all UWorldSubsystems have been initialized

Overridden from USubsystem

Name Description

Protected function Virtual

void

 

Deinitialize()

Implement this for deinitialization of instances of the system

Protected function Virtual

void

 

Initialize

(
    FSubsystemCollectionBase& Collecti...
)

Implement this for initialization of instances of the system