Fog of War and LOS How To??
by Scott Johnson · in Torque Game Builder · 08/29/2006 (3:45 pm) · 2 replies
From the search it looks like all of the "fog of war" threads are behind the RTS restricted area.
So..
I was hoping that someone might point me in the proper direction on how to implement the typical top down RTS style FOW, where totally unexplored areas would be black, previously explored areas would be greyed, and anything within LOS would be able to be seen, and only in this area would other objects be visible (except maybe for permenant objects, like towns, forts etc..).
I assume this would need to be done via tile layers some how.
Thanks in advance for any help in this area.
So..
I was hoping that someone might point me in the proper direction on how to implement the typical top down RTS style FOW, where totally unexplored areas would be black, previously explored areas would be greyed, and anything within LOS would be able to be seen, and only in this area would other objects be visible (except maybe for permenant objects, like towns, forts etc..).
I assume this would need to be done via tile layers some how.
Thanks in advance for any help in this area.
About the author
#2
Thanks for the feedback, I kind of figured that it would be something like what you described, I probably wouldn't have immediately thought of the blend though, pretty slick idea.
I've been playing around with, and have been successful at getting the current tile with something like:
$gameScene.getGlobalTileMap().getTileLayer(0).pickTile(%this.getPosition());
Currently assuming the 0 layer is the one I'm interested in.
I would love to be able to shorten that statement up a bit, if possible, but I wasn't able to name my layer for some reason, it didn't complain about it, but I couldn't access mylayername.pickTile(...); when I tried it. I can always set up a global for it with $baselayer = $gameScene.getGlobalTileMap().getTileLayer(0) during level initialization.
I Think that my biggest hang up on this idea is currently , how can I tell which "brush" (better yet is how to get the frame number from the tile) at the given location,
I see the Set commands for a tile, but no Get commands for the sprite data.
Any one else doing anything along these lines?
09/08/2006 (10:55 pm)
Clint, Thanks for the feedback, I kind of figured that it would be something like what you described, I probably wouldn't have immediately thought of the blend though, pretty slick idea.
I've been playing around with, and have been successful at getting the current tile with something like:
$gameScene.getGlobalTileMap().getTileLayer(0).pickTile(%this.getPosition());
Currently assuming the 0 layer is the one I'm interested in.
I would love to be able to shorten that statement up a bit, if possible, but I wasn't able to name my layer for some reason, it didn't complain about it, but I couldn't access mylayername.pickTile(...); when I tried it. I can always set up a global for it with $baselayer = $gameScene.getGlobalTileMap().getTileLayer(0) during level initialization.
I Think that my biggest hang up on this idea is currently , how can I tell which "brush" (better yet is how to get the frame number from the tile) at the given location,
I see the Set commands for a tile, but no Get commands for the sprite data.
Any one else doing anything along these lines?
Torque Owner Clint Herron
This will be done with a fog of war layer that is drawn on top of (lower number) than the main map. This fog of war layer will have tiles that are either black or transparent depending on if you can see that tile or not. If you want, you can also put shades of transparency in there as well.
You will then enable blending for that layer. I have to run home, but you can search TDN for a good explanation of the blending modes and what they do. Off the top of my head, I'm going to say that your source is going to be src_alpha and your destination will be 1-src_alpha.
Sorry for the terse reply, but I hope it's a kick in the right direction.
Cheers!
--clint