Seamless travel multiplayer Event Handle Starting New Player too fast

So 4 player multiplayer seamless travel from a session lobby to the game level correctly calls “Event Handle Starting New Player” for all 4 players; however, the event is happening faster than I can resolve this event.

Is there any way to slow down this event?

What is happening is the first player event completes and thus joins successfully. It has enough time??? Anyway, the 2nd player event starts; however, the event gets stomped by the 3rd player event starting. Then the 4th player event starts which stomped the 3rd player event. Since there are no more players, the 4th player event successfully completes.

Thoughts?

I’ve encountered this exactly. It seems the reference to the controller gets overridden before you can make a possession or player start from the reference because the next controller comes in on the same thread before the logic has time to finish the entire sequence.

It seems counterintuitive considering that should be the normal chain of events in my opinion when you try to use “FindPlayerStart”, but it fails on most of the controllers if not all of them, but the last. I’ve tried over riding the function with no luck.

I’ve worked around this by allowing the players enough time to log in and load the map and then get the player array from the game state and run a For Each Loop on each controller or player state and spawn them from a server event in the game state that. That event calls a server function in the player controller to the game mode to spawn a pawn and gives the appropriate controller reference to possess. I use an array of spawn transforms I’ve created. This way there is no controllers coming in messing up the sequence and they only get spawned when they are good and loaded in and the reference will be valid when calling the game mode.

I increment an index integer upwards to cycle through the spawn transforms in the array until it reaches the end of the number of spawn transforms at which point the spawn transforms will start back at zero. This works perfectly for me.

1 Like

I reworked the logic and removed a 0.2 sec delay block in this event and that seemed to make my code work.

1 Like

Wow!

I have to think about that.

Glad to know that this works.

Thanks for the reply!

I tried delays myself, but it just seems to give me trouble using them over network events. I’m spawning 24+ controllers so that may be a little more fragile in that respect, but I’m glad you got it worked out!

Actually, I removed delays.

I called another event to perform some logic of which I added a delay for 0.2 sec in “Event Handle Starting New Player” to wait for that other event to complete. I realized that this other event could be a function and I made it a function instead of an event such that I didn’t have to do the delay. That seems to have solved my issue.

Thus, my current theory is that “Event Handle Starting New Player” cannot have delays given multiplayer games and seamless travel.

Lastly, I cannot image 24+ player controllers. Currently hard enough just trying to debug 4…

2 Likes

Yes any delay connected to the post login or event handle starting new player or such will certainly fail at some point lol. That split second delay where the controller is in limbo is make or break I found out. I’m always on the look out for more efficient ways to handle this stuff but there isn’t much room in that aspect

2 Likes

yes, generally, you should do things via events rather than delays.

so, say you have an int variable X that equals 0, and event A, and it does

Increment Local Var X (x = x + 1) → delay 5.0 → spawn and possess pawn → print x

if you call that 4 times in one second, what will the output be?

it should be 4 4 4 4

I would have to try it. I claim I was experiencing an answer with only one print statement after the delay which only happened after the last event was called at t = 9 seconds…

yeah, i’m not feeling 100% confident on whether that would end up having the delay side called 4 times, or if the later call would overwrite the existing delay. I don’t think there’s multiple instances of the events that can be in flight, per actor, but i’m not positive on that. I’ve never actualyl tried that. In any case, the output would be either 4 or 4 4 4 4. Both are not what you’re expecting on the other side of the delay node.

OK. Given UE4.26 and Blueprints…

The answer is at the end.

Interesting is that it appears that the first instant of TestX is the only one that ran since the only answer is 5 seconds after the initial event call… …I didn’t expect that…

[2022.09.21-21.22.11:113][985]LogBlueprintUserMessages: [GamePlayerController_C_0] Server: GPC->K: Beginning…
components for /Game/Maps/Level1/UEDPIE_0_Village2 took (less than) 176.66 ms
[2022.09.21-21.22.13:465][ 26]LogBlueprintUserMessages: [MorakMasterShopkeeperAi2] Server: MorakMasterShopkeeperAi->ServerInitializeAi : ending…
[2022.09.21-21.22.13:466][ 26]LogStreaming: Display: UWorld::AddToWorld: routing Initialize on actors for /Game/Maps/Level1/UEDPIE_0_Village2 took (less than) 206.82 ms
[2022.09.21-21.22.13:628][ 28]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: MyGameStateBase->MulticastLoadStreamingLevel:LevelName=/Game/Maps/Level1/PathCave3Village2
[2022.09.21-21.22.13:724][ 30]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.13:726][ 30]LogLevel: ActivateLevel /Game/Maps/Level1/slice/UEDPIE_0_slice_X2_Y3 1 1 0
[2022.09.21-21.22.13:729][ 30]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.14:460][ 45]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: MyGameStateBase->MulticastLoadStreamingLevel:LevelName=/Game/Maps/Level1/PathCave3Village2
[2022.09.21-21.22.16:081][ 79]LogBlueprintUserMessages: [GamePlayerController_C_0] Server: GPC->TextX; X = 4
[2022.09.21-21.22.18:716][130]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.18:718][130]LogLevel: ActivateLevel /Game/Maps/Level1/slice/UEDPIE_0_slice_X1_Y3 1 1 0
[2022.09.21-21.22.18:719][130]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.18:895][133]LogStreaming: Display: UWorld::AddToWorld: updating components for /Game/Maps/Level1/slice/UEDPIE_0_slice_X1_Y3 took (less than) 42.19 ms
[2022.09.21-21.22.18:996][136]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: MyGameStateBase->MulticastLoadStreamingLevel:LevelName=/Game/Maps/Level1/PathCave3Village2
[2022.09.21-21.22.23:535][237]LogSlate: Took 0.000827 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/DroidSansMono.ttf’ (77K)
[2022.09.21-21.22.23:895][245]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.23:897][245]LogLevel: ActivateLevel /Game/Maps/Level1/UEDPIE_0_PathCave3Village2 1 1 0
[2022.09.21-21.22.23:898][245]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.24:162][251]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: MyGameStateBase->MulticastLoadStreamingLevel:LevelName=/Game/Maps/Level1/PathCave3Village2
[2022.09.21-21.22.28:911][356]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.28:915][356]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.33:918][468]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.33:922][468]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.38:920][571]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.38:923][571]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.43:938][663]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.43:941][663]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.45:099][688]LogBlueprintUserMessages: [GamePlayerController_C_0] Server: GPC->K: Beginning…
[2022.09.21-21.22.48:934][770]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Start…
[2022.09.21-21.22.48:939][770]LogBlueprintUserMessages: [MyGameStateBase_C_0] Server: CheckEachPlayer: Finished…
[2022.09.21-21.22.50:054][794]LogBlueprintUserMessages: [GamePlayerController_C_0] Server: GPC->TextX; X = 4

1 Like