Challenge Explanation

What happens?

  • The cube moves only on the client, and remains static on the server.
  • If the client attempts to jump on their version of the cube, it glitches in the same fashion as when the cube was only moving on the server. The server window shows the client smoothly falling, instead of glitching.
  • If the client attempts to enter the physical space where the cube exists on the server, they are blocked.
  • If the client jumps onto the server’s version of the cube, they are teleported onto the client’s version of the cube (which by this stage had gone through the wall). However the server shows them as being on top of the server’s version of the cube. (Sidenote: Could actually make an interesting game mechanic?)

Explanation

  • Server has authority, and so its word on the cube’s location is law. So, when the client is reporting the cube’s updated location each from, the server is disagreeing with the change and passing back the location of the cube on the server. This explains why the client can’t move into the space where the cube is. As for why the server is choosing not to replicate the changes reported by the client, I’m not sure…
  • As for why the cube continues to move on the client, this is presumably because the client is choosing to use its locally stored transform to position the visual representation of the cube.
  • As for the teleporting when jumping onto the invisible ‘server cube’, I think it’s trying to resolve a location with a collision: The server is telling the client that the pawn’s location is elevated, on top of the server cube. So in theory, the pawn on the client should appear in the same space on top of the invisible ‘server cube’. But collision data is presumably also being passed to the client from the server, telling the client that the pawn is on top of the cube, so the client positions the pawn on top of its cube?

Conclusion

The cube’s location is not being replicated, despite the fact that we’ve told it to replicate, and replicate movement. This is presumably because we need to tell the individual properties that we want to replicate, to replicate (having seen that there is a ‘Replication’ specifier for UPROPERTY)

1 Like

Just realised that it’s not replicating because SetReplicates(true) and SetReplicateMovement(true) are only called on the server instance. So the client cube’s location is not actually set to replicate.

Very well thought out and well explained answer!

1 Like

Privacy & Terms