KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::FWorldContext Struct Reference

A context for dealing with UWorlds at the engine level. As the engine brings up and destroys world, we need a way to keep straight what world belongs to what. More...

#include <Engine.h>

Collaboration diagram for Karma::FWorldContext:

Public Member Functions

void AddRef (UWorld *&WorldPtr)
 Routine to add outside references to our UWorld. If our UWorld changes, routines outside of UWorldContexts can have automagically updated references to current new UWorld.
 
void RemoveRef (UWorld *&WorldPtr)
 Removes an external reference.
 
void SetCurrentWorld (UWorld *World)
 Set CurrentWorld and update external reference pointers to reflect this.
 
FORCEINLINE UWorldWorld () const
 Getter for variable m_ThisCurrentWorld.
 
 FWorldContext ()
 A usual constructor.
 

Public Attributes

EWorldType::Type m_WorldType
 
std::string m_ContextHandle
 
class UGameViewportClientm_GameViewport
 
class UGameInstancem_OwningGameInstance
 
bool m_RunAsDedicated
 
bool m_bWaitingOnOnlineSubsystem
 
bool m_bIsPrimaryPIEInstance
 
uint32_t m_AudioDeviceID
 
float PIEFixedTickSeconds = 0.f
 
float PIEAccumulatedTickSeconds = 0.f
 
KarmaVector< UWorld ** > m_ExternalReferences
 

Detailed Description

A context for dealing with UWorlds at the engine level. As the engine brings up and destroys world, we need a way to keep straight what world belongs to what.

WorldContexts can be thought of as a track. By default we have 1 track that we load and unload levels on. Adding a second context is adding a second track; another track of progression for worlds to live on.

For the GameEngine, there will be one WorldContext until we decide to support multiple simultaneous worlds. For the EditorEngine, there may be one WorldContext for the EditorWorld and one for the PIE World.

FWorldContext provides both a way to manage 'the current PIE UWorld*' as well as state that goes along with connecting/travelling to new worlds.

FWorldContext should remain internal to the UEngine classes. Outside code should not keep pointers or try to manage FWorldContexts directly. Outside code can still deal with UWorld*, and pass UWorld*s into Engine level functions. The Engine code can look up the relevant context for a given UWorld*.

For convenience, FWorldContext can maintain outside pointers to UWorld*s. For example, PIE can tie UWorld* UEditorEngine::PlayWorld to the PIE world context. If the PIE UWorld changes, the UEditorEngine::PlayWorld pointer will be automatically updated. This is done with AddRef() and SetCurrentWorld().

Constructor & Destructor Documentation

◆ FWorldContext()

Karma::FWorldContext::FWorldContext ( )
inline

A usual constructor.

Since
Karma 1.0.0

Member Function Documentation

◆ AddRef()

void Karma::FWorldContext::AddRef ( UWorld *& WorldPtr)
inline

Routine to add outside references to our UWorld. If our UWorld changes, routines outside of UWorldContexts can have automagically updated references to current new UWorld.

Parameters
WorldPtrThe reference to the UWorld pointer of outside (of FWorldContext) code
Since
Karma 1.0.0

◆ RemoveRef()

void Karma::FWorldContext::RemoveRef ( UWorld *& WorldPtr)
inline

Removes an external reference.

Parameters
WorldPtrThe reference to the UWorld pointer of outside (of FWorldContext) code
See also
FWorldContext::AddRef
Since
Karma 1.0.0

◆ SetCurrentWorld()

void Karma::FWorldContext::SetCurrentWorld ( UWorld * World)

Set CurrentWorld and update external reference pointers to reflect this.

Parameters
WorldThe pointer to the UWorld that m_ThisCurrentWorld is set to
Since
Karma 1.0.0

◆ World()

FORCEINLINE UWorld * Karma::FWorldContext::World ( ) const
inline

Getter for variable m_ThisCurrentWorld.

Collect FWorldContext references for garbage collection

Returns
the UWorld object
Since
Karma 1.0.0

Member Data Documentation

◆ m_AudioDeviceID

uint32_t Karma::FWorldContext::m_AudioDeviceID

Handle to this world context's audio device.

◆ m_bIsPrimaryPIEInstance

bool Karma::FWorldContext::m_bIsPrimaryPIEInstance

Is this the 'primary' PIE instance. Primary is preferred when, for example, unique hardware like a VR headset can be used by only one PIE instance.

◆ m_bWaitingOnOnlineSubsystem

bool Karma::FWorldContext::m_bWaitingOnOnlineSubsystem

Is this world context waiting for an online login to complete (for PIE)

◆ m_ExternalReferences

KarmaVector<UWorld**> Karma::FWorldContext::m_ExternalReferences

On a transition to another level (e.g. LoadMap), the engine will verify that these objects have been cleaned up by garbage collection Outside pointers to CurrentWorld that should be kept in sync if current world changes

◆ m_RunAsDedicated

bool Karma::FWorldContext::m_RunAsDedicated

A list of active net drivers The PIE instance of this world, -1 is default The Prefix in front of PIE level names, empty is default The feature level that PIE world should use Is this running as a dedicated server

◆ PIEFixedTickSeconds

float Karma::FWorldContext::PIEFixedTickSeconds = 0.f

Custom description to be display in blueprint debugger UI


The documentation for this struct was generated from the following files: