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.

How can i send from server to client a large amount of tile data? Having chunks of almost 2MB of data seems prohibitive to send this information just like that. Minecraft compress each chunk and Terraria uses RLE, but im not sure if they send so much information.

share|improve this question
2  
Well the simple answer is... make your data smaller. Use the smallest data types and structure you need to send to the player, and only send as much data as they really need. –  Tetrad May 2 '13 at 19:16
    
It really depends on the scope of your game. If the loading occurs only once and then it is cached I don't think it will bother most players. If it is streaming like minecraft players are used to a little bit of popping but if not you can hide it behind an initial loading screen. –  NtscCobalt May 2 '13 at 20:39
add comment

2 Answers

There's a few strategies you can employ:

  1. Break the data into chunks. This allows you to only send what's needed by the client (as mentioned in Elviss's answer). This will also be useful to implement for many other aspects of the terrain.
  2. Use the organization of the data to your benefit. You don't need to have labels for all your data. The client should always be expecting the data in the same order, so it knows what the next bytes belong to. For example, the client should always expect two bytes for tile type, two bytes for lighting information and then two bytes for extra info. So it knows that after 6 bytes, it's time to move onto the next tile.
  3. Don't send position information, it should be implied in the tile order. Always send the tile information in chunks, one column at a time (or one row at a time). This allows your client to know the position of the next tile, without needing to read it from the byte stream. You send the starting position of the chunk, then the first tile is placed at the position. The client then knows the second tile will be placed at the chunk position plus one in the Y direction (if sending column per column).
share|improve this answer
add comment

You can divide your map into regions, generate them procedurally and send only the parameters of each of them to clients. For example, if there is a mountain somewhere on terrain that is being seen by player, you can send parameters of the mountain (like height, radius, angle of slopes etc.). This is a little bit tricky to manage (you will have to modify your terrain editor to allow creating terrain that can be generated procedurally), but will reduce the amount of data needed to generate the terrain on clients' machines.

share|improve this answer
add comment

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.