Hello, and welcome to the PrettyColors edition of Adventures in Terrain Generation. This episode in particular is special because, as promised, it will be the first one to not involve that function thatĀ everyone needs a break from. Now that you’ve breathed your sigh of relief, let’s start roasting/freezing this planet!
Last time, I promised that in this chapter we’d start generating trees and forests. I’ll show you the forests soon, but before we go any further with this project, we need to move this over into a real graphics engine. As neat as it is, the command line isn’t exactly fast/powerful enough to draw the detail we’ll need as we keep going. To this end, I decided to work with libGDX because it’s a framework I’m already somewhat familiar with. It’s basic enough that I have a lot of graphical freedom and efficiency, without having to do a lot of the background work myself. It’s also useful because it lets me create a helpful visual demonstration of how “brightness” in Perlin noise translates to “elevation” in our map:
Also, this map is like a billion times more detailed than the old one, scientifically speaking
On the left, you can see what the Perlin noise actually looks like: a 2D map of gray values, with a higher value corresponding to a brighter pixel. On the right is the final result with those gray values mapped to different terrain types, and the middle has both overlaid to make what’s going on a bit clearer. Like I somewhat failed to explain last time, the brighter a pixel is, the higher we say its elevation is. Everything below a certain value is water. As we get higher, the terrain becomes sand, dirt, grass, and finally snow. With that out of the way, we canĀ almost move onto trees, but first we need to talk about time travel.
The several concerned text messages I received from family and friends after my last entry have taught me two things:
I shouldn’t spend over a thousand words expressing an unhealthy affection for a math function.
I should spend several thousand words expressing an unhealthy affection for several math functions.
That is, I should document, with painful detail, my journey in determining whether Terrain Generation is more productive use of my time than trying to fake a beard by growing really long nose hair. Day 36 of the nasally-rooted beard pursuit* has yielded disappointing results so far, so for now let’s talk about terrain. Continue reading “Adventures in Terrain Generation, Chapter 1: Making Some Noise”→