Thursday, March 21, 2013

Changing the mapping plan... Again

So, I've been basing the map on the idea that the server produces and manages the terrain, and then sends updates to the client.  However, someone gave me a great alternative and I'm going to use it.  (Yes, this means more reprogramming in this area.


  • Maps are unique for each player
  • The client and the server are aware of the same map data
  • Must keep bandwidth usage low.
  • The terrain can and will change both in height and in texture.
In my system, a 1000x1000 grid is still around 52 megs uncompressed.  Or 5 megs compressed, but requires heavier processing to load into memory/save again.

The new system will instead use a seed number, like Minecraft's mapping system.  Both the client and server have the same starting seed.  To begin with, I'll just use the players Id as the random seed, since it will be unique to each player, and that is already a critical piece of knowledge for nearly all other communications in the game.

The next issue, is making sure the map generating methods are fast and lightweight.  On the client, it will be passed onto a work thread.  But the server doesn't have that luxury.  The server will not hold data in memory, but at points it needs to process it, it will generate this data on the fly.  Fortunately, the server won't need to know it often.  Also, I'll split the Height Map processing and the terrain type processing, as those won't be needed at the same time in most cases.

The only detail needed on top of that, will be alterations, either from players placing things like roads, which changes the terrain textures, or placing buildings, which will level out the height map for a particular area.  These alterations are the only data that needs to be transferred then, and that is small enough/varied enough it will value from sitting in the database.

So, again, this is taking more time, but I've never built a City Builder before, or more particularly an RTS, that the game trio will be.  I've been wanting to, but held off until now, with Unity.

Texture systems will also change, but I'll save that for another blog, once I get to it.

No comments:

Post a Comment