Thursday, December 27, 2012

Terrain Coloring and Trees

I'm back from my mini holiday and I hope everyone had a wonderful Christmas. Since I've been back the engine has changed quite a bit:
  • Chunk generation/shading sped up to 200 per second
  • Terrain is now colored randomly
  • Random (if only a bit) trees
Lastly, I also enhanced the terrain generation algorithm. Previously, the heightmap was calculated with only one random Perlin Noise sample whereas the new algorithm uses three. The methodology behind it is slightly similar to how Minecraft used to do it in the olden days.

I generate three Perlin values called Elevation, Roughness and Detail:
  • Elevation is very smooth (zoomed in) and decides the overall shape of the terrain
  • Roughness is a bit less smooth and adds in some mountains and valleys
  • Detail is a close-up sample and makes the terrain a bit more interesting
The three values are then combined like this: 
  • ((elevation * roughness) * 32) + (detail * 8) - 8
Doing this gives much more interesting terrain but it will have to be replaced in the near future to allow for overhangs and more unique landmasses. To achieve this, I could use Simplex Noise but I'm not too happy with my implementation of Simplex at the moment as it takes much, much longer to execute than even numerous Perlin samples.

And now, screenshots!


  1. Looking good. Is this what Pixel Heroes is turning into? Because I really like the direction it's taken if so.

    Good luck in you endeavors, and I'll be waiting patiently for a playable version when the time comes!

    1. That's a good question. I originally moved away from 3D development because it's much harder to create assets. But the simplicity of 2D development gets boring quickly.

      I might work on the engine while working on 2D Pixel Heroes. Or not. We'll see :)