Vision

In StarCraft, **vision** refers to what areas of a map are currently visible to a player's units (and hence to that player). A unit's vision can be affected by terrain height and some spells (such as Blind). The primary limiting factor for a unit's vision, however, is its *sight range*, or how far it can actually see.

When a player has **shared vision** of another player, that means that the first can see what the second sees. This need not be mutual; if Player 1, for example, has shared vision of Player 2, then Player 1 can see what Player 2 sees, but not vice versa.

## Fog of war vision

Vision (for fog of war) updates three different ways:

1. A unit gains vision when it is created.
2. All vision on the map is updated after 100 frames.
3. When a unit is blinded, the vision resets immediately.

### Precisely-controlled vision

The typical way to reveal an area to a player is to pre-place or create (via triggers) a Map Revealer in that area. However, Map Revealers have a very large sight range, and can see over cliffs. This may be undesirable.

By utilizing hyper triggers and death counters, it is possible to reveal a mobile area without having a usable unit in the area, and without having a Map Revealer more than what you want. You simply create a unit just before vision is updated, and remove it immediately after vision is updated. The effect is that the player receives vision of the unit's location, but they do not have the unit long enough to even notice it, let alone use it. The only problem is that Blind, a spell used by the Terran Medic, forces all vision to update. Because Blind cannot be detected, you cannot compensate for this, so this trick requires that Blind never be used in your map.

#### Units to use

Ideally, you will use burrowed or cloaked units, to minimize the chance of the player seeing the unit. Here is a list of these units and their sight ranges:

* Vulture Spider Mine: 3
* Zerg Zergling: 5
* Zerg Hydralisk: 6
* Zerg Drone: 7
* Hunter Killer: 8
* Infested Kerrigan: 9
* Terran Ghost without Ocular Implants: 9
* Zerg Defiler: 10
* Terran Ghost with Ocular Implants: 11

Note that the upgraded ghost (including heroes) can be a disabled unit sprite so that any unit can walk over it. Infested Kerrigan can't be disabled in the same way.

#### How it works

Have a death counter count up to 50 (or 100 by adding 2 every trigger cycle), and when it equals 49, create the unit to be used. The very next trigger cycle (when the counter is at 50), remove the unit. This will update the vision of the area, usually without giving the player vision of the unit.

A common use of this is to create a variable vision range for a single unit to simulate night/day. Constantly center a location over the single unit, and whenever the single unit moves (use a pixel location or inverted location to detect this), create the vision unit at that location, and then remove it immediately. If you move the vision unit under the single unit, it will slow down the unit. To avoid this 100% of the time (when using a pre-placed disabled ghost, for example), when you move the unit which stays for one trigger cycle, do not move it under the single unit, rather move it under another unit you just created, centered a location on, then removed.

## Detection

Nearly all units in the game have the ability to cloak, whether it be by spell, with the help of a Protoss Arbiter, or by being disabled. Much like fog of war vision, there is a timer which governs when units are detected.

### How it works

Every 30 frames, units which are cloaked reveal themselves to players with shared vision or a detector nearby for 30 frames. However, each player can only reveal one unit per frame.