Download

How to correctly spawn a pawn in a networked game?

I have started from scratch with my own Pawn class and my own MovementComponent. Nothing is networked so far but I have a NetworkPlayerStart. When I choose a listen-server with 3 instances the pawn on the server seems to spawn at 0, 0, 0 and doesn’t receive any input, while the clients can move around. The 3 pawns all spawn at the correct location, it just happens that I just can not control the pawn on the server and the position is wrong at least from the perspective of the pawn that spawned on the server.

I am wondering why this happens? Could it be possible that the server failed to posses the Pawn?

Also if I create a dedicated server with 5 instances for example only 1 Pawn doesn’t receive any input, the other 4 Pawn’s are behaving as intended.

So I am wondering if there is anything special that I need to do so that I can safely spawn pawns in a networked game?

The GameMode handles the spawning of Pawns and tells the Player Controllers what to possess, just set the Pawn you want to use in the Gamemode, provided you want them all to use the same class of pawn.

The only thing I have done is



static ConstructorHelpers::FClassFinder<APawn> PlayerPawnClassFinder(TEXT("/Game/FirstPerson/Blueprints/MyPawn"));
DefaultPawnClass = PlayerPawnClassFinder.Class;


Could it be possible that the problem is that N Pawns are spawning simultaneously at the same spawn point? Are there docs somewhere that could help me?

Solved:

I had auto posses player activated in the blueprint pawn. Disabling it solved the issue.