Staredit Network > Forums > SC2 Assistance > Topic: Reveal Fade
Reveal Fade
Apr 16 2011, 5:17 am
By: Bolshevik09  

Apr 16 2011, 5:17 am Bolshevik09 Post #1



Hello there,
I have been messing with the flashlight effect lately, and that's working great...
But i was wondering if there was a not-so-complex way of making the explored areas fade back to unexplored?
So that i could make a "pitch black" effect..



None.

Apr 16 2011, 5:31 am Roy Post #2

An artist's depiction of an Extended Unit Death

Why yes, yes there is. I did this for my December contest entry.

I'm assuming you're using the flashlight system I came up with, but any system involving triggers can incorporate this. Before running the flashlight's reveal, run this action:

Visibility - Change visibility for player 1 to Unexplored within (Entire map) and Do Not check cliff level





Apr 16 2011, 6:06 am Bolshevik09 Post #3



Oh okay good. Now for a flashlight question:
How do you make the "flashlight" only reveal terrain that is the same height as the unit? I tried disabling "check cliff level," but no luck only works partially.
-i think i would have to set a region to all terrain of a certain height which idk how to do



None.

Apr 16 2011, 6:48 am Roy Post #4

An artist's depiction of an Extended Unit Death

Yeah, I've been having trouble with this. You can check "Height At Point" to determine if the point specified should be revealed. I haven't worked out a perfect algorithm for this (my December entry had a partial algorithm).

Essentially, you want to do this: if "Height At Point" at the current position is significantly greater (I used +0.3) than "Height At Point" of the position of the unit, do not reveal, and stop all further flashlight reveals. Here's an example of what that would look like:

                General - For each integer counter from 1 to 10 with increment 1, do (Actions)
                    Actions
                        Variable - Set spread = (((Real(counter)) * 0.45) - 0.5)
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                ((Ground height at unitPoint) + 0.3) >= (Ground height at (unitPoint offset by spread towards unitFace degrees))
                            Then
                                Visibility - Reveal (Region((unitPoint offset by spread towards unitFace degrees), (0.5 + ((Real(counter)) * 0.2)))) for player 1 for 0.06 seconds and Do check cliff level
                            Else
                                General - Break


The "Break" should make it exit the loop. Technically, using break statements is bad design, so if you want, you can add a boolean local variable, add it to the If/Then/Else condition list, and flip the boolean in the else statement.




Apr 16 2011, 7:18 am Bolshevik09 Post #5



Quote from Roy
Yeah, I've been having trouble with this. You can check "Height At Point" to determine if the point specified should be revealed. I haven't worked out a perfect algorithm for this (my December entry had a partial algorithm).

Essentially, you want to do this: if "Height At Point" at the current position is significantly greater (I used +0.3) than "Height At Point" of the position of the unit, do not reveal, and stop all further flashlight reveals. Here's an example of what that would look like:

                General - For each integer counter from 1 to 10 with increment 1, do (Actions)
                    Actions
                        Variable - Set spread = (((Real(counter)) * 0.45) - 0.5)
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                ((Ground height at unitPoint) + 0.3) >= (Ground height at (unitPoint offset by spread towards unitFace degrees))
                            Then
                                Visibility - Reveal (Region((unitPoint offset by spread towards unitFace degrees), (0.5 + ((Real(counter)) * 0.2)))) for player 1 for 0.06 seconds and Do check cliff level
                            Else
                                General - Break


The "Break" should make it exit the loop. Technically, using break statements is bad design, so if you want, you can add a boolean local variable, add it to the If/Then/Else condition list, and flip the boolean in the else statement.

i see what you are trying here but it doesn't work so well when the unit is facing parallel of the cliff. I love how complex this is...



None.

Apr 16 2011, 7:48 am Roy Post #6

An artist's depiction of an Extended Unit Death

Your experience does not match with my own; I can face parallel to a cliff and still see down the line just fine. When facing a cliff directly, obviously, barely anything is revealed, because it's like pointing a flashlight close to a wall.

If, for some reason, you need the flashlight spread to be less sensitive to cliffs and still give a decent reveal when almost facing a cliff, you may want to consider running this loop for two more sets of paths: one going away from the unit's facing direction with an offset of -5, and one going away from the unit's facing direction with an offset of +5. This will expand your flashlight width significantly, so you may want to reduce the expand rate of the light.

Here's a visual representation of what I mean. O = unit, X = Flashlight path
Current:
Code



O    X     X     X     X     X


Modified:
Code
                            X
                X     X
    X     X
O   X     X     X     X     X
    X     X    
                X     X
                            X


The code doesn't really show it that well, but I don't feel like making an image. I hope this is enough to depict what I was trying to describe above.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[01:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
Please log in to shout.


Members Online: Oh_Man, NudeRaider