2
\$\begingroup\$

I am planning a tile based MMO, like Tibia or top down Minecraft. I'm using a client-server model. I've got almost everything figured out, with a notable exception of state updates.

When information about a tile changes (e.g. new item is added) all clients that see this tile need to be informed about it. How do I efficiently decide which clients needs to receive this update? I'd like to support on the order of 100 000s of tiles and 100s of players.

\$\endgroup\$
4
\$\begingroup\$

Divide your game world into rectangular chunks which are about half the size of the players screen. Keep track of which players are in which chunk. You can easily do that in the code which handles player movement.

When a tile changes, inform only those players which are in this or in an adjacent chunk.

When a player moves to a new chunk, give them an update of the complete state of the newly adjacent chunks.

\$\endgroup\$

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.