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

The World is the top level object representing a map or a sandbox in which Actors and Components will exist and be rendered. More...

#include <World.h>

Inheritance diagram for Karma::UWorld:
Collaboration diagram for Karma::UWorld:

Classes

struct  InitializationValues
 

Public Member Functions

 UWorld ()
 
AActorSpawnActor (UClass *Class, FTransform const *Transform, const FActorSpawnParameters &SpawnParameters=FActorSpawnParameters())
 
template<class T>
T * SpawnActor (UClass *Class, const FActorSpawnParameters &SpawnParameters=FActorSpawnParameters())
 
ULevelGetPersistentLevel () const
 
void SetGameInstance (UGameInstance *NewGI)
 
void Tick (float DeltaSeconds)
 
FORCEINLINE double GetTimeSeconds () const
 
FORCEINLINE ULevelGetCurrentLevel () const
 
bool AreActorsInitialized () const
 
bool HasBegunPlay () const
 
void InitializeNewWorld (const InitializationValues IVS=InitializationValues(), bool bInSkipInitWorld=false)
 
void InitializeActorsForPlay (const FURL &InURL, bool bResetTime=true)
 
void ModifyLevel (ULevel *Level) const
 
bool IsGameWorld () const
 
void RemoveActor (AActor *Actor, bool bShouldModifyLevel) const
 
bool ShivaActor (AActor *Actor, bool bNetForce=false, bool bShouldModifyLevel=true)
 
void AddOnActorSpawnedHandler () const
 
void RemoveOnActorSpawnedHander () const
 
void OnActorSpawned ()
 
- Public Member Functions inherited from Karma::UObject
 UObject ()
 
virtual void FinishDestroy ()
 
virtual const std::string & GetDesc ()
 Return a one line description of an object for viewing in the thumbnail view of the generic browser.
 
virtual class UWorldGetWorld () const
 Returns what UWorld this object is contained within.
 
bool IsValidChecked (const UObject *Test)
 
virtual void BeginDestroy ()
 Called before destroying the object. This is called immediately upon deciding to destroy the object, to allow the object to begin an asynchronous cleanup process.
 
FORCEINLINE bool Modify (bool bAlwaysMarkDirty=true)
 
bool IsSelected () const
 Test the selection state of a UObject.
 
- Public Member Functions inherited from Karma::UObjectBase
 UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName)
 
UPackageGetPackage () const
 
UPackageGetExternalPackage () const
 
bool IsUnreachable () const
 
FORCEINLINE void SetInternalIndex (uint32_t StoreIndex)
 
FORCEINLINE uint32_t GetInternalIndex () const
 
void MarkAsGarbage ()
 
void ClearGarbage ()
 
FORCEINLINE const std::string & GetName () const
 
FORCEINLINE void SetObjectName (const std::string &aName)
 
FORCEINLINE UObjectGetOuter () const
 
UObjectGetTypedOuter (UClass *Target) const
 
template<typename T>
T * GetTypedOuter () const
 
bool IsValidLowLevel () const
 
template<typename OtherClassType>
FORCEINLINE bool IsA (OtherClassType SomeBase) const
 
FORCEINLINE UClassGetClass () const
 
FORCEINLINE EObjectFlags GetFlags () const
 
FORCEINLINE void SetFlags (EObjectFlags NewFlags)
 
FORCEINLINE void ClearFlags (EObjectFlags FlagsToClear)
 
FORCEINLINE bool HasAnyFlags (EObjectFlags FlagsToCheck) const
 
FORCEINLINE bool HasAnyInternalFlags (EInternalObjectFlags FlagsToCheck) const
 
FORCEINLINE void SetInternalFlags (EInternalObjectFlags FlagsToSet) const
 
FORCEINLINE void AddToRoot ()
 

Static Public Member Functions

static UWorldCreateWorld (const EWorldType::Type InWorldType, bool bInformEngineOfWorld, const std::string &WorldName="NoName", UPackage *InWorldPackage=NULL, bool bAddToRoot=true, bool bInSkipInitWorld=false)
 
- Static Public Member Functions inherited from Karma::UObject
static const char * StaticConfigName ()
 
