Joining session playercontrollers all are -1
I am Hosting a listen server with 4 players splitscreen. I run another instance (build for win64) and join the first one as a client, also with 4 player splitscreen.
So now there is a server with 8 players, half of them belonging to the client, and half of them showing on the server's screen.
Everything is cool until i start the game in earnest (everyone is in the same map by this point), when I spawn and possess a pawn for each player.
The server's 4 players spawn and possess just fine. But the 4 client players seem teleported to a black void. I print out the player controller IDs of each player on the server side (which includes the connected client's players) and the printouts show 0, 1, 2, and 3 for the server players, but -1, -1, -1, and -1 for the client's players.
Is it normal for the remote player controllers to always be ID -1? I thought maybe the lack of valid player index was why they can't possess the pawn, but I dont know. I thought non-negative IDs would get automatically assigned but maybe that's not the case for remote players?
Maybe the problem is completely unrelated to the controller ID?
asked Jan 21 '18 at 09:24 PM in Blueprint Scripting
I found that the player controllers were being lost due to multiple RPC calls somehow. When I remove the Multicast to spawn some actors that are meant to follow the pawns around, then the loss of playercontrollers ceases, and everything is fine (except I don't get my little actors to generate on each machine locally).
I did some more work on my project and found some of the following to be facts, at least when using splitscreen and networking together:
These test results may differ if you're not using splitscreen with networking, but this is how it appears to work in that configuration.
You can create more than 4 players controlled by each machine if you modify the C++ code to allow it, but then it's up to you to figure out how to get splitscreen to handle it if you're using splitscreen, which means more C++ code modification.
answered Feb 20 '18 at 01:27 AM
PlayerControllers same as GameMode are not replicated aside of local players for security reasons, but player IDs specifically seems not replicate at all. PlayerStates same as GameState exist exactly for information replication about players for other players. Try making IDs on client side if you really need them, but generly you should not rely on PlayerControllers on client side or else you make single player (which really works liek server in such case)
Player IDs became more relevant just recently, before it was just order of found and didn't really been relevant, you can use different method of identifying players if what engine has to offer fails, you can always try fixing player IDs to with Set Player Controller ID
answered Feb 11 '18 at 12:44 AM
I have solved the problem.
answered Mar 09 '18 at 04:33 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here