Skip to content

World Generation: Fundamental shapes

World Generation: Fundamental shapes published on

Random generation is a pretty interesting part of game development in that there aren’t that many standard algorithms to apply to it. There’s an edge of creativity when building an algorithm for it. It’s most commonly applied to dungeons, typically by splattering around a few randomly sized rectangles and then connecting them by thin hallways.

 

dungeon

 

Our game requires a more organic approach since it takes place on a world rather than a confined, man-made dungeon. A number of possible generation styles were considered- the most ambitious being to place a few elements at random and then “simulate” the world for awhile. Eventually I settled down into deciding that we mostly just needed to achieve a world with naturalistic edges- wavy, unpredictable and rarely straight. One of the early attempts at this was to place down random points, and then connect them together.

point

 

This worked well with enough points and a large enough area, but ultimately failed to create organic shapes for smaller areas given our large tile size. So I went down to an even simpler technique of having a “cursor” tile that moves about the map randomly creating land. This was, of course, a little too random so I structured it a further by having it move along all 4 “edges” of a shape, moving up and down at random to create the flow. Once the outline was finished it could simply be filled in.

phase1-2phase2

The end result was satisfactory at creating continents with an organic feel. The technique was then extended towards the rest of the world- lakes would use the same style of shape generation, rivers could simply move about towards a direction, and so on.