Networking Unlocked. Time to Optimise.
- Roland Thomas

- Oct 23, 2023
- 2 min read
Updated: May 2, 2024
The day after I implemented replication, it was time to apply it to some of the other features I had implemented. To start with, I found a surprising issue, regarding character flight.
Unreal's character movement (CM) component that comes attached to playable character classes is replicated out of the box, so that things like a player walking around can be replicated straight away. This worked fine, however I found that one aspect of the CM that was not replicating was when a player switched into flight mode. If initiated on the owning client, the character would be flying, however from the opposing view it would look as though the player was still walking around. I created an RPC to Set the Walk/Fly modes on the server first, before setting it on the owning client. This quickly solved that issue.

Doing this, I learned that not all variables used to calculate what an action need to replicated, but just the stuff others need to see or know, in this case the 'play animation' nodes, with the number of which animation fed into it. I am aware, directly passing a value into an RPC can lead to cheating, however as it's just the basic attack animation, it should be fine for now.
Next, I saw that the basic attack combo I put it wasn't being replicated either. A similar fix solved that.


I found that a bug was occurring that led the client's Hope/Despair values to not sync correctly with the host's. After a while of searching for the problem, I realised that the reason for this is because of the fact the client was spawning in after the server had initialised them, so the client sees the Paradigm points as 0. After I input my debug command to increment one of the paradigms, it then updates the Client, however it still wasn't getting the up-to-date values from the server.


I then found that the clients were getting updated twice. Trying to find out why, I eventually realised that it was technically multicasting twice. Once, when the Add(Paradigm) event started, and again when the Update{Paradigm) event was called as a result. By changing the UpdateAllParadigms event to replicate on the owning client, so each client is updated only once.




After this, I Created a new starting Level with some basic blocks to stand in as Sapphire City buildings.


Comments