Mittwoch, 3. Oktober 2012

(Very) Small steps

So I had this problem with adding the height graphics to the borders of the maps.
For each tile, I check all the adjacent tiles to see which heights they are and add the corresponding graphic. Of course this doesn't work for the borders, since no map knows about the heights of the other maps. So I had to add a Dictionary (an array doesn't work here, since I need the coordinates 55/1 etc and nothing in between - please comment if there I miss something) for the border tiles, calculating the noise value for the adjacent tile check.

How many stupid errors one can do is simply amazing. I not only copied the parameters, having the octave value divided by 2.5 two times instead of just one (I do this for variation, so the height map is different from the tile distribution), I also interchanged various variables, esp. x and y values, subtracted 1 where it really shouldn't be subtracted, and so on. But, finally I got it working and learned a lot about stupid mistakes you can do.

Now I'm adding the rest of the graphics. I do this via a switch statement. Each of the 8 adjacent tiles get one value (1, 2, 4...) and adding the values for a single tile will tell me which graphic I have to use. I found the idea in some post I can't find atm and tried to adopt it. They managed to reduce the number of possible cases from 255 to 16 by using bits for each state of each adjacent field, while I actually have about 25, number still rising. But my system is a bit more complicated *sigh*.

Well, I'm just happy that I found all bugs (hopefully) and can continue to add all the cases/graphics for the height map.

So long
Se Wachmacher

Keine Kommentare:

Kommentar veröffentlichen