Hi there. I’ve tested online multiplayer with 3 of my friends and only 1 was able to move properly. The 2 that didn’t work could not move or do any control input once they spawned as their character. The other one had no problems at all. What could be causing this? Any info regarding this is appreciated.
Hi,
Without more infos, I don’t have too much idea but you can start with that:
Do you implements you own PlayerController (and set it in the GameMode, via the Word Settings panel) ?
In a solo game, your Input can be handled in the Character, but as a best practice you should consider creating your PlayerController class to handle the input. Because the Characters will exist in every Clients, while the PlayerController will exist only on the Client which spawns it.
Basically, the Input Event in the PlayerController would just call a custom Event which replace the one existing in your Character.
Eg: if you have Character::InputAxis Lookup , replace it by a Custom Event LookUp ; and in YourPlayerController use the InputAxis LookUp and call GetControlledPawn => Cast To YourCharacter => LookUp.
Also, make sure to enable “Replicate Actor”, “Replicates movement” and other flags like that (it should be done by default).
Regardless, you should look at the docs about networking, especially if you are not sure about what you’re doing:
To make it short, UE4 relies on a strong Server: everything you want to happen on every Client MUST be sent by the Server.
So if a Client is doing something which should occur everywhere, be sure you call a Run On Server function, and from this one, call a Multicast function, which will run on every Client (including the one who called the Server first).
Finally, note that you can’t call Run On Server functions from anywhere:
Usually, this means you can only send "Run on server" events from the following actors, or from a component of one of the actors:
The client's PlayerController itself,
A Pawn that the client's PlayerController possesses, or
The client's PlayerState.
Hope this helps