🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Automating Fringes

Started by
0 comments, last by Temple 24 years, 5 months ago
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?
Advertisement
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):
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