I am making a troop system where the player can pick multiple troops to form a formation and move them around. I now want to visualize the “waypoints” (you can give them mutliple waypoints, they will go to the first, then the second, …) for the player using beams. My problem is that I need to send the data from the current formation position and all the next waypoints to the client every frame.
It would kill performance when I fire a remote event every frame (twice, possibly for multiple clients), wouldn’t it?
A solution I figured out was to save the troops waypoints in a module script, save the data there and use it for client and server, but I think it wouldn’t work and if it would, cheater could see the enemy waypoints.
Things like these should generally be done on the client.
Since you are sending the waypoint data from the client to the server every time the client makes a new waypoint, you may as well just keep track of the current path on the client and then use that.
Chickynoid, a server authoritative movement implementation fires (unreliable) remote events every frame on the client and that handles it just fine.
And I don’t think you need to send this every frame, you could do every 1/10 of a second and interpolate them or something similar… Or just do handle it on the client like the above answer
You can still have the server call FireClient (or FireAllClients) whenever a client makes a change to the path and send the change (or if that’s too complicated, all the waypoints) to all the clients. And if there can be conflicting changes, such as two players trying to modify the same path at the same time, you may want to rely on what the server sends out to all clients, even with the changes that the local client makes in case of a conflict.