![]() | Formulas |
This document describes all formulas and processes used in PHost. It is intended for players who do not leave anything to chance. If you believe that some aspect of PHost operation should be documented in this file but is not, send mail to the PHost group and bring this to our attention.
The sequence of events is documented on the Host Sequence page.
This document is organized by initiator of an action. For example, Pillage is a ship mission, so it is documented in the ships section. Combat is an exception because it applies to ships as well as planets.
Variable names (Hull_mass, Native_race, ...) should be self-explanatory. We use common arithmetic notation. In particular, / is a floating-point division.
Configuration options are specified verbatim, with links to their description. Eff_ConfigOption denotes the value of the ConfigOption modified by experience modifiers EModConfigOption.
Trunc(X) | Truncate X to integer (remove fractional part) |
Round(X) | Round X to integer (round towards nearest integer; round up if ends in .5 exactly) |
ERnd(X) | Round X to integer (round towards nearest integer; round towards nearest even number if ends in .5 exactly) |
Sqrt(X) | Square-root of X |
Exp(X) | Exponential of X (2.7182^X) |
Ln(X) | Natural logarithm of X |
Random(X) | Random number, between 0 (inclusive) up to X (not inclusive). For example, Random(3) yields one of 0, 1, 2. |
Trunc(100 - 2*Damage/3) if ship is Lizard Trunc(100 - Damage) otherwise
Hull_mass + Trunc(ESB_Rate * Engine_cost / 100) ...plus 50 if ship is FedThe Engine_cost is the monetary cost of one engine of the ship. The ESB_Rate is the sum of the following components:
Beam_count = Ship_beams if ship is Fed Min(Ship_beams, Max_beams - Trunc(Max_beams * Damage / Divisor) Tube_count = Ship_tubes if ship is Fed Min(Ship_tubes, Max_tubes - Trunc(Max_tubes * Damage / Divisor) Bay_count = Ship_bays if ship is Fed Max_bays - Trunc(Max_bays * Ship_damage / Divisor) Divisor = 150 if ship is Lizard 100 otherwiseMax_beams, Max_tubes and Max_bays are the maximum amounts allowed by the ship's hull.
A planet's defense is reduced if the planet gets damaged.
Eff_Planet_Defense = Trunc(Planet_Defense * (100 - Damage) / 100) Eff_Base_Defense = Trunc(Base_Defense * (100 - Damage) / 100) Eff_Total_Defense = Trunc((Base_Defense + Planet_Defense) * (100 - Damage) / 100)
A base's tech level is reduced if the base gets damaged. Here's the formula for beam tech, it applies to the other areas as well.
Eff_Beam_Tech = Beam_Tech ...at most Trunc((100 - Base_damage) / 10) ...at least 1
Planet's equipment in combat:
Combat_mass = 100 + Eff_Planet_Defense ...plus Eff_Base_Defense if base exists Beam_type = Round(Sqrt(Eff_Planet_Defense / 2)) if no base Max(above, Eff_Beam_Tech) if base present Beam_count = Round(Sqrt(Eff_Total_Defense / 3)) ...at most 10 if AllowAlternativeCombat is off ...at most 20 if AllowAlternativeCombat is on Torp_type = Round(Sqrt(Eff_Planet_Defense / 2)) if no base Max(above, Eff_Torp_Tech) if base present Tube_count = Round(Sqrt(Eff_Total_Defense / 4)) ...at most 20 Torp_count = Tube_count * PlanetaryTorpsPerTube ...plus Trunc(Base_torp_cost / Torp_money_cost(Torp_type)) if base present ...at most 255 Base_torp_cost = Torp_money_cost(1) * Torps_in_storage(1) + Torp_money_cost(2) * Torps_in_storage(2) ... + Torp_money_cost(10) * Torps_in_storage(10)
Beam_hit_odds = Eff_BeamHitOdds + Trunc((Beam_Kill_Power + Beam_Expl_Power) * Eff_BeamHitBonus / 100) Beam_recharge_rate = BeamRechargeRate + Trunc((Beam_Kill_Power + Beam_Expl_Power) * Eff_BeamRechargeBonus / 100) Beam_recharge_per_tick = Random(Beam_recharge_rate) Torp_hit_odds = Eff_TorpHitOdds + Trunc((Torp_Kill_Power + Torp_Expl_Power) * Eff_TorpHitBonus Torp_recharge_rate = Eff_TubeRechargeRate + Trunc((Torp_Kill_Power + Torp_Expl_Power) * Eff_TubeRechargeBonus Torp_recharge_per_tick = Random(Torp_recharge_rate) Bay_recharge_rate = Eff_BayRechargeRate + Eff_BayRechargeBonus * Num_Bays Bay_recharge_per_tick = Random(Bay_recharge_rate)
Eff_XXX means the effective value of a configuration option, which consists of the actual configuration value plus the experience modifier of the unit using the weapon.
Every weapon hit is defined by three values:
Beams: The Expl_Power and Kill_Power are taken from the weapon definition. A beam emits death rays if its Expl_Power is zero. If the owner of the weapon is Privateer, the Kill_Power is tripled. The beam's charge affects its power; a beam fired at charge 600 has only 60% of its normal power.
Torpedoes: The Expl_Power and Kill_Power are taken from the weapon definition. If AllowAlternativeCombat is off, the values are doubled (note that some clients already display the doubled values). A torpedo emits death rays if its Expl_Power is zero.
Fighters: The Expl_Power and Kill_Power is defined by FighterBeamExplosive and FighterBeamKill, respectively. Fighters never fire death rays.
Shield_damage = (Expl_Power * Eff_ShieldDamageScaling + Kill_Power * Eff_ShieldKillScaling) / (Mass + 1) if AllowAlternativeCombat is on = Trunc(above + 1.5) if AllowAlternativeCombat is off Hull_damage = (Expl_Power * Eff_HullDamageScaling) / (Mass + 1) if AllowAlternativeCombat is on = Trunc(1.5 + (Shield_damage * Eff_HullDamageScaling if AllowAlternativeCombat is off / (Mass + 1)) Crew_killed = (Kill_Power * Eff_CrewKillScaling) / (Mass + 1) if AllowAlternativeCombat is on = Trunc(above + 0.5) if AllowAlternativeCombat is off ...at least 1 if AllowAlternativeCombat is off and the weapon emits Death Rays.
Eff_XXX means the effective value of a configuration option, which consists of the actual configuration value plus any experience modifier of the unit being hit (these are the defensive bonuses).
Last updated 21 October 2003.