Possible Approaches for Fogging a Game Map

BlitzMax Forums/BlitzMax Programming/Possible Approaches for Fogging a Game Map

Macguffin(Posted 2009) [#1]
Hey all,

I'm working on creating a fog of war effect on a static map, similar to how it is here in King of Dragon Pass:

http://www.mobygames.com/game/windows/king-of-dragon-pass/screenshots/gameShotId,5267/

Anyone have an ideas how I should approach this? Right now, I'm investigating making a pixmap of a white PNG and manipulating the pixels in explored areas to be transparent.

Thanks!


_Skully(Posted 2009) [#2]
Are you using a tilemap? it really depends on what you are using on how to implement fog of war. If its a tilemap then you could do it as simply as having a parameter on each tile that identifies when it has been "seen" and then processing the edges of the fog of war to smooth it.


Macguffin(Posted 2009) [#3]
Right now, I'm not planning to have a tilemap at all - I like the idea of having irregular areas revealed. I could fall back to that, but I wanted to explore what I else I can do before that.

EDIT: I'd also just take a pointer to a good pixmap tutorial, if anyone knows of one.


Macguffin(Posted 2009) [#4]
Found this post from TonyG that had some code - so, if I have this right, I'd want to take my image, pull it into a pixmap, alter the alpha values where I wanted to do so, turn it back into an image then apply the texture to the buffer.

The thing I really didn't get was how the argb values worked, but TonyG's post looks like it spells that out pretty clearly.


Nate the Great(Posted 2009) [#5]
make a pixmap for your "fogofwar" then have a type for fog "areas"

every frame color the entire pixmap black with no alpha and go throught all of your areas and draw the ones that have been "seen" in solid white. now maybe blur the edges for cool effect and solidblend it over the map

idk if this is what you are looking for but it works for me.