How can I generate an "unlimited" world?

Posted by snowlord on Stack Overflow See other posts from Stack Overflow or by snowlord
Published on 2010-06-16T08:54:09Z Indexed on 2010/06/16 9:12 UTC
Read the original article Hit count: 258

I would like to create a game with an endless (in reality an extremely large) world in which the player can move about. Whether or not I will ever get around to implement the game is one matter, but I find the idea interesting and would like some input on how to do it.

The point is to have a world where all data is generated randomly on-demand, but in a deterministic way.

Currently I focus on a large 2D map from which it should be possible to display any part without knowledge about the surrounding parts.

I have implemented a prototype by writing a function that gives a random-looking, but deterministic, integer given the x and y of a pixel on the map (see my recent question about this function). Using this function I populate the map with "random" values, and then I smooth the map using a simple filter based on the surrounding pixels. This makes the map dependent on a few pixels outside its edge, but that's not a big problem. The final result is something that at least looks like a map (especially with a good altitude color map). Given this, one could maybe first generate a coarser map which is used to generate bigger differences in altitude to create mountain ranges and seas.

Anyway, that was my idea, but I am sure that there exist ways to do this already and I also believe that given the specification, many of you can come up with better ideas.

EDIT: Forgot the link to my question.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about game-development