Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

For 2-3 years I've been interested into MMO development. I'm browsing some emulators source codes and open source projects.

Usually I'm checking how the game server stores data about the 2D map. There are 2 popular solutions:

  • map is stored only on the server it's sent to the client in parts (eq. tiles like in OpenTibia https://github.com/opentibia/server)
  • map is stored in the client and on the server, server sends only coordinates and client got knowedgle of it.

I'm generally interested in this first attitude, do you know any good and bad aspects of it?

How to store this structure on the server? In memory on in database? Open Tibia uses memory storage but there is one drawback: 2000x2000x16 map uses a lot of memory - something around 2GB. Is this because of bad design? Are you able to provide me some examples of good design?

share|improve this question
    
Look here for some efficiency tips, gamedev.stackexchange.com/questions/54894/…. For the size map you have 2gb is a lot. More than 30 bytes per tile is pretty excessive. It's bad design if it's more than you need. For example, if you only needed 6 bytes per tile, you could get down to less than 500mb. –  Byte56 May 3 '13 at 11:35
1  
Map is stored on both client and server, client has information about how to draw it and server about collisions and stuff. If map doesnt change as part of gameplay, i dont see any reason why client wouldnt have that informaiton on them. And for managing such big map on server - divide it into sectors and in memory tou only have sectors that have online players inside (Ultima Online does this - and wow kind of too) –  Kikaimaru May 3 '13 at 12:42
    
@Kikaimaru, you wrote about such mechanism in UO and WoW, could someone describe it a bit more? –  mickula May 3 '13 at 14:02
1  
@mickula You can look at RunUO emulator. But its nothing complex - you divide map into smaller chunks (sectors) like 100x100x16 and load these chunks from your file into memory when some player approaches them. –  Kikaimaru May 3 '13 at 14:39

1 Answer 1

"Map is stored only on the server it's sent to the client in parts":

  • Pros
    • Client always has most up-to-date map
    • Can keep map data hidden until the user has visited the area
    • System already in place for pushing expanded or updated map data
  • Cons
    • Client has to always download map data even if it's un-changed and they've been there before
    • Due to the above, server bandwidth is always taxed. This increases costs significantly over the lifetime of the game.

"map is stored in the client and on the server, server sends only coordinates and client got knowedgle of it":

Pros and cons are essentially the opposite of the above.

I'd suggest a hybrid of the two systems. The client can download the game, with the map data. When they enter a new area, the client asks if there is a newer version of the map data. If so, download the latest data from the server, otherwise use the local version.

I assume when you say "store in memory" you actually mean some kind of custom flat file format on disk. If you only stored it in memory, you'd lose it as soon as the server restarted. So, using your own format or a database is up to you. It depends on how you want to access your data and the requirements of your game. If you know well the pros/cons of each, paired with the requirements of your game, you'll know which one to choose.

share|improve this answer
    
Thank you for your awesome reply. According to 'store in memory' I was thinking more about mechanisms that would help me solve memory efficiency problems - map is stored in the binary file, loaded to memory when the server starts but it's whole in memory for all the time server is running. What are other approaches? @Kikaimaru wrote about such mechanism in UO and WoW, could someone describe it a bit more? –  mickula May 3 '13 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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