- Static Public Member Functions inherited from Karma::UObjectBase
static FORCEINLINE EInternalObjectFlags FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags)
 

Public Attributes

uint8_t m_bIsTearingDown: 1
 
uint8_t m_bActorsInitialized: 1
 
uint8_t m_bBegunPlay: 1
 
EWorldType::Type m_WorldType
 

Additional Inherited Members

- Protected Member Functions inherited from Karma::UObjectBase
 UObjectBase ()
 Providing a default constructor.
 
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
 

Detailed Description

The World is the top level object representing a map or a sandbox in which Actors and Components will exist and be rendered.

A World can be a single Persistent Level with an optional list of streaming levels that are loaded and unloaded via volumes and blueprint functions or it can be a collection of levels organized with a World Composition.

In a standalone game, generally only a single World exists except during seamless area transitions when both a destination and current world exists. In the editor many Worlds exist: The level being edited, each PIE instance, each editor tool which has an interactive rendered viewport, and many more.

Constructor & Destructor Documentation

◆ UWorld()

Karma::UWorld::UWorld ( )

Constructor for class UWorld

Since
Karma 1.0.0

Member Function Documentation

◆ AddOnActorSpawnedHandler()

void Karma::UWorld::AddOnActorSpawnedHandler ( ) const

Add a listener for OnActorSpawned events

Todo
Not functional

◆ AreActorsInitialized()

bool Karma::UWorld::AreActorsInitialized ( ) const

Returns true if the actors have been initialized and are ready to start play

Since
Karma 1.0.0

◆ CreateWorld()

UWorld * Karma::UWorld::CreateWorld ( const EWorldType::Type InWorldType,
bool bInformEngineOfWorld,
const std::string & WorldName = "NoName",
UPackage * InWorldPackage = NULL,
bool bAddToRoot = true,
bool bInSkipInitWorld = false )
static

Static function that creates a new UWorld and returns a pointer to it

Parameters
InWorldTypeWhether PIE or standalone game etc
bInformEngineOfWorldtrue to notify the GEngine that world has spawned
WorldNameThe name of the world
InWorldPackageOuter for the new world we are creating
bAddToRootAdd to root set so the world doesn't get garbage collected
bInSkipInitWorldIf we want to skip initializating world (not functional)
Returns
The reference to the new world created
Since
Karma 1.0.0

◆ GetCurrentLevel()

FORCEINLINE ULevel * Karma::UWorld::GetCurrentLevel ( ) const
inline

Getter for m_CurrentLevel

Since
Karma 1.0.0

◆ GetPersistentLevel()

ULevel * Karma::UWorld::GetPersistentLevel ( ) const
inline

Getter for m_PersistentLevel

Remarks
Remember UWorld is required by a ULevel (referenced by m_PersistentLevel). Look UWorld::InitializeNewWorld
Since
Karma 1.0.0

◆ GetTimeSeconds()

FORCEINLINE double Karma::UWorld::GetTimeSeconds ( ) const
inline

Getter for m_TimeSeconds

Since
Karma 1.0.0

◆ HasBegunPlay()

bool Karma::UWorld::HasBegunPlay ( ) const

Initializes a newly created world. This and nearby functions (create destroy world for instance) should be useful Returns true if gameplay has already started, false otherwise.

Since
Karma 1.0.0

◆ InitializeActorsForPlay()

void Karma::UWorld::InitializeActorsForPlay ( const FURL & InURL,
bool bResetTime = true )

Initializes all actors and prepares them to start gameplay

Parameters
InURLcommandline URL
bResetTime(optional) whether the WorldSettings's TimeSeconds should be reset to zero
Todo
See if actor iteration is required
Since
Karma 1.0.0

◆ InitializeNewWorld()

void Karma::UWorld::InitializeNewWorld ( const InitializationValues IVS = InitializationValues(),
bool bInSkipInitWorld = false )

Initializes a newly created world.

Parameters
IVSThe UWorld specific properties, for instance physics or scene settings
bInSkipInitWorldIf we want to skip initialization (not functional)
Since
Karma 1.0.0

◆ IsGameWorld()

bool Karma::UWorld::IsGameWorld ( ) const

