Skip to content

DISGameManager

huggins edited this page May 10, 2023 · 7 revisions

DIS Game Manager

The DIS Game Manager contains the main portion of logic for the GRILL DIS plugin. It handles the tracking of DIS Entities in the game, spawning of new ones, and delegation of DIS packets to the appropriate DIS Entity. It also provides the main interface in the Details panel in Unreal Engine for users to modify DIS settings in.

class ADISGameManager
  : public AInfo

Includes

Back to Top


Members

Access Type Name Description
Public int32 ApplicationID The Application ID of this application instance
Protected bool AutoConnectReceiveAddresses Whether to automatically connect to all receive IP addresses
Protected bool AutoConnectSendAddresses Whether to automatically connect to all send IP addresses
Protected TMap<FEntityID, AActor*> DISActorMappings The mapping between DIS Entity IDs and corresponding entity actors
Public UDISClassEnumMappings* DISClassEnum The DIS Enumeration Mapping to use for this manager
Protected TMap<FEntityType, TSoftClassPtr<AActor>> DISClassMappings The mapping between DIS Enumerations and corresponding entity classes
Public int32 ExerciseID The Exercise ID of the DIS sim
Private AGeoReferencingSystem* GeoReferencingSystem The Unreal GeoReferencing sytem to use for the DIS sim
Public TMap<AActor*, FInitialDISConditions> InitialEntityConditions Mapping for actor components to look up info on themselves during initialization.
Protected std::map<FEntityID, AActor*> RawDISActorMappings The mapping between DIS Entity IDs and corresponding entity actors
Protected std::map<FEntityType, TSoftClassPtr<AActor>> RawDISClassMappings The mapping between DIS Enumerations and corresponding entity classes
Protected TArray<FReceiveSocketInfo> ReceiveSocketsToSetup Receive sockets to auto setup
Protected TArray<FSendSocketInfo> SendSocketsToSetup Send sockets to auto setup
Public int32 SiteID The Site ID of this application instance

Back to Top


Constructors

Name Description
ADISGameManager Default constructor

Functions

Access Return Name Description
Public bool AddDISEntityToMap(FEntityID EntityIDToAdd, AActor EntityToAdd) Adds a new entry to the DIS Entity map
Protected Virtual void BeginPlay() Overridable native event for when play begins for this actor
Private UDISReceiveComponent* GetAssociatedDISComponent(FEntityID EntityIDIn) Retrieves the DISReceiveComponent attached to the actor of the given ID
Public Static ADISGameManager GetDISGameManager(UObject* WorldContextObject) Gets a reference to the DIS Game Manager actor in the current open level
Public void HandleDetonationPDU(FDetonationPDU DetonationPDUIn) Delegates the given Detonation PDU to the appropriate DIS Entity actor
Public void HandleEntityStatePDU(FEntityStatePDU EntityStatePDUIn) Delegates the given Entity State PDU to the appropriate DIS Entity actor
Public void HandleEntityStateUpdatePDU(FEntityStateUpdatePDU EntityStateUpdatePDUIn) Delegates the given Entity State Update PDU to the appropriate DIS Entity actor
Public void HandleFirePDU(FFirePDU FirePDUIn) Delegates the given Fire PDU to the appropriate DIS Entity actor
Protected void HandleOnDISEntityDestroyed(AActor* DestroyedActor) Handles removal of the given actor from the DIS scenario mappings
Public void HandleRemoveEntityPDU(FRemoveEntityPDU RemoveEntityPDUIn) Delegates the given Remove Entity PDU to the appropriate DIS Entity actor
Public void HandleStartResumePDU(FStartResumePDU StartResumePDUIn) Delegates the given Start/Resume PDU to the appropriate DIS Entity actor
Public void HandleStopFreezePDU(FStopFreezePDU StopFreezePDUIn) Delegates the given Stop/Freeze PDU to the appropriate DIS Entity actor
Public bool RemoveDISEntityFromMap(FEntityID EntityIDToRemove) Removes the entry correlating to the given Entity ID from the DIS Entity map
Private void SpawnNewEntityFromEntityState(FEntityStatePDU EntityStatePDUIn) Spawns a new Unreal actor for given Entity State PDU if mapping exists
Protected virtual void Tick(float DeltaTime) Function called every frame on this Actor

