Files
DedicatedServerCourse/Source/DedicatedServers/Public/Game/DS_GameMode.h

56 lines
1.4 KiB
C
Raw Normal View History

2026-02-24 22:39:26 -05:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
2026-03-26 21:07:11 -04:00
struct FServerParameters;
struct FProcessParameters;
2026-02-24 22:39:26 -05:00
2026-03-26 21:07:11 -04:00
#include "CoreMinimal.h"
#include "GameFramework/GameMode.h"
#include "Game/GameLift/GameLiftClpTypes.h"
#include "DS_GameMode.generated.h"
2026-02-24 22:39:26 -05:00
2026-03-26 21:07:11 -04:00
DECLARE_LOG_CATEGORY_EXTERN(LogDS_GameMode, Log, All);
struct FGameLiftConfig
{
bool bIsAnywhereFleet = false;
2026-03-12 07:13:47 -04:00
bool bAllOptionsFound = false;
2026-03-12 07:13:47 -04:00
int32 ServerPort = 7777;
2026-03-12 07:13:47 -04:00
cmdlineparser::details::FParseResult AuthTokenResult;
cmdlineparser::details::FParseResult FleetIdResult;
cmdlineparser::details::FParseResult HostIdResult;
cmdlineparser::details::FParseResult WebSocketUrlResult;
};
2026-03-26 21:07:11 -04:00
2026-02-24 22:39:26 -05:00
UCLASS()
2026-03-26 21:07:11 -04:00
class DEDICATEDSERVERS_API ADS_GameMode : public AGameMode
2026-02-24 22:39:26 -05:00
{
GENERATED_BODY()
2026-03-26 21:07:11 -04:00
public:
protected:
2026-02-24 22:39:26 -05:00
virtual void BeginPlay() override;
2026-03-26 21:07:11 -04:00
virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
2026-02-24 22:39:26 -05:00
private:
FGameLiftConfig GameLiftConfig;
FString CachedCommandLine;
2026-03-26 21:07:11 -04:00
static FString GetSHA256Hash(const FString& InString);
void InitGameLift();
2026-03-12 07:13:47 -04:00
bool GetAnywhereFleetParameters(const FString& CommandLineString);
void LogAnywhereFleetParameters();
TSharedPtr<FProcessParameters> ProcessParameters;
2026-03-26 21:07:11 -04:00
static void LogServerParameters(const FServerParameters& InServerParameters);
static FString GetValueOrHash(const FString& Value);
2026-02-24 22:39:26 -05:00
};