Returns true if this world is any kind of game world (including PIE worlds)

Since
Karma 1.0.0

◆ ModifyLevel()

void Karma::UWorld::ModifyLevel ( ULevel * Level) const

Transacts the specified level – the correct way to modify a level as opposed to calling Level->Modify.

Todo
Not functional. Should be completed once we delve into game logic and sorts while making actual game?
Since
Karma 1.0.0

◆ OnActorSpawned()

void Karma::UWorld::OnActorSpawned ( )

Broadcasts a notification whenever an actor is spawned. This event is only for newly created actors.

We may take digression from ue in the sense that we may use Karma's own event broadcasting system

Todo
Not functional

◆ RemoveActor()

void Karma::UWorld::RemoveActor ( AActor * Actor,
bool bShouldModifyLevel ) const

Removes the passed in actor from the actor lists. Please note that the code actually doesn't physically remove the index but rather clears it so other indices are still valid and the actors array size doesn't change.

Parameters
ActorActor to remove.
bShouldModifyLevelIf true, Modify() the level before removing the actor if in the editor.
Since
Karma 1.0.0

◆ SetGameInstance()

void Karma::UWorld::SetGameInstance ( UGameInstance * NewGI)
inline

Sets the owning game instance for this world

Since
Karma 1.0.0

◆ ShivaActor()

bool Karma::UWorld::ShivaActor ( AActor * Actor,
bool bNetForce = false,
bool bShouldModifyLevel = true )

Removes the actor from its level's actor list and generally cleans up the engine's internal state. What this function does not do, but is handled via garbage collection instead, is remove references to this actor from all other actors, and kill the actor's resources. This function is set up so that no problems occur even if the actor is being destroyed inside its recursion stack.

In UE this routine is called DestoryActor, in Karma, obviously, we be using ShivaActor which should mean the same.

Parameters
ThisActorActor to remove.
bNetForce[optional] Ignored unless called during play. Default is false.
bShouldModifyLevel[optional] If true, Modify() the level before removing the actor. Default is true.
Returns
true if destroyed or already marked for destruction, false if actor couldn't be destroyed.
See also
Actor::DispatchBeginPlay(bool bFromLevelStreaming)
Since
Karma 1.0.0

◆ SpawnActor() [1/2]

template<class T>
T * Karma::UWorld::SpawnActor ( UClass * Class,
const FActorSpawnParameters & SpawnParameters = FActorSpawnParameters() )
inline

Templated version of SpawnActor that allows you to specify the class type via parameter while the return type is a parent class of that type

Parameters
ClassKarma's, UE based, meta info Class to Spawn
SpawnParametersSpawn Parameters specific to the Actor
Returns
The type casted UObject
Since
Karma 1.0.0

◆ SpawnActor() [2/2]

AActor * Karma::UWorld::SpawnActor ( UClass * Class,
FTransform const * Transform,
const FActorSpawnParameters & SpawnParameters = FActorSpawnParameters() )

Spawn Actors with given transform and SpawnParameters

Parameters
ClassKarma's, UE based, meta info Class to Spawn
TransformWorld Transform to spawn with
SpawnParametersSpawn Parameters specific to the Actor
Returns
Actor that just spawned
Since
Karma 1.0.0

◆ Tick()

void Karma::UWorld::Tick ( float DeltaSeconds)

Update the level after a variable amount of time, DeltaSeconds, has passed. All child actors are ticked after their owners have been ticked.

Remarks
Using simple ticking scheme, just like done during training as Sumo
Since
Karma 1.0.0

Member Data Documentation

◆ m_bActorsInitialized

uint8_t Karma::UWorld::m_bActorsInitialized

Time in seconds since level began play, but IS paused when the game is paused, and IS dilated/clamped. Whether actors have been initialized for play

◆ m_bBegunPlay

uint8_t Karma::UWorld::m_bBegunPlay

Whether BeginPlay has been called on Actors

◆ m_bIsTearingDown

uint8_t Karma::UWorld::m_bIsTearingDown

Is the world being torn down

◆ m_WorldType

EWorldType::Type Karma::UWorld::m_WorldType

The type of world this is. Describes the context in which it is being used (Editor, Game, Preview etc.)


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