Fog Of War - how to execute?

For questions about using Classic.

Post » Thu Jul 07, 2011 9:41 am

I belive everyone knows what FoW is.
The problem is - how to implement it?

At first i thought the obvious - create "fog cloud" object every X and Y.
And this would be okey i gues, for a small layout. lets presume that one cloud would be 128^2 pixels big. Thats about 100 of them for 1280^2 big layout. And as its the same sprite object it wouldnt only impact the CPU, not the VRAM. But what if the layout is 10k^2? now we have about 10k of them. And 10k objects is... troublesome, at best.
So to cut the CPU usage/number of Objects i can adjuct the cloud size twice but then it will impact the VRAM the bigger the cloud would be. So either way CPU or VRAM are burdened.

I though about Canvas but Canvas of this size is like a russian roulette with full barrel.

I could try the 1st + occlusion culling/array i am not sure if i can pull this one out.

Any ideas or tricks comes to your head how to execute this? i cant think of any reasonble solution but i lack the skills and knowledge. And this FoW is something i really would like to have. Or at least know how to use, if not for my current project then for future use.
B
16
S
5
G
4
Posts: 211
Reputation: 3,767

Post » Thu Jul 07, 2011 9:54 am

This has already been asked before HERE
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

Post » Thu Jul 07, 2011 10:13 am

actualy no. The guys knew what FoW technique he'll use, he just wanted the blob around player to have a custome shape.
I exactly know what i am after but the problem is my layout size. the smallest is 10k^2

I know the basic techniques how could i have FoW. What i want to know is a variation of known technique or a new one that will not blow up the player CPU or VRAM :P
B
16
S
5
G
4
Posts: 211
Reputation: 3,767

Post » Thu Jul 07, 2011 10:51 am

I think it still won't be a problem to use that method if your maps are large.

Otherwise, just have a tonne of the same sprite black placed along the maps (probably using a for loop to place them in a grid, so you don't have to manually place them). It won't take up much VRAM since it's the same image for each sprite, and will only lag if you display too many of them on the screen at once. Then when the player gets close to them, destroy them.
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Jul 07, 2011 11:56 am

Although I think this is similar to the HERE link above, it's a bit more simple and to me, it creates a more classic FOW effect. Uses two layers, a Main one and a Fog one, where the Fog layer is set to 90% opacity with a black filter. On that layout is a black panel object which acts as the fog. On the main layout is the player and background. Basically, the player spawns "FogCLEAR" objects on the Fog layout, which have the erase effect. To conserve performance, the player only spawns the "FogCLEAR" objects as he is moving, and at 500 millisecond intervals.

http://dl.dropbox.com/u/31490769/fogSPG.cap
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Thu Jul 07, 2011 12:39 pm

Just an idea.


Fog of War
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests