Saturday, December 15, 2012

Terrain Generation!

After several silly problems, I have basic terrain generation working.


I started off with Perlin Noise to adjust the heights of the tiles, which turned out pretty good but it didn't look like it fit the isometric style so I snapped each height to the nearest 16px, which resulted in theabove screenshot.

As you can see something else is wrong now, the terrain generation is fine but there are gaps left if an adjacent tile has a much higher or lower height than its neighbour.

In order to solve this, a tile would check it's neighbouring tiles, and if they leave gaps, it will draw in extra dirt-stacks underneath itself. I had to change the dirt-stack image to tessellate better since it would be a repeated image. I ran into several problems but it turned nicely one again, shown in the screenshot below.



Now this looks fine ... to an extent, but I didn't like that the grass from high tiles would seem to blend with those 1 level down but north of the tile. It's hard to tell that the edge of the tile exists. In order to get around this I first tried just adding an edge to each tile to define the edge.



But this didn't turn out how I wanted it either, it'd draw edges on each tile which (although it doesn't look too bad) isn't what I wanted. Instead once again similar to the gap problem, I checked the neighbouring tiles of each tile to determine whether to draw each edge. Finally I ended up with the following.


2 comments:

  1. The problem I see here is what happens if the player ends up behind a really steep mountain. Other than that it looks great and I can't wait to see what comes out of this.

    ReplyDelete
  2. If the characters are not tall enough, I might need to implement some kind of 'terrain tiles because partially invisible if a character is behind it' but yeah you've got me thinking now

    ReplyDelete