KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Engine.h
Go to the documentation of this file.
1
10
11#pragma once
12
13#include "Object.h"
14#include "Core/KarmaTypes.h"
15
16#include "GameFramework/World.h"
17
18namespace Karma
19{
43 {
44 EWorldType::Type m_WorldType;
45
46 std::string m_ContextHandle;
47
48 class UGameViewportClient* m_GameViewport;
49
50 class UGameInstance* m_OwningGameInstance;
51
52
54 //UPROPERTY(transient)
55 //TArray<FNamedNetDriver> ActiveNetDrivers;
56
57
59 //int32 PIEInstance;
60
61
63 //FString PIEPrefix;
64
65
67 //ERHIFeatureLevel::Type PIEWorldFeatureLevel;
68
69
72
73
76
77
80
81
84
85
87 //std::string CustomDescription;
88
89
90 // If > 0, tick this world at a fixed rate in PIE
92 float PIEAccumulatedTickSeconds = 0.f;
93
94
96 //TSet<FObjectKey> GarbageObjectsToVerify;
97
98 /**************************************************************/
99
101 //TArray<TObjectPtr<UWorld>*>
103
111 void AddRef(UWorld*& WorldPtr)
112 {
113 WorldPtr = m_ThisCurrentWorld;
114 m_ExternalReferences.AddUnique(&WorldPtr);
115 }
116
125 void RemoveRef(UWorld*& WorldPtr)
126 {
127 m_ExternalReferences.Remove(&WorldPtr);
128 WorldPtr = nullptr;
129 }
130
131
139
140
142 //void AddReferencedObjects(FReferenceCollector& Collector, const UObject* ReferencingObject);
143
151 {
152 return m_ThisCurrentWorld;
153 }
154
161 : m_WorldType(EWorldType::None)
162 //, m_ContextHandle(NAME_None)
163 //, TravelURL()
164 //, TravelType(0)
165 //, PendingNetGame(nullptr)
166 //, bShouldCommitPendingMapChange(0)
167 , m_GameViewport(nullptr)
168 , m_OwningGameInstance(nullptr)
169 //, PIEInstance(INDEX_NONE)
170 //, PIEWorldFeatureLevel(ERHIFeatureLevel::Num)
171 , m_RunAsDedicated(false)
174 , m_AudioDeviceID(INDEX_NONE)
175 , m_ThisCurrentWorld(nullptr)
176 { }
177
178 private:
179 UWorld* m_ThisCurrentWorld;
180 };
181
189 {
191
192 class UGameInstance* m_GameInstance;
193
194 public:
201 KEngine();
202
209 void Init(/*IEngineLoop* InEngineLoop*/);
210
219 virtual void Tick(float DeltaSeconds, bool bIdleMode);
220
227 void CleanupGameViewport();
228
238
245 virtual void WorldAdded(UWorld* World) {}
246
253 virtual void WorldDestroyed(UWorld* InWorld) {}
254
260 virtual class UGameInstance* GetCurrentGameInstance() const { return m_GameInstance; }
261
262 protected:
263 KarmaVector<FWorldContext*> m_WorldList;
264 };
265
267 extern KARMA_API KEngine* GEngine;
268}
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define FORCEINLINE
Typical inlining macro for clarity.
Definition Core.h:170
@ None
Events of the unknown category.
Definition Event.h:35
#define DECLARE_KARMA_CLASS(TClass, TSuperClass)
Karma's gamecode object class declaration.
Definition GFrameworkMacros.h:45
This file contains the custom types used in Engine's logic.
This file contains the class UObject along with helper functions.
This file contains UWorld class and FActorSpawnParameters.
virtual void WorldDestroyed(UWorld *InWorld)
Definition Engine.h:253
void Init()
Set up UGameInstance for the constructor.
Definition Engine.cpp:21
KEngine()
Default constructor. Includes setting up UGameInstance.
Definition Engine.cpp:15
virtual class UGameInstance * GetCurrentGameInstance() const
Definition Engine.h:260
virtual void WorldAdded(UWorld *World)
Definition Engine.h:245
virtual void Tick(float DeltaSeconds, bool bIdleMode)
Update everything (UWorlds and subsequently all the AActors). Should be economic for processor and re...
Definition Engine.cpp:35
void CleanupGameViewport()
Definition Engine.cpp:67
FWorldContext & CreateNewWorldContext(EWorldType::Type WorldType)
Create a context for new world.
Definition Engine.cpp:58
A high-level manager object for an instance of the running game.
Definition GameInstance.h:26
A game viewport (FViewport) is a high-level abstract interface for the platform specific rendering,...
Definition GameViewportClient.h:31
UObject()
Definition Object.cpp:10
The World is the top level object representing a map or a sandbox in which Actors and Components will...
Definition World.h:148
Karma's std::vector wrapper with additional functionalities.
Definition KarmaTypes.h:243
Specifies the goal/source of a UWorld object.
Definition KarmaTypes.h:56
Type
Definition KarmaTypes.h:58
A context for dealing with UWorlds at the engine level. As the engine brings up and destroys world,...
Definition Engine.h:43
void RemoveRef(UWorld *&WorldPtr)
Removes an external reference.
Definition Engine.h:125
void AddRef(UWorld *&WorldPtr)
Routine to add outside references to our UWorld. If our UWorld changes, routines outside of UWorldCon...
Definition Engine.h:111
FORCEINLINE UWorld * World() const
Getter for variable m_ThisCurrentWorld.
Definition Engine.h:150
bool m_RunAsDedicated
Definition Engine.h:71
uint32_t m_AudioDeviceID
Definition Engine.h:83
FWorldContext()
A usual constructor.
Definition Engine.h:160
bool m_bWaitingOnOnlineSubsystem
Definition Engine.h:75
bool m_bIsPrimaryPIEInstance
Definition Engine.h:79
void SetCurrentWorld(UWorld *World)
Set CurrentWorld and update external reference pointers to reflect this.
Definition Engine.cpp:10
float PIEFixedTickSeconds
Definition Engine.h:91
KarmaVector< UWorld ** > m_ExternalReferences
Definition Engine.h:102