[EXAMPLE] Using 'Color Fusion' for a fog of war

Post your own tutorials, guides and demos.

Post » Sat Apr 28, 2012 7:53 pm

Here is an example that uses the effect "Color Fusion (Masked)" to create a fog of war. This example with a 4000x4000 layout in a 1024x576 window runs at over 1000 fps on my pc, when all 1600 sprites that reveal the fog are created.

1) Create your layout
2) Add a "fog of war" layer
3) Apply "Color Fusion (Masked)" as a layer effect
4) Use sprites created on the "fog of war"-layer as cutmasks to the fog

You could further optimize this example by creating/deleting the cutmasks when they get in or out of sight. You can use different shapes or even animated shapes, use a smaller or wider grid size, etc. The advantage of this method is that you don't use any additional VRAM (the layer effect always renders to screen size). Also, the layout size isn't important (CC cares more about sprites on screen, than the total number of sprites). And since the revealing is made out of sprites, you can have a vivid fog, e.g. different stages of revealing, instead of just 100%.

Download:
fow.cap
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri May 04, 2012 8:36 am

Whaaaa, outstanding^^ Many ppl tried to make a good FoW effect, but this one seems to be the smoothest and niftiest(does that word exist oO?) way to do it, thank you
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Fri May 04, 2012 7:43 pm

Thanks, zyblade!

And I also think, this one is a smooth and at the same time quite easy (compared to other methods) way for a designer. In this example it uses only 3 events to achieve an already impressive FOW. Now what would it look like, if you'd use the total control you have over every aspect of the fog, to change shapes, coloring, opacity, set game action spots, animate the fog, etc., etc. ?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri May 04, 2012 8:26 pm

[QUOTE=zyblade] Whaaaa, outstanding^^ Many ppl tried to make a good FoW effect, but this one seems to be the smoothest and niftiest(does that word exist oO?) way to do it, thank you [/QUOTE]

I agree. It's totally amazing!
B
54
S
11
G
4
Posts: 250
Reputation: 5,074

Post » Mon May 28, 2012 5:47 pm

Is there anyway to have this work with Construct 2?

Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

Post » Tue May 29, 2012 4:30 pm

[QUOTE=Taurian] Is there anyway to have this work with Construct 2?[/QUOTE] No, it is a DirectX based pixel shader.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Jun 09, 2012 9:30 pm

Maybe some analogue in Construct 2? In any form? No?
B
19
S
6
G
4
Posts: 171
Reputation: 2,507

Post » Fri Jun 15, 2012 3:53 pm

Can't find a way of duplicating this effect for Construct 2, maybe one more experience fellow will give us a hand? Need this effect for a tank battle game, but it keeps running away from me...
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Fri Jun 15, 2012 5:32 pm

You can't duplicate it without being able to access the alpha channels of the textures. If it is possible with javascript (or whatever is the language) to hook into the rendering process, then paint everything black where no object is placed on a certain layer, but paint the background where those objects are. That's basically it.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Jun 15, 2012 6:27 pm

It can be done in C2 with a layer with "force own texture" and the "destination out" effect for the light glows.

http://dl.dropbox.com/u/5426011/examples12/fow22.capx
It's quite a bit slower than tulamide's CC version. The main reason is CC can handle a lot more objects before slowing down.
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest