Fog of War

For questions about using Classic.

Post » Sat Feb 19, 2011 4:52 am

well as I'm sure everyone is sick of me asking so many damned questions...here's another!!

I'm looking to try and achieve a fog of war effect, which I've done with induvidual tiles...the problem is that the circle of vision around the player looks like a ring of enormous pixels, as it's each tile that is visible, how can I, if it's even possible...instead do the fog per pixel, so that's it's a nice round, smooth circle of vision around my player, any ideas?
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Sat Feb 19, 2011 11:37 am

Have you tried the erase effect?
[url:3bcijuat]http://dl.dropbox.com/u/5426011/examples4/fog.cap[/url:3bcijuat] made in 0.99.96
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Sat Feb 19, 2011 3:49 pm

haha no, no I had not! Thanks for that :D

although, that's only half of the effect I'm after.
I'd like everything to be blacked out initially and as the player explores more of the map is revealed.

The erase effect will be great for the circle of vision in the areas the player has already explored, but I want areas the player has never been to tobe totally black until they explore them, and then after being explored they're simply grayed out when the player is somewhere else (like starcraft, warcraft, etc)

any ideas?
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Sat Feb 19, 2011 4:17 pm

hmm, unless I'm missing something in your example, I did everything the same, but I wind up with this...



the purple square is actually a monster from elsewhere on the map and the player doesn't show up at all...

I created the tiled background for the fog, on its own layer, and then created the vision object on the same layer, above the fog, applied erase, and in the events...

Always: "vision" set position to "player"

um...help? :)
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Sat Feb 19, 2011 5:27 pm

Did you check "Force own texture" in the fov layer?

I updated the example with a grayed fog of war. I used a canvas 1/4 the size of the layout, for large layouts this method is inefficient because it will require a large amount of video memory.
[url:34y3b2ok]http://dl.dropbox.com/u/5426011/examples4/fog.cap[/url:34y3b2ok]

For other ideas:
[url:34y3b2ok]http://www.scirra.com/forum/viewtopic.php?f=3&t=7447&p=58285&hilit=fog+of+war#p58285[/url:34y3b2ok]
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Sat Feb 19, 2011 8:59 pm

Wonderful examples R0J0hound.
Tips his hat
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Sun Feb 20, 2011 2:09 am

no I completely missed the force own texture button lol

and your second example is perfect...is it wrong that I want to eat your brains and gain your knowledge?

edit: Construct knowledge specifically so really I'd only eat that part of your brain, you could keep the rest :lol:

edit: Also, my layout is somewhat large, 2592x1440, and may get bigger in the future...any ideas that might not be so brutal on the vram?
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Sun Feb 20, 2011 3:09 am

Looking at it again it doesn't seem to use up as much vram as I originally thought.
You can keep the vram usage low by making the canvas smaller scale.

For a layout with a size of 2560x1920 and a canvas 1/8th (320x240) the size of the layout ~6 mb vram is used in this example.

[url:7yk0esxy]http://dl.dropbox.com/u/5426011/examples4/fog2.cap[/url:7yk0esxy]
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Sun Feb 20, 2011 3:48 am

I am endlessly impressed by your knowledge of Construct and your willingness to share...your brains do smell yummy haha
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu Apr 14, 2011 12:01 pm

[quote="R0J0hound":1uvzidej]Looking at it again it doesn't seem to use up as much vram as I originally thought.
You can keep the vram usage low by making the canvas smaller scale.

For a layout with a size of 2560x1920 and a canvas 1/8th (320x240) the size of the layout ~6 mb vram is used in this example.

[url:1uvzidej]http://dl.dropbox.com/u/5426011/examples4/fog2.cap[/url:1uvzidej][/quote:1uvzidej]



tiger tiger everywhere haha i love the example indeed :D
I was wondering, is it posible to make objects like enemies or items appear in the light but invisible in black and grey areas?
B
43
S
9
G
5
Posts: 231
Reputation: 7,291

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests