A blog about game development and procedural content generation.

First time here? Try the graphical archive of all posts.

Feel free to email me or Tumblr ask | FAQ | Also on Twitter @bennettor

...querying twitch.tv... http://www.twitch.tv/timetocode

Making a game, my first procedurally generated game world

Initial thoughts

I’m not really sure what game I’m making; I just started coding one day. My initial goals were to make a game that had:

  • nifty procedural generation for the environment
  • a world that felt like it was alive and active with or without the player
  • both open endedness and finite objectives
  • multiplayer possibilities
  • resource gathering
  • crafting
  • player-made houses
  • maybe mining or spelunking
  • a mixture of typical game genres, perhaps action + rpg + rts + sandbox
  • something casual
  • something hardcore

And with this vague list in mind, I just went to work on making my initial world generator. I read some articles about perlin noise algorithms only to find out that I’m not very good at math. Nevertheless, after many days of ugly code, looking up “basic” math terms on wikipedia, and reading long lost edu pages I had a working prototype.

Procedural generation of terrain

Here’s one of the first dozen pseudo random noise calculations turned into a black and white image:

You may notice that it looks a bit like clouds — it’s that organic feeling to the pattern which is exactly what I wanted. The general idea behind procedurally generated terrain is that you make an image like the one above, and then you imagine that the light areas in the image represent high elevations and the dark areas represent low elevations. I tweaked the algo and did exactly that.

A prototype continent

Via code and color selection the above noise map imagines snow capped mountains (though they kinda look like clouds) at high elevations, vegetation at moderate elevations, and an ocean at low elevations.

It is very far off from being a good world generator, but it is an adequate prototype for now. One of my next posts will delve into what the generated continent above could look like up close.

  1. timetocode posted this
Blog comments powered by Disqus