I have a set of terrain sprites available to represent terrain:
- Flat
- North-South Straight Cliff (x 2 allowing for slope direction either way)
- West-East Straight Cliff (x 2 allowing for slope direction either way)
- Convex North West Cliff
- Convex North East Cliff
- Convex South East Cliff
- Convex South West Cliff
- Concave North West Cliff
- Concave North East Cliff
- Concave South East Cliff
- Concave South West Cliff
There source for my terrain is a height map that I am looking to represent with contours made up from above sprites. The cliff tiles would be placed on the below-threshold tiles that border the above-threshold ones. However when I split the height map by threshold I get terrain features that are impossible to represent with the tile set, for example:
.....
... 1 1 1 ...
... 0 0 0 ...
... 1 1 1 ...
.....
Where 1's represent tiles that are above the threshold and 0-tiles are below. My sprite set lacks the tile to represent either immediate neighbors (in this case North and South neighbors) being above threshold.
I am looking for a good approach to get rid of these cases. I have already tried just looping through all columns/rows looking for 1 0 1
combinations and changing the height map value to be above the threshold. In the end, I don't really mind the way the "gaps" are filled in, as long as the end result can be represented with my tile set.
Remember cases with diagonal gaps must be considered. For example:
.....
... 0 0 1 ...
... 0 0 0 ...
... 1 0 0 ...
.....
Also cannot be represented with my tiles set.
Finally, I'm also looking for a scalable solution to this problem. If I require to use and even more restrictive tile set that requires 1 (0 x n) 1
gaps to be filled in, as in the two above-threshold tiles can be n
below-threshold tiles away from each other.
P.S. Apologies for my previous poorly worded question.