Multiplayer - Spawning Players after they Ready Up

Hi all,

This is my first foray into multiplayer and it’s been tough. Right now, I’ve got code for players to join my session and then when the host says so, the game starts, everyone loads into the new level.

This is all fine, everyone loads in and is faced with the character selection screen where they are required to ready up. Once a player ready’s up, I check if all players are ready, and when they are all ready, I fire an event dispatcher that my game mode picks up.

At this point, the game mode iterates through each player controller and attempts to spawn+possess tanks but the tank only loads for the server instance. I’ve got replication enabled on the class bp and I’m calling the spawn+possess from my player controller to the game mode with a server call. Just to be clear, the clients see the tank that spawned for the server, but no tank spawns for the clients.

This is the Player Controller BP where I call PossessTanks

Anyone have any suggestions on how to make the clients spawn a tank for them to possess?

Thanks!

If you call PossessTankson the server (from GameMode), then IsLocalPlayerControllerwill return false for client player controllers (therefore, SVR_SpawnTanksNow executes only for the server).

Thank you for the feedback. I thought I wanted it to only run on the server because only the server can issue a possess command?

GameMode exists only on the server.
If PossessTanks gets called from GameMode, it’s already the server side. Try removing IsLocalPlayerController branch.

Thanks, I managed to get the tanks to spawn for each user, but now they’re not possessing properly and the output logs are constantly throwing a warning every tick:

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_TANK_V3_C_1. Function ServerUpdateState will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_TANK_V3_C_2. Function ServerUpdateState will not be processed.

After debugging with Claude, it’s saying this is a bug with Unreal Engine…I’m not so sure.

You are running this in a Listen Server setup.

Host is the server… a player (is locally controlled [true]) and the Server.
Host, being the server, is the only proxy that has a copy of the Game Mode.

Clients cannot RPC the Game mode directly. They have to RPC up to the servers copy of controller, then call the GM.

Possession events should always take place in the GM.


Clients connect and get a default pawn (GM does this automatically).

Choose a character. From Controller RPC the selection to the Server Copy of the controller.
Have the Server Controller pass the selection to the GM which then processes the task.

GM will need a reference to the controller.

Spawn new character, Using Controller ref → Get Pawn, Unpossess → Possess new character.
Destroy old pawn.

This issue ended up being some sort of corruption with the Tank BP. I stripped the existing blueprint down to literally no components and it would still throw the error in the output log.

The solution, for me, was to recreate the troublesome blueprint from scratch. Once I did that, I stopped getting the warning.