Virtual hit points

**Virtual Hit Points** (or vHP for short) is a popular mapping technique used to replace StarCraft's standard unit HP system. VHP is easier to manipulate, as you can add, subtract, and even multiply and divide vHP with ease using both Binary Countoffs and Death Counters. There are three commonly used methods of vHP: Counter vHP, Burrowed Unit vHP, and Multiple Life vHP.

One of the cons of using vHP is the fact that you cannot always detect perfectly the amount of damage dealt by an enemy since the burrowed unit has a certain amount of life. For example, how could we differentiate an enemy attacking of 100 and a boss attacking of 10 000 if the vHP have 1 hp? A solution to this would be to have physically separated areas (so you must move the unit via trigger from on to another) and to have a computer player for each amount of damage that could be dealt into that area.
Like that, you can detect which computer has over 0 kill score to know if it has killed a vHP and be able to deal the right amount of damage (don't forget to set back its kill score to 0).

## Theory

Virtual Health Points at its most basic level is just keeping the health of a unit stored somewhere other than it's physical health (almost invariably in a death counter, and why not? it allows the most freedom). Every vHP system must provide a solution to specific problems.

### How damage is taken and tallied

The answer to this is about control. The methods are never very different:

* Each instance of damage taken is shown/limited/done in the killing of a unit (whether it be the actual unit dying and being replaced, a zergling to kill beneath, or an observer above to kill). The detriment is the level of identification that can be drawn from kill methods, namely, the best that can really be done is the damage done can be attributed to the player that did it, rather than a specific unit. The real dilemma is what you make that player mean (IE a unique hero, an enemy unit type, an level of unit difficulty).

* Damage is manifest in the detecting the effects of a unit spell (IE EMP, Plague, Lockdown, Psi storm, Ensnare, Dark swarm, Disruption web etc). The problem with this methods is that none of them can be attributed to a player. The best that can be known about spell detection is where it is/happened spatially and when it was/is within time. Of course, we can use either of these to ascribe it to a specific player or unit by making it so that only a specific player or unit could've produced the spell within a certain geometric area or within a specific time. However, separating the playing field for each player or unit can ruin the gameplay and forcing the units or players to take turns (to delineate through time) can be even less desirable. Elementa is an excellent example of a map that used spatial separation to attribute the spell to the appropriate player. While normally this physical separation wouldn't make for great gameplay- near perfect mirrored simulation combining the players' physical realms closed the gap.

* Ultimate handling, where all damage done is in triggers and trigger prompted events (even if prompted by player events). For instance, in my Time Down arena map, the only method of damaging a player was through spells which decided which players' unit was in the location and did the appropriate amount of damaging. The problem with this method is that you completely sacrifice normal Starcraft fight mechanics. Sometimes this isn't a problem, since normal fight mechanics were never the goal. Every system that uses this must chose how these events play out (how the triggered attacks work) and how they are prompted and directed for the player. The possibilities are infinite. What makes this method any good is how both of these aspects play out. In the example of Elementa, the events were in the form of projectiles represented by explosions, and the trigger method was Dark Swarming (and unit build selection). In another example, the event is instant damage and an explosion and the trigger is cooldown and randomization. Using this method, unfortunately, is why I dislike Time Down. Units can run around and cast spells, but the complete lack of physical attacking made the gameplay feel hollow.

### How virtual health is delineated to the appropriate unit

The solution to this second question is about making units unique:

* By player (as is done where players have one hero unit).

* By unique unit (as is done where only one player can have a certain unit (IE Temple Siege) or many boss fights).

* By spatial position (as is attempted by location following, and similar methods, where the idea is that only a specific unit could possibly be in the location).

* By any combination of the above (IE Each player has only one of each kind of unit type in each region of the map)

The dilemma with all of these is how many uniques there are within each dimension. In the first there can only be 1 unit per player, in the second there can only be (number of unique units that exist), in the third there can only be units that can't outrun a tracking location.
The other dilemma is what you're willing to let be unique (and accordingly rare). For instance, the third method attempts to let units be as plentiful as you have locations for (the problem is which units you can use).

## Counter vHP

Counter vHP is a method where variable counters are used to represent a unit or group of units' vHP as a purely numeric variable. They can range from custom score counters to death counters and can be displayed by modifying the amount of HP the affected unit has, by showing the numeric values in the mineral/gas/scoreboard, or even by creating Minimap Graphics that display numbers. Counter vHP is also often used in conjunction with Burrowed Unit vHP. Unlike the other methods of vHP, Counter vHP disallows the use of enemy units' weapons from directly affecting the attacked unit's vHP without a secondary source (such as a burrowed unit).

Common uses for Counter vHP would include the amount of oxygen a unit has underwater and the amount of "mana life" a summoned unit has. Counter vHP works very well in conjuntion with force or triggers affecting mutliple players, because minerals and death counters can be streamlined to affect "current player."

A good way of doing minimap graphics is to have multiple death counters (1 for each digit) and create a system to carry over numbers in 10s, 100s etc. For each number on the death counter (0-9) have a trigger that gives the correct units to the correct player in this fashion. Have a setup of units resembling a digital clock and locations for each of the seven glowing areas. To make them glow you can use a controlling player with a lighter colour.

## Burrowed unit vHP

Burrowed unit vHP is a vHP method where burrowed units (and sometimes flying units, despite the name) such as a Zergling or Spider Mine is used as a physical counter to represent a unit or group of units' current vHP. Unlike Counter vHP, Burrowed Unit vHP allows the use of unit weapons to directly influence the vHP of a target. Burrowed unit HP does not function to high standards, as moving the burrowed units causes the player on top to be slowed and have choppy movement. Air units cause the same effect, as well as blurring the unit. If burrowed units are used in conjuntion with an air unit player, advanced triggering and hypertriggers can be used so that the air unit is unable to go in to impassable terrain, because the burrowed units will be unable to move under the air unit. A simple detect and move back trigger can be used to make walls impassable. This is the only way of using burrowed unit vHP that does not cause movement problems.

## Multiple life vHP

Multiple life vHP is a simpler method of vHP in which a "life counter" represents the amount of vHP a unit has and loses vHP (as well as respawning) when the unit dies. Most bound maps and some types of RPGs use this method of vHP. It is a good strategy to place the units in a "bar" and eliminate them one by one. Once again advanced triggers may be used to have the buildings/units regenerate. If every building is in one big location, then a move or destroy or give trigger will affect the leftmost one, meaning that to go from right to left a location must be moved on to the leftmost unit.

## Virtual armor

Virtual Armor (vArmor for short) is a vHP subsystem where damage from vHP is reduced or eliminated. VArmor is commonly used in RPG maps that use vHP due to the ability to completely control the damage I/O via triggers, which is more effective than StarCraft's built-in armor system. As long as you have an armor variable, use of death counters or unit counters can be employed to calculate damages.

Another method would be to have the burrowed units under the hero being able to have up to 100 hp and like that, when creating a new burrowed unit under the hero, you can set its life by % thus giving him some kind of armor. Of course, you would have to constantly set its life to that count so it does not clear the armor's effects and/or make it stronger.