Automating Fringes
I am busy programming an iso engine, I have gotten to the point where the core works fine, but creating the map is tedious. I need a way that I can place one tile of water, and the program will work out what tiles go around it (ie the fringe) taking into acount other tiles which have already been placed. Just like the Age Of Empires level editor!
Any help would be appreciated.
ps. The tiles also have height.
Who says I have to believe in what I stand up for?
You could do basic edge mapping based on tile height. Image processing algorithms like that tend to be a bit messy (and I can''t think of a good one off the top of my head - not enough caffeine in my bloodstream!). Basically, you trace from the starting tile around an area looking to maintain roughly the same height as the water level. Ideally, you''ll go all the way around and end up with a self-contained water area. A lake in height terms could looks kind of like this (the numbers are a 1-9 height scale):
Now, if you decided that the water was at level 6 for this lake, you''d end up with (asterisk is water):
Getting from one to the other... the way that springs to mind is to use a flood-fill algorithm, treating numbers above water level as edges.
If that doesn''t make sense, I''m over tired!!!!!
8 8 8 8 8 8 88 7 7 6 7 7 88 6 4 3 4 6 87 3 2 1 2 3 78 6 4 3 4 6 88 8 8 8 8 8 8
Now, if you decided that the water was at level 6 for this lake, you''d end up with (asterisk is water):
8 8 8 8 8 8 88 7 7 * 7 7 88 * * * * * 87 * * * * * 78 * * * * * 88 8 8 8 8 8 8
Getting from one to the other... the way that springs to mind is to use a flood-fill algorithm, treating numbers above water level as edges.
If that doesn''t make sense, I''m over tired!!!!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement