Jump to content
  • Advertisement
Sign in to follow this  
ScHiZo

Ideas for Fog of War (Shroud)

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently working on an iso game that requires a fog of war that's similar to Starcraft. I've tried making shroud tiles, but the edges of the fog didn't look very realistic. I then enabled hardware accelerated alpha-blending on the DirectDraw engine through Direct3D 7, but it didn't work out too well. After searching for several hours on Google, I decided to turn to this forum for help. I've pretty much ran out of ideas on how to pull off the effect. There were articles on multi-texture blending with alpha mask, but they were hard to implement with the way my code is right now. So basically what I'm asking is how can I do a simple fog of war effect that isn't so taxing on fps?

Share this post


Link to post
Share on other sites
Advertisement
First you need to draw/generate some transition tiles. These are going to probably be in greyscale, and just represent the transition between dark to light. If you don't know how to generate the tiles, just take the following pattern, and draw it as tiles in Photoshop/GIMP


_____
/ \
| |
____/ \____
| |
| |
|____ ____|
\ /
| |
\_____/



If all the shapes present in that shape are pre-drawn/generated, you will be able to come up with pretty much any shape you need.

For a completely obscured map, just neglect to render any invisible tiles, and then render transition tiles with alpha blending over top of transitioning tiles, so that it creates a nice border.

For a map that's partially obscured (for example, you can see terrain, but not enemies) it would probably be wise to create a second tileset of your tiles that is at 50% brightness, draw the non-visible parts of the map with that, and then blend your transitioning tiles at 50%. This will make the terrain that isn't visible by the player's units appear to be darker than the rest.

As for actually determining which transition tiles to draw, I'll leave that up to you to figure out an algorithm.

Share this post


Link to post
Share on other sites
First off, thanks for replying! Secondly, I think I'll try what you've suggested, but this might involve some hacking on my map's data structure and visibility algorithm. I've been trying to make diamond shaped shroud tiles, which is probably why I've been stuck. If all goes well, I'll post again with my results. In the meantime, I'd be glad to hear anymore ideas from anyone.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!