I’ve been trying to sync my custom pawn data to all players across the network. Using the networking tutorials from Epic, I was only able to sync between one client and the server, but as soon as I added more clients, their data was not updated.
I’m pretty new to this, so after a lot of experiments I figured out that I can sync my custom data by by calling a Multicast from the server.
So basically in this case:
Player rotates/moves turret, sends this data to the Authority through an RPC (Run on server)
Server checks if this behavior through Has Authority
Server sends out data to all clients through a Multicast
I feel like I’m missing something or doing something completely wrong. I would love to hear your opinion!
Okay … the item you are rotating, is it set to replicate … sometimes you have to set its movement to replicate as well … not sure how you have set up the actor/pawn.
The turret is a subobject of a tank inside a Pawn blueprint. The movement of the tank is being replicated, but since the turret is a subobject, it is not automatically being synced across the clients.
In the mean time I’ve moved the MoveTurret function in step 1 to step 3. The turret’s rotation is now being set according to a replicated Vector3 variable.
I think that cheating would still have been possible the way I set it up in the first screenshot, correct?
Basically yes, because you are not checking if the client can move the turret. Typically in this scenario (or in the scenario for Kaboom Arena), the server checks whether the client actually has enough bombs to be able to throw a bomb.
In your scenario you aren’t really performing a check whether the client can move the turret … you are just handing the move off to the server that is then telling all the clients to do it.
There is nothing wrong with this way and it is the preferred way, but cheating will be possible because you have no way of checking whether the client can move the turret.
I hope I am making sense, because without understanding the full concept of your game … it is difficult to know whether this would actually ever be a problem. HTH.
Honestly there is no concept of the game, it is merely a project to familiarise myself with UE4. I just kind of switched from Unity and am liking this engine a whole lot better.
In this case, there is no need to check wether the user can move its turret, I’m just trying to grasp the concept of syncing movements across clients without having someone suddenly teleport to the other side of the map, for instance.
That is perfect then … the way you are doing it is what I understand as the preferred way of doing it for a true multi-player game … and is exactly the way I am doing it in my game. Good luck and feel free to shout if you need more help. 8-}