best practice for spawning and possessing with seemless travel?

So I’m a little lost on what to do here.
So I have seamless travel enabled and I use the same player controller in both the lobby level and the next level which means that it carries over the same PC, but that means it won’t trigger the PC’s begin play. And I use the PC’s begin play to start the spawning logic. So what do I do now?

Hey @Hero_Tales!

One thing you could do is have a custom event lead into the same nodes, and upon travel completion call that event.

Like so! :slight_smile:
image

Controller class :: Event on Possess

Note that this event only exists on the server. You can use it to run a delay then call the client controller.

1 Like

Forgot to note my personal preference is to set the GM’s “Default Pawn Class” to a loading pawn. This pawn class is bare bones, no movement. It’s job is to apply a loading screen UI and determine when the client has sufficiently loaded the level. My levels are large open world landscapes with a lot of buildings, foliage and interactive actors.

Upon level loaded it calls the controller which calls a server-side controller event that has the GM spawn/replace the default pawn with the actual pawn for the specific mode. This is also a great setup for handling character customization… e.g. modular characters.

On spawn of the actual character, a customization struct (rep_notify) can be set.

2 Likes

thanks for sharing that’s a very interersting method

Thanks for sharing that’s an interesting method.
What you think about this, I made an interface function which triggers at the end of level BP begin play, is it kind of like yours? Well I guess yours may be better as the pawn spawns after everything else

Yeah, I prefer this method because I don’t have to either modify game mode default spawning functionality (overwrite) or bloat my character with client-side spawning behaviors.

e.g. disabled movement, no gravity etc.

1 Like

Loading Pawn

Controller

Game mode

Game mode spawning function

1 Like

Although I mentioned in your other question that you can keep the PlayerController from the previous Level I would not recommend it.

You can transfer the things you need between the PlayerControllers using the GameMode Event OnSwapPlayerControllers in the destination GameMode.

You should also consider using the PlayerState for replicating things. To transfer properties between PlayerStates you can use Event CopyProperties from the PlayerState that you are leaving.

The bulk of the replicated data I would keep in a separate replicated Actor added to the SeamlessTravelActorList however this would require some C++.

3 Likes

I thought they delete the previous player controller, do they still keep it and you can grab variables from there?
Also your method keep everything on the player state is interesting.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.