PHost - Combat

PHost 4.1h



This document describes combat as implemented in PHost.

There are two types of combat in VGA Planets:

  • Regular combat happens when two units meet in space after movement. Regular combat can happen between two ships, or between a ship and a planet. Units will fire their weapons (beams, torpedoes and fighters) against each other and attempt to destroy or capture the enemy. The largest part of this document describes regular combat.
  • Ground combat happens when a ship beams down colonists to an enemy planet. Colonists will fight each other, until one party survives. That party will keep the planet. Ground combat is described in the last section of this document.

Back to top

Basic Rules

After movement is complete, ships which end up on the same position in space can engage in combat. Likewise, ships can attack planets (and their starbases) and vice versa.

The standard combat system in VGA Planets can resolve battles only using pairs of two units (i.e. two ships, or a ship and a planet): if you have multiple ships attacking a common enemy, they'll all fight that enemy one after the other. Your most important tactical utility is battle order, i.e. the order in which your ships fight. You can set that order using friendly codes. PHost implements a similar battle order system as HOST 3.20.

There are a number of fleet combat systems which resolve combat in a completely different way: all ships at once. Those are not part of PHost, and are not described here. There also are a few alternative 1:1 combat systems which basically behave similarily to PHost.

Who will fight?

Here are some basic rules concerning who will fight. More details are below in the phase descriptions:

  1. Units must be at the very same position (same X,Y) on the map to be able to fight.
  2. Fuel-less ships cannot attack.
  3. Fuel-less ships cannot be attacked (except by planets with friendly code NUK).
  4. You will attack all enemy ships when you have mission Kill. You can choose to attack only one race by selecting them as Primary Enemy (and not using the kill mission); recent PHosts allow you to combine that with a permanent global enemy setting. If you have neither the Kill mission, nor a Primary enemy, you will not attack anyone. You'll still defend yourself when attacked. You cannot attack players whom you have offered a combat level alliance.
  5. Cloaked ships cannot be attacked.
  6. Cloaked ships can attack other ships if so configured (AllowCloakedShipsAttack), but cloaked ships cannot attack planets.
  7. Objects with matching friendly codes do not attack. Remember that special friendly codes never match.
  8. (v4.0k:) Units will not attack each other if they have no offensive potential against their opponent. This rule applies in two cases: (a) Two freighters will never attack each other, nor will ships without ammunition and beams. (b) A ship will not attack an unarmed planet if it has only death rays. Death rays are ineffective against planets.
  9. If a planet takes part in combat, and that planet has a starbase, those will combine their power and fight as one unit. It is not possible to attack (or defend with) just the planet or just the starbase.

Battle Order

Once PHost has determined what units will fight at a particular place, it will sort the list according to battle order values. You can choose battle order values for your units by using (numeric) friendly codes.

  1. If your friendly code consists of only digits, that's the battle order value. This can be used to enter values between 000 and 999.
  2. The friendly code can also start with a minus sign, yielding values between -99 and -00.
  3. A planet with ATT or NUK will have a battle order value of zero.
  4. Planets with other non-numeric friendly codes have a value of 1001 if they have defense posts, 1003 if they have none.
  5. (v4.1e:) Ships with non-numeric friendly codes have a value of 1000 if they have weapons and are aggressive by having mission Kill or a primary enemy, 1002 if they have weapons and are not aggressive, or 1004 if they don't have any weapons at all. Note that PHost versions betfore 4.1e/3.5e did not distinguish between aggressive and non-aggressive ships, they were giving all armed ships order 1000 and all freighters order 1002.

When two units have the same battle order value, the one with the lower Id number fights first. When a ship and a planet with the same Id number and the same battle order value fight, the ship fights first.


Friendly Code Numeric Value Rules
001 1 (rule 1)
010 10 (rule 1)
01a 1000 (rule 5)
10b 1000 (rule 5)
a10 1000 (rule 5)
oof 1000 (rule 5)
5ia 1000 (rule 5)
5o9 1000 (rule 5, this is a lower-case letter "o" not the digit "zero")
-13 -13 (rule 2)
-09 -9 (rule 2)
-a5 1000 (rule 5)
-3* 1000 (rule 5)
33 33 (rule 1, since PHost 4.0h; earlier PHost versions handle only friendly codes consisting of exactly three characters and would use rule 5 here)

