Hello everybody,
I’m currently working on an online multiplayer game using AWS GameLift. Everything worked fine until I added a SetTimer in a GameMode GameLift callback (OnStartGameSession).
void AgmodeDM::OnStartGameSession_GameLift(Aws::GameLift::Server::Model::GameSession gameSession) {
#if WITH_GAMELIFT
FString Json = gameSession.GetMatchmakerData(); TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Json);
if (FJsonSerializer::Deserialize(Reader, JsonObject) && JsonObject->HasField("teams")) {
const TArray<TSharedPtr<FJsonValue>> Arr_Teams = JsonObject->GetArrayField("teams");
for (int i = 0; i < Arr_Teams.Num(); i++) {
const TSharedPtr<FJsonObject> TeamJsonObject = Arr_Teams[i]->AsObject();
const TArray<TSharedPtr<FJsonValue>> Arr_Players = TeamJsonObject->GetArrayField("players");
for (int j = 0; j < Arr_Players.Num(); j++) {
this->Arr_PlayerDatas.Add(FPlayerData(*Arr_Players[j]->AsObject().Get()));
}
}
}
// Line below cause the crash
GetWorld()->GetTimerManager().SetTimer(
ShutdownTimerHandle,
FTimerDelegate::CreateUObject(
this, &AgmodeDM::Toto),
this->fWaitPlayersToJoinTime, false);
Aws::GameLift::Server::ActivateGameSession();
#endif
}
The crash generate only this line in logs: LogWindows: Windows GetLastError: The operation completed successfully. (0)
In the windows event viewer I found: KERNELBASE.dll, Exception code: 0x00004000
You’ll find below all the things I tried/found to remove the error:
- The line causing the crash execute properly in the GameMode begin play function (within or whithout WITH_GAMELIFT)
- I tried to recompile everything without success
- I copied/pasted the .pdb to dedicated server to add some stack trace in the log, but sadly nothing more in it.
There’s not so much resources on this kind of error thus I decided to open a post here to find some help !
Thanks