How would I make this building system efficient?

I am working on a game with a continuous upward building mechanic where the block beneath you keeps extending up as long as your mouse is held on it.

Obviously, this has to replicate to all the other clients as well, so I was wondering, what is the best method for this, which is also efficient and is not affected by latency or other issues.

Method 1: Client mouse down, tells server → server begins upward building → when client mouse is up, tells server → server stops upward building

Method 2: Same as method 1, except in this case, the upward building is handled on client(s). The player’s mouse is down, starts building locally, and tells the server. Server tells other clients to show.

The problem with the second method is it is much easier to exploit, as a hacker can easily extend their own block and have it shown to everyone else. By using method 1, the system is more secure.

For lower-end devices, players might want to disable the setting to view other people’s blocks, so they will not lag as much. This setting value would need to be checked when firing the RemoteEvent to all clients through Method 2. This is impossible with Method 1, as the server updates clients automatically.

It’s a though one, ultimately you’ll need to decide which solution has the least impactful cons.

The main issue I can see with sending “up” and “down” events is delay. If a user has terrible ping, then the block might not stop growing until way later than intended.

A good way to go about (relatively) resource intensive stuff is “trust but verify”. You can allow the user to handle the building and send the size over from time to time, but the server should verify that it is a reasonable size change.


See the problem with that is there is another “machine” in the game which is destroying the block so the height of the block is actively decreasing. So, sending the data from time to time wouldn’t work.

In that case I’m not sure.
You could make the clients account for said machine, either by directly knowing about it or through remote events transferring relevant information.

I would still try to stay away from “up” and “down” events if possible, but ultimately it is up to you.

1 Like

I have to. That’s the whole idea of the game.

Do you have to send information? Yes.
Does it have necessarily have to be size or up/down? Probably not.

But getting started is important, so I advice you to start with what you can. If you decide to go with any of the suggested methods so far I’d advice you to make it easily changeable in the event you find a better solution.

1 Like