Back to top

Phases of Combat

Combat consists of two major phases: Intercept Attack ("XA"), and the Aggressor/Opponent Phase, also known as "normal combat".

Intercept Attack

The intercept attack phase is only run when enabled in the configuration (AllowInterceptAttack). During intercept attack, ships which reach their intercept target attack their target. A ship must fulfill all of the following conditions to be considered for intercept attack:

  1. The ship must have a valid Intercept mission.
  2. The ship must have a cloaking device. ==> Only cloak-capable ships can do Intercept Attack. The ship will not - and in fact, can not - cloak during the intercept (the common habit of calling this function "cloak intercept" is therefore highly misleading).
  3. The ship must have fuel. Ships without fuel cannot attack.
  4. The ship must have a primary enemy setting which matches the intercept target, either directly or via the enemies setting.
  5. The ship must not have offered a combat level alliance to the target. Friendly codes must not match.

The intercept target must satisfy these conditions so you can attack it:

  1. The target must have fuel. Ships without fuel cannot be attacked.
  2. The target must not be cloaked. Cloaked ships cannot be attacked.

Interceptors are processed in the correct Order of Battle. When two ships intercept the same target, the one with the lower battle order value attacks first.

(v3.4b:) In PHost 3.4a and below, as well as in HOST, intercept attack does not honor battle order. Instead, ships fight in order of decreasing interceptor Id.

==> Remember that Intercept Attack is only available for cloak-capable ships. Most ships cannot do Intercept Attack.

Aggressor/Opponent Phase

Most combat happens in the Aggressor/Opponent phase. During this phase, the following happens:

  1. Find an aggressor. This will use battle order values. We start with the ship with the lowest possible battle order value and work our way up. Each aggressor fights all its possible opponents; after that it can no longer be aggressor for this turn (but it still can be opponent).
    • A ship must have the Kill mission or a Primary Enemy to become an aggressor. It must have fuel.
    • A planet must have the ATT or NUK friendly code to become an aggressor.
  2. Find an opponent for this aggressor. This will again check all ships (and the planet, if any) in battle order.
    • The aggressor cannot fight units whom he has offered a combat level alliance. Likewise, two combatants will not fight when they have matching friendly codes.
    • If the aggressor has no Kill mission, the opponent must be of the race indicated by the aggressor's Primary Enemy.
    • Planets cannot attack Klingons and Rebels (PlanetsAttackKlingons, PlanetsAttackRebels), and they cannot attack Assault ships (i.e., the Super Star Destroyer; AllowImperialAssault).
    • Fuel-less ships can only be attacked by planets using the NUK friendly code. Fuel-less Bird Men ships with weapons cannot even be attacked by these planets.
    • A cloaked ship cannot attack planets.
    • You cannot attack cloaked ships, except when they have set their primary enemy to your race.
  3. Perform the battle between aggressor and opponent. Note that PHost will assign sides on the VCR randomly, so you can't tell from the battle alone who was the aggressor. This is unlike HOST where the aggressor will always be on the right side.
  4. If the aggressor survives, try to find another opponent (return to step 2).
  5. If the aggressor got killed or captured, or when all opponents have been exhausted, find another aggressor (return to step 1).

Back to top


Performance of a Fight

Battles are divided into battle ticks (sometimes rendered as seconds). During each tick, a certain series of events happens. The fight ends when a winner can be declared. Therefore, a battle tick is to a fight what a turn is to a game.

Ships start at a distance of 58000 meters.

  • Weapons recharge. See BeamRechargeRate etc.
  • If a ship has fighters, and has not yet exceeded the MaxFightersLaunched limit, it launches a new fighter.
  • Fighters that are close enough to their enemy will fire. Fighters that run out of ammo (StrikesPerFighter) will retreat.
  • If the ships are close enough (TorpFiringRange), torpedoes are launched. Torpedo tubes need time to recharge before they can fire again.
  • Likewise, if ships are close enough, beams are fired at enemy fighters (BeamHitFighterRange) or the enemy ship (BeamFiringRange). Beams need time to recharge before they can fire again. The more they are charged, the more damage the beams do.
  • Fighters that come close try to shoot each other down (FighterKillOdds).
  • Fighters move towards their enemy, or back to their base ship.
  • Ships move towards each other until StandoffDistance is reached.

