Multiplayer building&breaking system

Hey, so im working on a building&breaking system for my mmo game, and im trying to figure out the best way to destroy the same object instance for all clients. One way i can think of doing it is by giving each block on the scene a id to determinate which block a client broke, which would then be sent to all the others clients telling them that a block has been broken with that id. And my worlds are proceduraly generated and the worlds can generate containing well over 10.000 object(blocks) won’t think affect the game somehow having that many Id’s for each block?

This would in fact be the only way.

It could affect performance depending on how much data your syncing, yes. This is also why games like Terraria and minecraft are only syncing visible “chunks” of terrain at one time. The whole world isn’t rendered, only the part of the world with someone in it.

How you build out data chunk logic in your game will likely be a challenge as you’ll need to figure out how to chunk up your procedural generation (likely using a seed and rebuilding the locations as they come back into view, but the “how” on that is beyond me)

using the seed to rebuild wouldn’t work in my case (atleast i think so), every user created world is saved on firebase and loaded once someone visits it. It’s a MMO sandbox game and well in my case players can destory all the blocks that it generated and build structures of their own. I could thechnically destory blocks outside the screen and load them in once a player goes to a new area, but a issue with this would be that the blocks would load in way to slowely in fact i think the area would be empty for a second or so for you to load in the blocks from firebase.

I’ve though of another method i could use for players to destory blocks. The idea is once a block is broken, it’s hits variable is equal to 0, then a message is sent to the server at what position the block was broken, and when the message is recieved it created a “breaking” object on every clients screen in the position the player broke a block, and then i would have a event that checks for collision between the “breaking object” and a Block object group and destory the block.
In theory this should work but there are probably plenty of downsides i can’t see :person_shrugging:

That seems possible, you’ll still need an ID per block to transmit the status, but that way you’re only syncing a few blocks per player rather than 10k.

Generally, a simple ID variable is really insignificant compared to all the data objects can contain - texture & rendering data, posstion/angle/scale, behavior data… A simple number wont add any significant overhead.

Good point, never actually though of it that way.