We want to create a 2D Multiplayer survival game. The map should be a little bit like terraria, just in topdown perspective. You can dig every Block and set your own Blocks.
I have worked some time with PUN (Photon Unity Networking), but I think we can’t use that in this case, because then every block of the game had to have a “Photon View Component”, and this would be very laggy.
Also we must be able to save the map, and play later on it.
Does anybody have some tips, what other tools we could use?
Not familiar with PUN or networking platform, but instead of synchronizing every block you could just say to every client “[Action] to block on [That position]”. For example “Destroy Bloc at position (140, 10, 5)” and then every client will check on that position and destroy the block there.
The risk here is that the map will not be really synchronized between clients so you have to be sure that they have the same map.
And to save the map, i already tried something close to that, and i had two solutions (maybe not the best and the most optimized tho)
You can write in a file position and nature of every block
dirt block (0,0,0) |
dirt block (1,0,0) |
or maybe by group ? (didn’t tried that)
dirt blocks from (0,0,0) to (1500,0,0) |
dirt block from (0,-1,0) to (1500,-1,0) |
or in an image file (every pixel means a block, and the nature of the block is set with the pixel’s color). In that way you even have a preview of the map directly in the windows explorer.
Anyways those are just ideas. I’ve already test these methods but my maps were a lot smaller.
keep me informed
Thanks for your answer! Yeah we will try to use a 2-dimensional array for storing the map. We use an enum to identify each block. So we only send integers over the network, when someone changes the map. The visual stuff will only happen on the client then. (For example: player placed block; destroyed block)
I tell you when this is working