Planets behave mostly identical to ships. They obviously cannot move in the last step, but are otherwise treated the very same way as ships.

The battle ends immediately if one of the following happens:

  • A unit exceeds the maximum damage (100% for most races, 150% for lizards).
  • A ship loses all crew.
  • Both units run out of ammunition.

New v4.1a: When a fight does not progress, PHost will cancel it. This does generally not happen in regular games, but can happen when the combat configuration has suboptimal values. PHost will cancel a fight if StandoffDistance has been reached, but no unit has taken damage, fired torpedoes, or lost fighters for 5000 battle ticks. In this case, the fight ends as if both units ran out of ammo.

Combat is not deterministic. Weapon recharge is a probabilistic process, and weapons have a certain hit/miss ratio. Therefore, many fights have no predetermined outcome. Whereas HOST has just 110 possible outcomes, PHost has a theoretical set of 65536 outcomes.

Conclusion of a Fight

If a ship ends the fight with 100% damage or more, it is destroyed, and the opponent is declared winner of the fight. This also applies to Lizard ships: although they can fight until they reach 150% damage, they cannot survive any further with more than 100% damage.

If a ship ends the fight without crew, the enemy can capture it. He will man the ship with an emergency crew of up to 10 crewmen (for simplicity, the capturing unit doesn't lose crew by doing that). The ship will become passive for further fights this turn. Unlike in HOST, planets can capture ships in PHost.

If a ship has lost shields, crew or ammunition, or got damaged in fight, it will carry over this damage to further fights this turn. Shields will be recharged for the next turn, but damage remains until you repair it. The first chance for repair is given after combat: ships can repair themselves using supplies (see Supply Repair).

If a planet ends the fight with 100% damage or more, it is captured. The fight will have destroyed all its offensive potential, so all the defense posts and the starbase will be destroyed. At the default configuration, all colonists will have been killed (see ColonistCombatSurvivalRate), and the planet will be manned with a single colonist.

Damage is handled a little different for planets compared to ships: whereas a 30% damaged Annihilation Class Cube with Mark 8 Tubes is still an Annihilation Class Cube with Mark 8 Tubes, the planet (and its starbase) will lose some of the defense posts making up its strength: if a planet with 50 defense posts gets 30% damaged, it will lose 30% of its defense, and begin the next turn with 35 defense posts. It will therefore start the next turn as an undamaged planet that happens to be weaker than the turn before. Put in other words: whereas ships keep their strength but accumulate damage, planets simply lose strength, but don't get permanent damage.

If a planet/base combo fires ammunition, it will first take the ammunition from starbase storage. The base will also receive damage and lose tech levels if too badly damaged.

See also: Combat results for ships, Combat results for planets.

Back to top

Ground Combat

Ground combat happens at the beginning of the turn, before movement, in the CargoDump stage of host processing. Ground combat happens whenever a ship unloads colonists onto a hostile planet.

Preconditions for Ground Combat:

  • The ship must be in orbit of a hostile planet. If the planet is friendly, the unloaded colonists will become part of the existing colony. If the planet is unowned, it will be colonized peacefully.
  • The ship must have fuel. Fuelless ships cannot use their cargo transporter.
  • The ship may have any mission, including cloak.

In ground combat, attacking colonists will fight the planet's inhabitants. Depending on their strength, one party will survive. Whereas attackers have only their GroundKillFactor, defenders have GroundDefenseFactor as well as a bonus from their defense posts. See Ground Combat formulas for details. If all parameters are known, ground combat is 100% deterministic.

Effects of Ground Combat:

  • Ground combat does not destroy planetary infrastructure. All defense posts and the starbase will remain intact.
  • If the planet (and thus, the starbase) changes ownership, the base's build order will be canceled, hulls in storage will be recycled, and the base's fix/recycle order will be cleared.
  • If the planet changes ownership, all its experience will be lost.
  • Other planetary properties, such as tax rates, happiness, and friendly code, do not change.

Imperial Assault is a special case of ground combat.

Back to top

Last updated 31 May 2015.

Mail for support, ideas, bug reports, questions. Contact Details