Download

problem: respawn possession in simulated multiplayer networking

Hey all. Lets start off with a confession - i’m not 100% comfortable with networking in blueprints :stuck_out_tongue: This may well be a simple one for those cleverer than me :slight_smile:

So, here’s the problem - i’m trying to possess a new pawn after uncolliding/hiding the old one. When i do, it always seems to change the possession of the OTHER window (i’m simulating a client and a server in 2 windows) not the one that just died. I kill from the server, suddenly i control the client. Kill from the client, suddenly i control the server. I’m confused, because printing out the name of the controller’s possessed pawn always seems to be the right one. Its like the possess node isnt working somehow, or i’m feeding it the wrong controller…

Here’s the damage function for when the pawn gets hit:

Capture.PNG
the sent event at the end executes on server.

It calls this event on the character pawn:
Capture1.PNG
the end event is sent to the controller, on the server.

This is the controller script:
600de37a8af30cbca80c60a26ac6f102f10758da.png
Again, end event on server.

And the final sequence, on the game mode:
dd08571e82e398a393cb74083aaa86e438210bb8.png
I take the controller, spawn an new pawn and possess it.

Help would be greatly appreciated and eternal love given for preventing my grey hairs.

Cheers,
Russ

600de37a8af30cbca80c60a26ac6f102f10758da.png

Your passing Self as the controller. Which in this case, since your event is executed on the Server, self will always be the server.

Self will be the Server Version of the Clients Controller.

Remove the logic from the GameMode. Let the Respawn happen in the Controller.

Also: Once you called an RPC from client to server, you can work with normal events.
You are calling Client->Server RPCs although you are already on the server.

Event your “OnTakeDamage” event should be on the server, since you are changing a replicated
variable. So if this is not running on the server, no one, despite the client, will notice the damage
event. So why needing an RPC (“Respawn” event for example), if you are already on the server?
You could use a switch has authority, so that the client won’t call this anyway, instead of using
multiple RPCs.

And if you leave the even in the Controller, instead of passing it to the GameMode, you don’t
need to pass any controller.