0
\$\begingroup\$

Let's say we have a 2d map 500*500 tiles in size. And each tile is editable by players and has many states. So it's 250k tiles. The game is multiplayer online game.

What would be the best approach from a server database perspective? Store each tile as an object in db with coordinates? Or store them in chunks? Or any other way?

\$\endgroup\$
  • \$\begingroup\$ Why not store initial map seed and basically data that it was "randomly" generated with(instead of whole world each block), and also store only edited blocks? Like DB = { creationSeed: 123111, editedBlocks: {(0;1) = 1, (0;7) = 2, (123213123, 87336737) = 0... and so on ? \$\endgroup\$ – Nick Mar 26 at 7:37
  • \$\begingroup\$ Yes, storing only edited blocks is a better idea \$\endgroup\$ – lxknvlk Mar 26 at 10:08
  • \$\begingroup\$ Ask yourself this: will a player's game client ever ask the server about just one tile, at random, without wanting to know about the whole chunk it belongs to? \$\endgroup\$ – DMGregory Mar 26 at 10:50

Your Answer

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

Browse other questions tagged or ask your own question.