Back to Top


Stucts

Name Description
FInitialDISConditions Contains initial conditions for new DIS Entities. These are looked up on the DIS Receive Component during initialization.
FReceiveSocketInfo Contains all needed information for UDP receive sockets.
FSendSocketInfo Contains all needed information for UDP send sockets.

Back to Top


Details

ApplicationID

int32 ApplicationID = 0

The Application ID of this application instance. Valid Application IDs range from 0 to 65535.

Back to Top


AutoConnectReceiveAddresses

protected bool AutoconnectReceiveAddresses

Whether to automatically connect to all receive IP addresses.

Category: GRILL DIS|Game Manager|Networking

Back to Top


AutoConnectSendAddresses

protected bool AutoconnectSendAddresses

Whether to automatically connect to all send IP addresses

Category: GRILL DIS|Game Manager|Networking

Back to Top


DISActorMappings

protected TMap<FEntityID, AActor*> DISActorMappings

The mapping between DIS Entity IDs and corresponding entity actors.

Category: GRILL DIS|Game Manager

Back to Top


DISClassEnum

public UDISCLassEnumMappings* DISClassEnum

The DIS Enumeration Mapping to use for this manager. This dictates the entity enumerations that will be recognized and managed by this DIS Game Manager.

Category: GRILL DIS|Game Manager

Back to Top


DISClassMappings

protected TMap<FEntityType, TSoftClassPtr<AActor>> DISClassMappings

The mapping between DIS Enumerations and corresponding entity classes.

Category: GRILL DIS|Game Manager

Back to Top


ExerciseID

public int32 ExerciseID

The Exercise ID of the DIS sim. Valid Exercise IDs range from 0 to 255.

Category: GRILL DIS|Game Manager

Back to Top


GeoReferencingSystem

private AGeoReferencingSystem* GeoReferencingSystem

The Unreal GeoReferencing sytem to use for the DIS sim.

Back to Top


Initial Entity Conditions

public TMap<AActor*, FInitialDISConditions> InitialEntityConditions

Mapping for actor components to look up info on themselves during initialization.

Back to Top


RawDISActorMappings

protected std::map<FEntityID, AActor*> RawDISActorMappings

The mapping between DIS Entity IDs and corresponding entity actors.

Category: GRILL DIS|Game Manager

Back to Top


RawDISClassMappings

protected std::map<FEntityType, TSoftClassPtr<AActor>> RawDISClassMappings

The mapping between DIS Enumerations and corresponding entity classes.

Category: GRILL DIS|Game Manager

Back to Top


ReceiveSocketsToSetup

protected TArray<FReceiveSocketInfo> ReceiveSocketsToSetup

Receive sockets to auto setup. Only available if AutoConnectReceiveAddresses is set to true.

Category: GRILL DIS|Game Manager|Networking

Back to Top


SendSocketsToSetup

protected TArray<FSendSocketInfo> SendSocketsToSetup

Send sockets to auto setup. Only available if AutoConnectSendAddresses is set to true.

Category: GRILL DIS|Game Manager|Networking

Back to Top


SiteID

public int32 SiteID = 0

The Site ID of this application instance. Valid Site IDs range from 0 to 65535.

Category: GRILL DIS|Game Manager

Back to Top


ADISGameManager

public ADISGameManager()

Default constructor.

Back to Top


AddDISEntityToMap

public bool AddDISEntityToMap
(
    FEntityID EntityIDToAdd,
    AActor* EntityToAdd
)

Adds a new entry to the DIS Entity map.

Category: GRILL DIS|Game Manager

Parameter Description
EntityIDToAdd The Entity ID to key the given entity under in the map
EntityToAdd The entity to add to the entity map
Returns
True if the addition to the map was successful

Back to Top


BeginPlay

virtual void BeginPlay() override

Overridable native event for when play begins for this actor.

https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/AActor/BeginPlay/

Back to Top


GetAssociatedDISComponent

