cannot do Blueprint Multiplayer spawn and possess

Hello all, I am having problems with letting clients possess pawns with blueprint…
In fact, I’m trying to mock up World of Warships…

I look through multiplayer live training’s sample, its procedure is like this: set up a sever-run spawn event (lets say it’s called “customeventS”), which leads to spawn pawn blueprints, and let different client’s player controller posses a pawn.

In the player controller blueprint, pass its controller instance as controller id to the “customeventS”. (In this case it is called Respawn Player Event)

Therefore, if we run 2 clients instance on a computer, each client will trigger the "“customeventS” so they can possess a pawn.
So this is how I set up for my controller and game mode.
Put four player start in to the scene

In the player controller bp, cast to the custom game mode, and call its server only function

In the custom game mode, create the custom server only event, and pass the controller ID to the possess function…

But when I hit play, it’s like this…

Only spawn a default camera at the default position…

It has the warnings in the log, but I do not understand what do they mean.

In single player, it is like this…

I just set the auto possess then it go through it well, but not in multiplayer…

Am I missing something here? It’s so frustrating…

I might messed up the logic.
So when each game instance launched,each client controller will call the get all player start class and spawn and possess four times, and the event play also calls the spawn all player event.

So I should get rid of the call spawn all player event after the event begin play?

And then how do I let the client controller choose a player start based on its controller index?

But even after I correct this, the problem still occurs…This time the warning info changes.

Found more clues.
The two game instance said their controller index is "-1

First you need to have a clear picture of where the classes exist.

A GameMode class only exist on the server so if a client try to use GetGameMode nothing is returned.

A PlayerController only exist on the server and on the client that owns the PlayerController. When a client uses GetPlayerController it will get its own PlayerController. The same is true for a Listen Server.

A Replicated Pawn exist everywhere.

Now you need to understand if your flow graph flow is currently running server-side or client-side. Eg. if you try to call a GameMode RunOnServer event from a PlayerController client-side it will fail.
The GameMode class should not have any RunOnServer events even though some tutorials use this. It is confusing and redundant since it is ONLY the server who can ever call events in the GameMode.

Client-side in the PlayerController the client first makes a RunOnServer event on the PlayerController to move Server-side. Now the Server can access the GameMode functions. Possess is a server function so when it is done the client should be updated as needed.

ps. You should always GetPlayerController at index 0 when doing multiplayer online or LAN. The other indices are only used when having several players on the same computer.

Hello Garner,
thanks for the reply.
I tried to read more tutorials and follow the live training video, and I found that client could get game mode.

I use a new method to spawn players into new positions, it let the client spawn, however, the client player experience very buggy movement (maybe the client is not even controlling the pawn)

Print String messages in the editor is shown in all windows with a prefix of who actually called the Print String. As you can see it is prefixed with “Server” not “Client1”. The GameMode definitely doesn’t exist by default on any clients.

Confirmed…Indeed, the client controller cannot get game mode.
So the remaining problem is client cannot see server and other client player, and the client is always shaking
I think the problem is that the authority machine does not that approve so the client pawn’s position is set between authority default value and client local value…
But looks like it cannot explain why client cannot see the server player and other clients…

Your question is about possessing pawns during gameplay as I understand but since you are using PostLogin I can give you a tip on how to manipulate what pawn is spawned on Login.

This is a rough overview of the order that GameModeBase handles a new player logging in and spawning its Pawn.
The blue colored text is where you can override the behavior through Blueprints.


  • Login

    • Creates a PlayerController for the player

    • Initializes the new player

      • Register PlayerID in PlayerState

      • Register the player in OnlineSession

  • PostLogin

  • HandleStartingNewPlayer

    • CanRestartPlayer?

    • RestartPlayer

      • FindPlayerStart

        • ChoosePlayerStart

      • RestartPlayerAtPlayerStart

        • GetDefaultPawnClassForController

        • SpawnDefaultPawnFor

          • SpawnDefaultPawnAtTransform

I suggest you disconnect your current PostLogin logic and simply override SpawnDefaultPawnClassForController.
Within this function GameModeBase provides a Pawn Class that the new player should spawn with. All you need to do is specify a Pawn Class and return it. You could make an array of possible Pawns and return a random array element or whatever you like.

If you don’t override this function it simply returns the GameModeBase DefaultPawnClass.

Hi Thanks for that.
That is much better solution for the choices for the player.