techbear
08-22-2004, 11:42 AM
I'm working on my turn-based, cell-based game engine, and it's time to implement "fog of war", also called a visibility map. This is a map overlay that doesn't allow you to see enemy units until one of your units can "see" them.
I want to implement something simple and fast (cause I'll have to update it every step of every movement), but I need a reality check.
The real issue is opaque tiles, like forests or walls, that units cannot see PAST. I could simply seed a map with the start locations of all my units, and then iteratively spread those seeds out to the limits of the units' vision, but that won't handle opaque tiles.
I could seed the map with the units, then iteratively spread out AROUND the opaque tiles, but that would mean seeing AROUND objects, which isn't the result I want.
I could also start from each unit, and "paint" rays outward until vis distance or an opaque tile are hit. However, the longer the range, the more rays I'll have to paint, so this approach, while giving correct results, would seem to be very slow.
What do you think?
I want to implement something simple and fast (cause I'll have to update it every step of every movement), but I need a reality check.
The real issue is opaque tiles, like forests or walls, that units cannot see PAST. I could simply seed a map with the start locations of all my units, and then iteratively spread those seeds out to the limits of the units' vision, but that won't handle opaque tiles.
I could seed the map with the units, then iteratively spread out AROUND the opaque tiles, but that would mean seeing AROUND objects, which isn't the result I want.
I could also start from each unit, and "paint" rays outward until vis distance or an opaque tile are hit. However, the longer the range, the more rays I'll have to paint, so this approach, while giving correct results, would seem to be very slow.
What do you think?