Networking the Player


Author: Adam Stagg


Problem

The player is currently working with movement and animations, however it is not synchronized over the network. Multiple clients can all see their own animations, however over the network, nothing is synced. Given that this is a peer to peer solution, there will be a "server" as in the hosting player. All events and actions relating to the player should be synchronized with the host, and the host will relay this information to the clients (up to 5). The game is going to be hack and slash, and very fast paced, so animations being in time and position being real-time is critical. 


Solution

After doing a lot of research into Unreal's built in networking systems, I have discovered a fix for the player animations. Because all animations will last until the end, send a network call saying that player X has done this animation, which will be executed on all clients after that. This is done via a multicast RPC. There is a caveat with this, however. Multicast RPCs only execute on the client if run by a client, but execute on server and all clients if run by the server. The simple fix for this was to make the animation event a server RPC, to force it to run on the server, then by calling the multicast RPC. This will then propagate to all clients afterwards, and all the animations will be synced. 

Leave a comment

Log in with itch.io to leave a comment.