Problems of Client Replication
Author: Jairo Manon
During this week, I had to deal with the connection between the host and the client. As the host has an Authoritative role into the game, it's easy for to do actions such as moving his character and spawning things in the world. This allows him to easily replicate any changes because for any change that happens in the server, it updates that new state to the client. However, I didn't take into account how difficult is it to make the client be able to perform it's own actions as well. Even the world state of the client changes, if it didn't happen in the server then the actors that were spawned by client will be ignored.
In order to fix this, I had to explore the web on ways that the client can talk to the server and ask to accomplish a certain action. Throughout my searching I remembered an important part of how replication thoroughly works (Replication | Spawning Items - Unreal Engine Tutorial - YouTube). Replication can only be done when a state in the server changes. Thus, I was able to fix the problem the 2nd player couldn't move their player or spawn actors by asking the server to spawn, and move the actors for me. As a team we acknowledge that this might be concurrent problem we'll have to face if we code in a way that we disregard the replication of the client. So, through creating events that would only run on the server, and making sure that objects and variables are replicated accordingly as a team; the game will work as intended.
However, I just wanted to note that the solution for networking as it is is not enough. To optimize and better the connection between the two players, there needs to be a TCP connection so that the client can properly communicate with the host.
Comments
Post a Comment