I have an application (First Person Shooter) that works fine when it is played by one player. But when I played it with multiplayer, with dedicated server running, every client worked fine except client1. It showed nothing on the display. When I tried to find the problem, I found that the Pawn in Client1 is invalid (with the help of PrintString). Can anyone help me?
Tbh, without some more details / screenshots of the issue itself, configuration etc its a bit difficult to help you in that regard.
Did you set up replication? Are you sure you set up a dedicated server or was it a listen server (which also acts as the first client)?
Thanks for your response
This is the Game Mode Override
And this is Replication option of my FirstPersonCharacter
It showed the same result even I checked the Replicates, Replicate Movement, and Net Load on Client
NB: Im pretty sure the dedicated server is running. I played it in the UE Editor
So, you would need to set the 3 replication options, otherwise the networking is “guaranteed” to not work.
When you did that, we need to see why your pawn on one client is invalid; There are a few possibilities for that.
In your PlayerController, are you doing any Multicast Custom Events that replicate to all clients? (This would usually explain the behaviour you are seeing, since the PlayerController only exists on the server and the owning client, and you would run into issues when replicating multicast messages to all clients then).
If that is not the case, are you using a “Get Player Pawn” node in your Blueprints? Since (afaik) this wont always get the current local player, but just the one with the id “0” and may lead to problems too.
Cheers,
I did set all possible combination of the 3 replication option. But it always show the same result.
I am doing nothing in my PlayerController (EditorController) and GameMode (EditorMode).
Yes, I am using Get Player Pawn node (with id=0) in my Blueprint. Thats the only node that distinguish between client1 and the other clients. I tried using GetPlayerCharacter, GetPlayerController->GetControlledPawn, it showed the same result in all clients. Since only client1 that is different from the others, I made a conclusion that it must be the Pawn that causes the problem.
I got a little confused with this. All the pawns are still valid on Event OnPostLogin. But client1’s pawn become invalid in Level Blueprint
What happens is, that you always get the first Pawn (and it depends on network startup which one is the first). And at some point your player pawn gets a hickup with networking. You can read this for some more insight on this: https://answers.unrealengine.com/questions/357088/cant-get-pawn-controller-on-client-sidenetworking.html
The problem still hasnt resolved yet. But, thank you for your answer,
To somehow get to a solution. would it be possible to clear this project up as much as possible and send me a link to download it, so i can have a direct look? otherwise it will be hard to analyse any further.