Got rid of multithreading in GameMode

This commit is contained in:
2026-02-27 17:49:29 -05:00
parent 7bb4854844
commit 8825fe3a1e
2 changed files with 48 additions and 70 deletions

View File

@@ -6,7 +6,6 @@
#include "Engine/HitResult.h"
#include "GameFramework/GameModeBase.h"
#include "LuprexSockets.h"
#include "TriggeredTask.h"
#include "BreakToDebugger.h"
#include "LuprexGameModeBase.generated.h"
@@ -14,7 +13,7 @@
*
*/
UCLASS(BlueprintType)
class INTEGRATION_API ALuprexGameModeBase : public AGameModeBase, public FRunnable
class INTEGRATION_API ALuprexGameModeBase : public AGameModeBase
{
GENERATED_BODY()
@@ -80,13 +79,17 @@ public:
// It is up to the blueprint code to actually determine what we're looking at.
void UpdateLookAt();
// Pre-tick and post-tick functions.
void OnWorldPreActorTick(UWorld* InWorld, ELevelTick InLevelTick, float InDeltaSeconds);
void OnWorldPostActorTick(UWorld* InWorld, ELevelTick InLevelTick, float InDeltaSeconds);
// If the engine wants a new copy of the lua source code,
// provide it.
void UpdateLuaSourceCode();
// The run function is called by a background thread
// to update luprex sockets and update luprex itself.
virtual uint32 Run() override;
// Update Sockets and Lua. Feeds socket data into the luprex engine,
// and also calls play_update, the main Lua update function that causes
// Luprex to execute the majority of all the Lua code that needs processing.
void UpdateSocketsAndLua();
// Post-tick function.
void OnWorldPostActorTick(UWorld* InWorld, ELevelTick InLevelTick, float InDeltaSeconds);
// Get the current Luprex Game Mode Base, given a Context object.
static ALuprexGameModeBase *FromContext(const UObject *Context);
@@ -101,10 +104,7 @@ public:
UPROPERTY(EditAnywhere, Category="Debugging Tools")
ElxBreakToDebuggerThreshold BreakToDebuggerLogVerbosity;
// This utility runs the luprex update and socket update in a thread.
FTriggeredTask LuprexUpdateTask;
// Luprex socket system. Aside from construction, only touched by Luprex thread.
// Luprex socket system.
TUniquePtr<FlxSockets> Sockets;
// True if 'BeginPlay' has been successfully completed.
@@ -122,8 +122,7 @@ public:
// When do we next rotate the cube.
float NextRotateCube = 1.0f;
// These allow us to pre-tick and post-tick.
FDelegateHandle OnWorldPreActorTickHandle;
// This allows us to post-tick.
FDelegateHandle OnWorldPostActorTickHandle;
// The device that implements BreakToDebuggerLogVerbosity, above.