Hi everyone, I have a couple of issues that are really making me crazy with the Seamless Travel in a multiplayer online game that im doing with my team. Some explanation: We have a main menu, where each player starts the game, from there the player is able to create or join a session, this session is thought only as a Lobby before the real match, to select your prefered character, weapons, wait to the other players… When all players are ready the game starts and the players should be carried to another map. First I tested all in LAN just using Server Travel, and all works fine, I saved all data in the Game Instance, and after the Players Controllers and Players States where created again in the other map, I get the data. The problem became when I tested all that with Steam. I noticed, that Player Controller and Player States can’t be destroyed and created to travel to the Match Map because the Steam clients fail and are disconnected. I thought then that Seamless Travel was the solution that I need, and seems to work, but at this point the problem is…
In the seamless travel, the actor by default will persist like this:
- The GameMode actor (server only)
- Any actors further added via
AGameMode::GetSeamlessTravelActorList - All Controllers that have a valid
PlayerState (server only) - All PlayerControllers (server only)
- All local PlayerControllers (server
and client)
PlayerStates are not replicated anymore! I can’t get the PlayerStates on my clients!
Im trying right now to use PostSeamlessTravel function calling for each player controller, functions that maybe can solve this issue but by now, with any good result. Also I used SwapController to get my custom Controller working.
void AConceptGameMode::PostSeamlessTravel(){
Super::PostSeamlessTravel();
for (TActorIterator<APlayerController> ActorItr(GetWorld()); ActorItr; ++ActorItr) {
AConceptPlayerController* CPC = Cast<AConceptPlayerController>(*ActorItr);
if (!CPC){
AConceptPlayerController* NewPlayerController = Cast<AConceptPlayerController>(SpawnPlayerController(ROLE_Authority, FVector(0, 0, 0), FRotator(0, 0, 0)));
SwapPlayerControllers(*ActorItr, NewPlayerController);
//AController* Controller = *ActorItr;
//HandleSeamlessTravelPlayer(Controller);
//FActorSpawnParameters SpawnParams;
//SpawnParams.Owner = NewPlayerController;
//APlayerState* NewPlayerState = GetWorld()->SpawnActor<APlayerState>(NewPlayerController->PlayerState->GetClass(), FVector(0, 0, 0), FRotator(0, 0, 0), SpawnParams);
//NewPlayerState->ForceNetUpdate();
//NewPlayerState->ForceNetRelevant();
//NewPlayerState->ClientInitialize(NewPlayerController);
//NewPlayerController->PlayerState->CopyProperties(NewPlayerState);
//NewPlayerController->PlayerState->Destroy();
//NewPlayerController->PlayerState = NewPlayerState;
PostLogin(NewPlayerController);
}
}
}
Anyone knows how to replicate to the clients all PlayerStates instances associated to the PlayersControllers after a Seamless Travel?
THANKS!