//Implement callback function OnHealthCheck
//GameLift invokes this callback approximately every 60 seconds.
//A game server might want to check the health of dependencies, etc.
//Then it returns health status true if healthy, false otherwise.
//The game server must respond within 60 seconds, or GameLift records 'false'.
//In this example, the game server always reports healthy.
auto onHealthCheck = []()
{
UE_LOG(LogTruffleUpServerGameMode, Log, TEXT("Performing Health Check"));
return true;
};
processParameters.OnHealthCheck.BindLambda(onHealthCheck);
void ATrouffleUpServerGameMode::parseCommandLinePort(int32& outPort)
{
// add the possibility to define more ports to allow multiple play sessions at the same time
TArray<FString> commandLineTokens, commandLineSwitches;
FCommandLine::Parse(FCommandLine::Get(),commandLineTokens,commandLineSwitches);
for (const auto& token : commandLineSwitches)
{
FString key,value;
if ( token.Split("=",&key,&value))
{
if (key.Equals(TEXT("port"), ESearchCase::IgnoreCase))
{
outPort = FCString::Atoi(*value);
return;
}
}
}
}