private UDISReceiveComponent* GetAssociatedDISComponent
(
    FEntityID EntityIDIn
)

Retrieves the DISReceiveComponent attached to the actor of the given ID.

Parameter Description
EntityIDIn The entity ID of the target actor
Returns
The DISReceiveComponent attached to the actor of the given ID

Back to Top


GetDISGameManager

public static ADISGameManager* GetDISGameManager
(
    UObject* WorldContextObject
)

Gets a reference to the DIS Game Manager actor in the current open level.

Category: GRILL DIS|Game Manager

Parameter Description
WorldContextObject Object to get a world object pointer from
Returns
The reference to the Game Manager if one is found. Returns null if nothing is found or if multiple exist in the level

Back to Top


HandleDetonationPDU

public void HandleDetonationPDU
(
    FDetonationPDU DetonationPDUIn
)

Delegates the given Detonation PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
DetonationPDUIn The Detonation PDU to pass to the appropriate entity

Back to Top


HandleEntityStatePDU

public void HandleEntityStatePDU
(
    FEntityStatePDU EntityStatePDUIn
)

Delegates the given Entity State PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
EntityStatePDUIn The Entity State PDU to pass to the appropriate entity

Back to Top


HandleEntityStateUpdatePDU

public void HandleEntityStateUpdatePDU
(
    FEntityStateUpdatePDU EntityStateUpdatePDUIn
)

Delegates the given Entity State Update PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
EntityStateUpdatePDUIn The Entity State Update PDU to pass to the appropriate entity

Back to Top


HandleFirePDU

public void HandleFirePDU
(
    FFirePDU FirePDUIn
)

Delegates the given Fire PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
FirePDUIn The Fire PDU to pass to the appropriate entity

Back to Top


HandleOnDISEntityDestroyed

protected void HandleOnDISEntityDestroyed
(
    AActor* DestroyedActor
)

Handles removal of the given actor from the DIS scenario mappings.

Parameter Description
DestroyedActor Actor that was destroyed as part of the DIS scenario

Back to Top


HandleRemoveEntityPDU

public void HandleRemoveEntityPDU
(
    FRemoveEntityPDU RemoveEntityPDUIn
)

Delegates the given Remove Entity PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
RemoveEntityPDUIn The Remove Entity PDU to pass to the appropriate entity

Back to Top


HandleStartResumePDU

public void HandleStartResumePDU
(
    FStartResumePDU StartResumePDUIn
)

Delegates the given Start/Resume PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
StartResumePDUIn The Start/Resume PDU to pass to the appropriate entity

Back to Top


HandleStopFreezePDU

public void HandleStopFreezePDU
(
    FStopFreezePDU StopFreezePDUIn
)

Delegates the given Stop/Freeze PDU to the appropriate DIS Entity actor.

Category: GRILL DIS|Game Manager

Parameter Description
StopFreezePDUIn The Stop/Freeze PDU to pass to the appropriate entity

Back to Top


RemoveDISEntityFromMap

public bool RemoveDISEntityFromMap
(
    FEntityID EntityIDToRemove
)

Removes the entry correlating to the given Entity ID from the DIS Entity map.

Category: GRILL DIS|Game Manager

Parameter Description
EntityIDToRemove The Entity ID of the DIS entity that needs removed from the entity map
Returns
True if an entry was removed, false otherwise

Back to Top


SpawnNewEntityFromEntityState

private void SpawnNewEntityFromEntityState
(
    FEntityStatePDU EntityStatePDUIn
)

Spawns a new Unreal actor for given Entity State PDU if mapping exists.

Parameter Description
EntityStatePDUIn The entity state PDU representing the entity to spawn

Back to Top


Tick

protected virtual void Tick
(
    float DeltaTime
) override

Function called every frame on this Actor. Override this function to implement custom logic to be executed every frame. Note that Tick is disabled by default, and you will need to check PrimaryActorTick.bCanEverTick is set to true to enable it.

https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/GameFramework/AActor/Tick/

Parameter Description
DeltaTime Game time elapsed during last frame modified by the time dilation

Back to Top


Clone this wiki locally