Removed old code. Wrote new command line argument parser/cacher

This commit is contained in:
Norman Lansing
2026-03-04 06:40:59 -05:00
parent 13daff916c
commit ebf932882b
2 changed files with 132 additions and 320 deletions

View File

@@ -5,14 +5,13 @@
#include "CoreMinimal.h"
#include "ShooterGameModeBase.h"
#if WITH_GAMELIFT
#include "GameLiftServerSDK.h"
#endif
#include "ShooterGameMode.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogShooterGameMode, Log, All);
struct FProcessParameters;
struct FServerParameters;
/**
*
*/
@@ -23,25 +22,44 @@ class FPSTEMPLATE_API AShooterGameMode : public AShooterGameModeBase
public:
AShooterGameMode();
protected:
UPROPERTY(Config, BlueprintReadOnly)
bool bIsAnywhereFleet = false;
UPROPERTY(Config, BlueprintReadOnly)
FString FleetId;
UPROPERTY(Config, BlueprintReadOnly)
FString AuthToken;
UPROPERTY(Config, BlueprintReadOnly)
FString HostId;
UPROPERTY(Config, BlueprintReadOnly)
FString WebSocketUrl;
UPROPERTY(Config)
FString ServerRegion;
UPROPERTY(Config, BlueprintReadOnly)
int32 ServerPort;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bDebugMode = false;
virtual void BeginPlay() override;
virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
private:
void InitGameLift();
FString CachedCommandLine;
TSharedPtr<FProcessParameters> ProcessParameters;
TSharedPtr<FServerParameters> ServerParameters;
int32 GetConfiguredOrDefaultPort() const;
#if WITH_GAMELIFT
bool SetParametersFromCommandLine(FServerParameters& OutServerParameters, FProcessParameters& OutProcessParameters);
static void LogServerParameters(const FServerParameters& InServerParameters);
void SetProcessIdOnServerParameters(FServerParameters& OutServerParameters);
bool ValidateServerParameters(const FString& CommandLine, const FString& ParameterName, FString& OutValue, const bool bCritical = true);
void LogServerSummary(const FServerParameters& InServerParameters, const FProcessParameters& InProcessParameters);
void LogGameLiftServerSummary(bool bIsAnywhere, const FServerParameters& InServerParameters, const FProcessParameters& InProcessParameters);
void BindGameLiftCallbackFunctions(FProcessParameters& ProcessParameters,
FGameLiftServerSDKModule& GameLiftSdkModule);
void InitiateProcessReady(FProcessParameters& ProcessParameters, FGameLiftServerSDKModule& GameLiftSdkModule);
bool InitiateConnectionWithGameLiftAgent(FServerParameters& ServerParameters,
FGameLiftServerSDKModule& GameLiftSdkModule);
void InitGameLift();
#endif
};