[PHost Logo]

Formulas
The Portable Host
Version 4.0d

Index

Introduction

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.

Notation

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.

Back to top


Ships

Back to top


Planets

Back to top


Combat

Starting Parameters for Ships

Starting Parameters for Planets

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)

Combat Formulas

Weapon Specs

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.

Weapon Effects

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).

Back to top


This document is maintained by The Portable Host Project[Remote] (support@phost.de).

Last updated 21 October 2003.