I’ve been experimenting with ServerTravel lately and I can’t seem to find consistent behavior with my blueprint scripts after server traveling for either the server or client. I’ve been able to find very little sample documentation of servertravel so all of this might be a misunderstanding of it. I’ve tried many things and have learned a lot, but I’m officially stumped and reaching out for help now. I’ve seen many others post about this, but no answer seems to have been found.
The problem: I’m trying to find the proper way for a listen server to detect when a client has finished loading the new level after the servertravel is called. The listen server also needs to know when it has loaded the new level for themselves.
My situation: I have a listen server with a lobby taking in clients on a blank level like you’d expect of a lobby level. Once all clients and the listen server are ready to play the game, they travel to a new map and begin playing in the new map. The new level requires some logic in the gamemode to set it up such as spawning actors and the clients need to know when to load UMG with data on the other clients once the level has finished loading.
The ideal flow I’d like to implement is:
- Server travels to a new level from a lobby, carrying all clients with it.
- Server and client load the new map
- Some trigger occurs for the listen server AND clients (even if individually) that informs the server they have fully loaded the new map and are ready for play
- Once all clients are ready for play, the server tells all clients that the game is ready to begin and performs some spawning logic
- Once a client receives the ping that the game is ready, load UMG elements with data from other clients provided by the server
The issue is #3 with this “trigger”
Things I’ve tried but find inconsistent behavior when testing in packaged games (as servertravel currently doesn’t work with PIE):
- Client fires BeginPlay from levelblueprint
- Client fires BeginPlay or Tick from playercontroller or playerstate (since both are “respawned” during servertravel)
In all cases, the idea is that a client pings the server that they’ve “loaded” the level using a case above. The server collects which clients are ready with some data storage and fires off RPCs to each client once all are ready.
These cases don’t fire for the server player however which causes huge problems in determining if the new level is actually ready. This is because of something happening with servertravel. Even for the client, the RPC is inconsistently fired causing the server to think they’re ready before they actually are which makes the game “go” without them. When I say inconsistent, I mean it literally seems to randomly fire the “trigger” to inform the server they’re ready and sometimes it doesn’t from the server’s perspective.