Generating Large Maps Using Libnoise (Limits?)

Started by
10 comments, last by Jungletoe 11 years, 7 months ago
I don't know much about libnoise, but if you use the same seed won't it always generate the same map? Because if it did, you could store the seed on the server, send it to the player (who then generates it) and then retrieve x, y, health and inventory. Would that work?
Advertisement

Something that might work would be a hybrid algorithm. The world is generated procedurally on-the-fly, but any changes or edits done to the world are stored as diffs, similar to the process of applying a patch to source code. A particular world chunk would be generated using the pre-determined seed, then the diff files would be checked and any relevant changes made before presenting the chunk to the player. That way, you don't have to store the whole world, just enough data to represent the changes made to it. To be even smarter about it, you could track the number of changes made to a given chunk, and once it reaches a certain arbitrary threshold, then the chunk could be stored as-is, rather than as diffs. This could make heavily-modified chunks more compact and quicker to load.


I've actually thought about this. It seems a bit too complicated, but I don't know. If the game starts to lag then I'll consider it.

I once played a game with a 10 million x 10 million map and it was done this way. For some reason it lagged terribly. I think it had to do with the heavy tile modifications in the game. Game objects were sent by the server.


I don't know much about libnoise, but if you use the same seed won't it always generate the same map? Because if it did, you could store the seed on the server, send it to the player (who then generates it) and then retrieve x, y, health and inventory. Would that work?


Nah, sorry. The tiles change so much that it wouldn't be able to simply generate it. It would need to account for all the changes the players make.\\


Basically, each client just generates the area of the world immediately surrounding that player, while the server has to generate the area(s) surrounding each/all players.


Thanks, I'm working on this now :) (but not infinite generation-- I don't want the maps to get too big!)

I decided to generate 1000x1000 chunks. Each chunk is stored as a 25x25 PNG. The server loads the chunks around the player and sends it to the client. Object positions will still be held in a single XML file and constantly loaded (I just need to dumb it down a bit so that the map doesn't become overpopulated with objects. If it does, I'll switch methods somehow).

This may not be the best way to store all that data, but it works and should be fast. I'll keep you guys updated.

This topic is closed to new replies.

Advertisement