4
\$\begingroup\$

I am currently trying to get randomly generated maps work in multiplayer but I have so many difficulties trying to figure out how. How do other games implement this(Minecraft, Terraria, Don't starve)? My current solutions are as follows.

Generate the map client side and verify(Hash?)

This is the least bandwidth intense but the algorithm needs to be EXACTLY the same as the server side and it is the easiest to exploit.

Generate Server side and transfer to client

This method will ensure that the players all have the EXACT same map, but it it very resource intensive for the server and requires a lot of bandwidth and increased loading times.

\$\endgroup\$
6
\$\begingroup\$

It slightly depends on what kind of game you are making.

Generate Server side and transfer to client

If the player can make their own maps, or the map can be generated when a player is playing offline (but can later be shared online), then the best methods would be for the player to transfer the map to other players directly. I remember Warcraft 3 used a similar method, where every player that didn't have the map, would download it as soon as they join the room. I'm not sure though if it was done user to user, or with the server in-between.

It can also work to generate the map server side, and then give the data to all joining players. If the game is too large, then give a part of it to each player, similar to minecraft.

Generate the map client side and verify?

I find this idea really bad. However, it could potentially work, if the maps that the player make are very limited and can be replicated with success. I can't think of an example that this has worked, maybe it has, maybe its just not worth it. At the end of the day, most of the resources have to be on the client's machine for this to work, so the more options they have when making a map, the bigger the final executable game will be (but the less resources you will have to send with your server).

At the end of the day, you are only sending a few data that describe the new map, you are (most likely) not sending new assets as the new map is using assets that already exist in the client's game, so the resources sent by your server aren't that big. An html website is far bigger than that, and you can navigate to them almost instantly.

\$\endgroup\$
  • 1
    \$\begingroup\$ Don't forget the seed sharing method \$\endgroup\$ – Stephan Jun 19 '18 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.