Anyone Know how to achieve XCOM's style of Fog of War?

Started by
4 comments, last by knarkowicz 7 years, 8 months ago

I've been working on this engine for some time, being designed for a Fallout 1 and 2 styled game with some wasteland elements. And I decided to go ahead and add a tile system. I'm not entirely sure if I want to make the terrain norm displacement mapped terrain, or tiled terrain. But I do intend on making the map able to support multiple levels. Things like buildings, that will have multiple floors without teleporting people off to another room unless necessary.

But I can't grasp my head around how Xcom Enemy Unkown and Xcom Enemy Within went about setting up the fog of war for buildings. I've wanted the engine to stream in tiles as it goes... and I have thought about loading in multiple textures per tile. something like a 16x16x256 texture which would be a 206kb texture for each tile. A bit high, but decent I guess. If I use two bits per standing layer, it'd give me a decent range per byte. 256*16, up to about 4096 wall heights. Probably less than that if I soon decide that I don't need that height.

Advertisement

Got a video of the effect in action? Maybe people will be able to help then.

-potential energy is easily made kinetic-

Got a video of the effect in action? Maybe people will be able to help then.

Sorry to sound like a crank here, but the effect can be seen on literally any let's play video :P. I also don't personally own a copy of the game, so I don't have access to the modding toolkit to get a better idea. Though from what I can see, the maps are procedurally generated.

http://i.imgur.com/VYzZ8y4.jpg

http://i.imgur.com/snayuXH.jpg

Wow... there's some hate going there, and I'm literally stating the obvious here :P as it's an effect used through the majority of the game.

Anyways, I've already figured it out. Or at least how to get close enough anyways.

I think the point was that you should provide the link to the example in the first place, not have us dig around to try and find out what you're asking about.

Just create a render target with fog of war, where 1 pixel represents one tile and it's value represents if it's visible or not. Update this render target when camera moves, by rendering a circle. This way new tiles around the current camera position will be marked as visible. Finally, render fog of war, by reading mentioned render target, filtering it (maybe using some higher order filter) and apply some kind of cool effect in pixels where fog of war is marked as visible.

This topic is closed to new replies.

Advertisement