Jump to content

Formulas

From pr0game Wiki
This is the approved revision of this page, as well as being the most recent.

Formulas

Central overview of all formulas verified in the pr0game source code. Details, derivation and parameter tables are on the respective linked individual page — this page only has the compact mathematical notation for quick reference.

Distance

Distance between two coordinates. Used in Flight Time, Fuel Consumption, Missile Flight Time (special case, see there). Source: getTargetDistance().

Different galaxy (standard universe type): d=|g1g2|Fgalaxy

Different galaxy (ring universe, uni_type=2): d=Fgalaxy

Different galaxy (linear universe, uni_type=1): d={|g1g2|Fgalaxyif |g1g2|<Gmax/2(Gmax/2(|g1g2|Gmax/2))Fgalaxyotherwise

Same galaxy, different system (analogous ring/linear/standard, plus additive constant): d=|s1s2|Fsystem+Ksystem

Same system, different planet: d=|p1p2|Fplanet+Kplanet

Same planet (planet↔moon): d=5

Flight Time

Flight duration of a normal fleet. Used for every fleet dispatch as well as in the fuel consumption formula. Source: getMissionDuration().

t=max(1vgame[35000.1f10dvship+10]bFlyTime, 5)

f = speed factor (10–100%), vship = speed of the slowest ship, bFlyTime = optional player bonus (default 1), minimum value 5 seconds.

Missile Flight Time

Its own, simpler flight time formula for Interceptor Missiles/Interplanetary Missiles — depends only on system distance. Source: getMIPDuration().

t=max(round(30+60dsystemvgame), 5)

Game Speed

Global speed factor, feeds into Flight Time and Missile Flight Time. Configurable per universe (fleet_speed). Source: getGameSpeedFactor().

vgame=fleet_speed2500

Fuel Consumption

Deuterium consumption of a flight mission, calculated per ship type and summed up. Used for every fleet dispatch. Source: getFleetConsumption().

r=35000max(tvgame10, 1)10dvship

c=cbasend35000(r10+1)2

Sum over all ship types in the fleet, multiplied by the attacker's honor points fuel factor, rounded up:

C=(c)FHP,fuel+1

Build Cost Per Level

Cost scaling for buildings and research (not for ships/defense — those cost a constant amount per unit built, see respective unit page). Used on all building/research pages. Source: uni1_vars.factor/cost901-911.

K(n)=K1fn1

K1 = base cost (level 1), f = cost factor (typically 1.5–2.0, varies per building), n = target level.

Production Formula (Example: Metal Mine)

Resource production per building and level — the specific formula is listed individually on each building page under "Production Formula" (from uni1_vars.production901-911). Used for Metal Mine and all other producing buildings.

P(n)=30n1.1n0.1Fmaximizer

n = building level, Fmaximizer = bonus from Production Maximization Metal, Production Maximization Crystal and Production Maximization Deuterium

Storage Formula (Example: Metal Storage)

Storage capacity per building and level — listed individually on each storage building page under "Storage Formula" (from uni1_vars.storage901-903). Used for Metal Storage and the other resource storage buildings.

L(n)=2.51.833n5000

Honor Points Fuel Discount

Discount on your own fuel consumption depending on your own honor points rank. See Honor Points for details. Source: calculate_honorpoints_boost().

FHP,fuel={0.80Grand Emperor (15,000 HP)0.88Emperor (2,500 HP)0.95Starlord (500 HP)1.00neutral

Honor Points Plunder Factor

Multiplier on the base plunder rate (50% per resource) depending on the honor points of the attacked target. See Honor Points for details. Source: calculate_honorpoints_decrease() + BattleHandler.php.

plunder rate=50%{1.0neutral1.2Bandit (500 HP)1.6Banditlord (2,500 HP)2.0King of the Bandits (15,000 HP) or pirate base

Resource Protection

Share of daily production that is protected from plunder regardless of the plunder rate. Used in every battle involving resource plunder, depending on the respective storage building level (see Metal Storage, Crystal Storage, Deuterium Tank). Source: BattleHandler.php.

S=Pdaymin(0.1, 0.01Lstorage)

Pday = daily production of the respective resource, Lstorage = level of the associated storage building (max. 10% protection from level 10 onward).