[SOLVED] "Fog of War"

Is there any way I can have it so I can’t see units a certain distance away? I thought of drawing only units that intersect with an oval around my player, but it would look weird when they came into view, as they would just pop up. I also thought of a vignette image I could lay over the canvas, but not sure if that would work.

Fog of war, the units do just pop in when they come out of the fog, don’t they?

You could have 2 circles, and when they intersect the larger one, start their fade at 0.1(almost fully transparent) and when they reach the inner smaller circle, have their fade be at 1(fully opaque) and interpolate between the 2.

instead of using a circle though, I’d just use a range check against units. You could also leave a few “sight entities” behind when units move around, so that when you are moving fast, many games you cna still maintain sight for a few moments before it disappears, just have the sight entity with a deteriorating health. Obviously the sight entity isnt visible or renderable, just an entity that can add to your vision.

Edit:

Is this a 2D or 3D game? Top down perspective? side view? first person? That could change some things.

Calculate the distance between the units and fade them between two distances?

Most games they do just pop into view. Sometimes they animate a fade in over time to avoid visual popping.

Just blend em in from transparent -> fully visible until they’re out of the fog.

Cas :slight_smile:

Thanks a lot. All of these answers are great.