Posts mit dem Label height map werden angezeigt. Alle Posts anzeigen
Posts mit dem Label height map werden angezeigt. Alle Posts anzeigen

Donnerstag, 11. Oktober 2012

Finalizing the height map

It's almost done. Just a few more switch-cases and it's good to go.

Today I finally understood this blog post (the one I mentioned in the last post)  or at least found a way to use it in my own game.

Let's resume how I managed the heightmap graphix so far.
For each of the edges and corners, I added 2^n to a byte value to find out which tile there has to be. Then I put that value in a switch statement to apply the appropriate graphic. In the end, that looked something like this:

case 11:
case 15:
case 43:
case 47:

Now that's not very efficient... But now I got how it can be down easier. Yay :D So I changed some function here, some other thingy there and it worked w/o any bug. Hooray for me! Now I first check the edges: if there's a different height, I'll have to apply some graphics, so I don't need to check the corners. If the height is the same, I check the corners. The calculation for the cases is pretty much the same, but now I only need 32 cases, not up to 256. All that's left to do is to clean up the code and get rid of all those unnecessary cases now.

The next thing to do after that will be the transition between the tile types.

Oh, and I need better graphics. Definitely...

Cheerio,
Wachmacher

PS: here are some screenshots of the finished height map:

A map with a lower zoom for the nosie generato -
zoomed out for better view

A map with a lower zoom for the noise generator -
zoomed out for a better view

A normal view of a map. Height map's done, yay!
Though it isn't very pretty yet. And water doesn't need it.




Donnerstag, 20. September 2012

Adding some height to the soup

One of my biggest problems so far was the implementation of the height map in the renderer. Creating the height map wasn't the problem but to add the corresponding graphics to the screen...
Well, I'm far from having it finished but I took the first steps and am quite proud that I managed to get this far. I know it may seem a bit strange to be proud of something as unaesthetic as this:




But still, I got the idea and succeeded to add at least the impression of height, so that's a jump of joy for me ^^

Other problem I encountered is the map creation on the fly. It takes some time to create a new map, about 0.2s, and thus the picture stutters a bit. Can't wait to get to know Mr. Multithreading.
Oh, if anyone has some tips for me, feel free to post a comment!
Yes, I mean you, that one guy who happens to read my blog.

And I've got to admit, being a noob can be quite some fun because you've got so many new things to learn. And succeeding in these (rather easy, because basic) tasks gives a good pint of satisfaction.

Or to use the Doctor's words: Fantastic!

Cheerio
The Wakemaker