KarmaEngine
Game Engine for practical learning and research purposes
|
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>
Classes | |
struct | InitializationValues |
Public Member Functions | |
UWorld () | |
AActor * | SpawnActor (UClass *Class, FTransform const *Transform, const FActorSpawnParameters &SpawnParameters=FActorSpawnParameters()) |
template<class T> | |
T * | SpawnActor (UClass *Class, const FActorSpawnParameters &SpawnParameters=FActorSpawnParameters()) |
ULevel * | GetPersistentLevel () const |
void | SetGameInstance (UGameInstance *NewGI) |
void | Tick (float DeltaSeconds) |
FORCEINLINE double | GetTimeSeconds () const |
FORCEINLINE ULevel * | GetCurrentLevel () 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 () |
![]() | |
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 UWorld * | GetWorld () 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. | |
![]() | |
UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName) | |
UPackage * | GetPackage () const |
UPackage * | GetExternalPackage () 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 UObject * | GetOuter () const |
UObject * | GetTypedOuter (UClass *Target) const |
template<typename T> | |
T * | GetTypedOuter () const |
bool | IsValidLowLevel () const |
template<typename OtherClassType> | |
FORCEINLINE bool | IsA (OtherClassType SomeBase) const |
FORCEINLINE UClass * | GetClass () 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 UWorld * | CreateWorld (const EWorldType::Type InWorldType, bool bInformEngineOfWorld, const std::string &WorldName="NoName", UPackage *InWorldPackage=NULL, bool bAddToRoot=true, bool bInSkipInitWorld=false) |
![]() | |
static const char * | StaticConfigName () |
![]() | |
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 | |
![]() | |
UObjectBase () | |
Providing a default constructor. | |
FORCEINLINE void | SetFlagsTo (EObjectFlags NewFlags) |
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.
Karma::UWorld::UWorld | ( | ) |
Constructor for class UWorld
void Karma::UWorld::AddOnActorSpawnedHandler | ( | ) | const |
Add a listener for OnActorSpawned events
bool Karma::UWorld::AreActorsInitialized | ( | ) | const |
Returns true if the actors have been initialized and are ready to start play
|
static |
Static function that creates a new UWorld and returns a pointer to it
InWorldType | Whether PIE or standalone game etc |
bInformEngineOfWorld | true to notify the GEngine that world has spawned |
WorldName | The name of the world |
InWorldPackage | Outer for the new world we are creating |
bAddToRoot | Add to root set so the world doesn't get garbage collected |
bInSkipInitWorld | If we want to skip initializating world (not functional) |
|
inline |
Getter for m_CurrentLevel
|
inline |
Getter for m_PersistentLevel
|
inline |
Getter for m_TimeSeconds
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.
void Karma::UWorld::InitializeActorsForPlay | ( | const FURL & | InURL, |
bool | bResetTime = true ) |
Initializes all actors and prepares them to start gameplay
InURL | commandline URL |
bResetTime | (optional) whether the WorldSettings's TimeSeconds should be reset to zero |
void Karma::UWorld::InitializeNewWorld | ( | const InitializationValues | IVS = InitializationValues(), |
bool | bInSkipInitWorld = false ) |
Initializes a newly created world.
IVS | The UWorld specific properties, for instance physics or scene settings |
bInSkipInitWorld | If we want to skip initialization (not functional) |
bool Karma::UWorld::IsGameWorld | ( | ) | const |
Returns true if this world is any kind of game world (including PIE worlds)
void Karma::UWorld::ModifyLevel | ( | ULevel * | Level | ) | const |
Transacts the specified level – the correct way to modify a level as opposed to calling Level->Modify.
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
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.
Actor | Actor to remove. |
bShouldModifyLevel | If true, Modify() the level before removing the actor if in the editor. |
|
inline |
Sets the owning game instance for this world
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.
ThisActor | Actor 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. |
|
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
Class | Karma's, UE based, meta info Class to Spawn |
SpawnParameters | Spawn Parameters specific to the Actor |
AActor * Karma::UWorld::SpawnActor | ( | UClass * | Class, |
FTransform const * | Transform, | ||
const FActorSpawnParameters & | SpawnParameters = FActorSpawnParameters() ) |
Spawn Actors with given transform and SpawnParameters
Class | Karma's, UE based, meta info Class to Spawn |
Transform | World Transform to spawn with |
SpawnParameters | Spawn Parameters specific to the Actor |
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.
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
uint8_t Karma::UWorld::m_bBegunPlay |
Whether BeginPlay has been called on Actors
uint8_t Karma::UWorld::m_bIsTearingDown |
Is the world being torn down
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.)