~~Diep.io Physics
Info: {5/5 * 5} = frac{5}{5 * 5}

# Durability Formulas
# Max Health MH [HP] (the health value on the healthbar)
MH = MH{sub="0"} + 2 × lvl + 20 × mh = MH{sub="0"} + 2 × (lvl + 10 × mh)

MH{sub="0"} - Base Max Health (health at lvl 0)
lvl - Level
mh - Max Health Stat

# Body Strength BS [1] (the scale in which the damage done to an object increases)
BS = 1 + {1/5} × bd

bd - Body Damage Stat

# Durability D [S] (the combination of max health and body damage in one formula so it's easier to compare it to a bullet/trap/drone)
D = {1/4} × MH × BS

MH - Max Health
BS - Body Strength

# Durability Bullet D{sub="b"} [S] (the bullet equivalent of durability)
D{sub="b"} = Bf × ({7/10} + {3/10} × dm) × (1 + {3/4} × bp) = Bf × DS × PP

Bf - Bulletfactor
dm - Bullet Damage Stat
bp - Bullet Penetration Stat
DS - Bullet Strength
PP - Penetration Potential

# The 3 laws of Collision Mechanics
1. Every object deals a specific and constant amount of damage per loop.

2. If the HP of an object is lower then the DPL (DPL'') of the opponent the corresping DPL of it is proportional to the ratio of its health and the opponent's DPL (DPL'').

GH ≤ DPL′′ → DPL ∼ {GH/DPL′′}

3. Every collision can only last a natural number of loops.

fundamental equation:
GH{sub="L"} = GH′′ × {DPL′′/DPL}

GH{sub="L"} - General Health Loss per Loop

# General Durability D [S] (combines the previous two durability formulas into one general equation)
D = {1/80} × GH × DPL

GH - General Health
DPL - Damage per Loop

# Bullet Penetration BP [HP] (the bullet health in terms of HP)
BP = 20 × {Bf/Df} × PP = 20 × Pf × PP
with Bf = Df × Pf

Bf - Bulletfactor
Df - Damagefactor
Pf - Penetrationfactor
PP - Penetration Potential

# Penetration Potential PP [1] (the scale in which the bullet health increases)
PP = 1 + {3/4} × bp

bp - Bullet Penetration stat

# Bullet Strength DS [1] (the scale in which the damage per loop increases)
DS = {7/10} + {3/10} × dm

dm - Bullet Damage Stat

# Reload BR [{1/s}] (the amount of bullets/drones/traps, a tank produces, per second)
BR = {1/D{sub="b"}} × ({D{sub="o"}/t} + RR)

Necromancer:
N{sub="D"} = 22 + 2 × br

D{sub="b"} - Durability Bullet
D{sub="o"} - Durability Object
t - Time
RR - Regeneration
N{sub="D"} - Number of Necromancer Drones
br - Reload Stat

# Reload Time RT [s] (the amount of time a tank needs to produce 1 bullet/drone/trap)
RT = {1/BR}

@ Reload-Loop-Equation [x]:
RT = [{X{sub="0"}/1,875{super="br"}}]

BR - Reload
X - Reload Time in multiples of 0,04s
X{sub="0"} - Technical Base Reload Time
br - Reload Stat'

# Recoil Rc [gu] (the amount of gridsquares a tank will get pushed by one single bullet it shoots)
Rc = {s/BR × t}
Rc = {ρ/BR}

@ Reload Speed V{sub="Rc"} [{gu/s}]:
V{sub="Rc"} = Rc × BR = {Rc/RT}

s - Distance
BR - Reload
t - Time
ρ - Radius
RT - Reload Time

# Regeneration RR [{S/s}] (the amount of HP an object gets every second back)
RR = {1/30} × D × ({3/100} + {12/100} × rr)

@ Regenerated Durability per Loop HPT [{S/x}]:
DT = {1/25} × {1/30} × D × ({3/100} + {12/100} × rr)

@ Regenerated Health per Loop HPT [{HP/x}]:
HPT = {1/25} × {1/30} × MH × ({3/100} + {12/100} × rr)

@ Regenerated Health per Second HPS [{HP/s}]:
HPS = {1/30} × MH × ({3/100} + {12/100} × rr)

@ for mh = 0 and lvl 11:
RR = {1/30} × ({144/100} + {6/100} × lvl + {84/10} × rr)

@ for shapes:
RR = 0

D - Durability
rr - Regeneration Stat
MH - Max Health
mh - Max Health Stat
lvl - Level

# Health Loss MH{sub="L"} [HP] after one collision from a bullet: (the amount of HP an object will lose after a bullet transfered all it's damage to it)

@ general formula:
GH{sub="L"} = {80 × D′′/DPL}

@ for tanks:
MH{sub="L"} = {4 × D{sub="b"}/BS}

@ for spike:
MH{sub="L{sub="S"}"} = {4 × D{sub="b"}/BS{sub="S"}}

@ for bullets:
BP{sub="L"} = 20 × {D["′′" + "{sub="b"}"]/Df × DS}

GH{sub="L"} - General Health Loss
D′′ - Durability Opponent
DPL - Damage per Loop
BS - Body Strength
MH{sub="L{sub="S"}"} - Health loss Spike
BS{sub="S"} - Body Strength Spike
BP{sub="L"} - Bullet Health loss
Df - Damagefactor
D["′′" + "{sub="b"}"] - Bullet Durability Opponent
DS - Bullet Strength

# Damage reduction dr [1] (the resistant of a tank against hostile objects)

@ general formula:
dr = 1 - {DPL{sub="0"}/DPL}

@ damage reduction tank / shapes:
dr = 1 - {4/10 × BS}

@ for spike:
dr = 1 - {4/10 × BS{sub="S"}}

DPL{sub="0"} - Base Damage per Loop
DPL - Damage per Loop
BS - Body Strength
BS{sub="S"} - Body Strength Spike

# Damage reduction bullet dr{sub="b"} [1]
dr{sub="b"} = 1 - {4/2 × Df × DS}

Df - Damagefactor
DS - Bullet Strength

# Acceleration A [{du/x^2}] (the change of velocity per second)
A = A{sub="0"} × {1,07{super="v{sub="m"}"}/1,015{super="lvl"}}

@ for Tanks:
A{sub="0"} = 2,58825

A{sub="0"} - Base Acceleration

# Movement Speed V{sub="M"} [{gu/s}] (the amount of gridsquares an object travels in one second)
V{sub="M"} = {s/t}

@ General Top Speed V{sub="M{sub="T"}"} [{gu/s}]:
V{sub="M{sub="T"}"} = 10 × A0

@ Top Speed V{sub="M{sub="T"}"} in [{gu/s}]:
V{sub="M{sub="T"}"} = 5 × 2,58825 ∗ {1,07{super="v{sub="m"}"}/1,015{super="lvl"}}

@ Top Speed V{sub="M{sub="T"}"} in [{du/x}]:
V{sub="M{sub="T"}"} = 10 × 2,58825 × {1,07{super="v{sub="m"}"}/1,015{super="lvl"}}

s - Distance
t - Time
A{sub="0"} - Acceleration
v{sub="m"} - Movement Speed Stat
lvl - Level

# Damage per second DPS [{S/s}] (the amount of damage a tank deals in one second)
DPS = D{sub="b"} × BR

D{sub="b"} - Durability Bullet
BR - Reload

# Damage per loop DPL [{HP/x}] (the amount of damage a bullet can deal to an hostile object during one contact)

@ general formula:
DPL = 4 × Df × DS

@ for all other bullets:
DPL = 10 × Bf × DS

@ for triplet:
DPL = {10/0,7} × Bf × DS

@ for twin:
DPL = {100/9} × Bf × DS

@ for skimmer (small bullet),rocketeer (main bullet):
DPL = 2 × √{50 × Bf} × DS

@ for skimmer (main bullet),rocketeer (small bullet):
DPL = {10/3} × Bf × DS

@ for gunner (manuall bullet):
DPL = {1/3} × √{1000 × Bf} × DS

@ for drones / destroyer / hybrid (bullet) / annihilator:
DPL = 5 × Bf × DS

@ for necromancer:
DPL = 20 × Bf × DS

@ for factory (drone bullet):
DPL = 25 × Bf × DS

@ for factory (drone):
DPL = 2,5 × Bf × DS

@ for traps:
DPL = √{50 × Bf} × DS

@ for tanks / shapes:
DPL = 20 × BS

@ for spike:
DPL = 20 × BS{sub="S"}

Df - Damagefactor
Bf - Bulletfactor
DS - Bullet Strength
BS - Body Strength
BS{sub="S"} - Body Strength Spike

# Angular velocity ω [{1/s}] (the angular velocity the tankbarrel has while autospin is on)
ω = {2 × π/t{sub="r"}} = 1
with t{sub="r"} = 2 × π

π - 3,14159265...
t{sub="r"} - Time for one Rotation

# Bullet speed V{sub="b"} [{gu/s}]
V{sub="b"} = {ρ{sub="V{sub="b"}"}/t{sub="b"}}

@ for drone classes:
V{sub="b"} = ρ × ω

ρ{sub="V{sub="b"}"} - Distance an Bullet can fly before Decay
t{sub="b"} - Time until Decay
ρ - Radius
ω - Angular Velocity

# Area damage density u [{S/gu^2 × s}] (the amount of damage the entire area covered with bullets deals in one second. (also an good estimate for how good you will block enemy bullets))
u = {DPS/a} = {180 × D{sub="b"} × BR/arcsin({h/V{sub="b"} × t{sub="b"}}) × π × (V{sub="b"} × t{sub="b"})^2}

DPS - Damage per Second
a - Area
D{sub="b"} - Durability Bullet
BR - Reload
h - Height of the Triangle
V{sub="b"} - Bullet Speed
t{sub="b"} - Time until Decay
π - 3,14159265...

# Scattering rate w [1] (the amount of inaccuracy a bullet has of hitting its target)
w = {h/ρ{sub="v{sub="b"}"}}

h - Height of the Triangle
ρ{sub="V{sub="b"}"} - Distance an Bullet can fly before Decay

# Probability to get target by a dominator p(D) [1] (the titel says it all)
p(D) = {(ρ{sub="a"} − S{sub="n"})/(N × ρ{sub="a"} − ∑[N][1] S{sub="i"})}

@ quadratic assumption:
p(D) = {(ρ{sub="a"} − S{sub="n"})^2/(N × ρ["{super="2"}" + "{sub="a"}"] + ∑[N][1] S{sub="i"}{super="2"} − 2 × ρ{sub="a"} × ∑[N][1] S{sub="i"})}

ρ{sub="a"} - Activition Radius Dominator
S{sub="n"} - Distance to the Dominator
N - Number Players closer to the Dominator than ρ{sub="a"}

# Knockback KB [gu] (the amount of gridsquares a tank will get pushed by a hostile object)
KB = L × Kf × DS = [{BP/DPL′′}] × Kf × DS

@ for Drones/Tank Bodies:
{KB/L} = constant for all dm/bd

L - Number of Loops
Kf - Knockbackfactor
DS - Bullet Strength
BP - Bullet Health
DPL′′ - Damage per Loop Opponent
dm - Bullet Damage Stat
bd - Body Damage Stat

# Size Z[gu] (the diameter of the tank)
Z = 2 × 1,01^{lvl - 1}

lvl - Level

# Field of view FOV [gu^2] (the area a player can see on the map at any given time)
FOV = {1/Ff^2} × ({1920/0,55} × √{1,01}^{lvl − 1}) × ({1080/0,55} × √{1,01}^{lvl − 1}) = {1/Ff^2} × {1920 × 1080/0,55^2} × √{1,01}^{lvl − 1}

Ff - Fieldfactor
1920 × 1080 - Resolution of the screen
0,55 - Conversionfactor between Pixel and du
lvl - Level

# Arena Length AL [gu] (the length of one side of the arena excluding the grey)
AL = [√{N{sub="P"}} × 50]

N{sub="P"} - Number of Players
[...] - rounded down to the nearest even integer

# Shape Count N{sub="SH"} [1] (the number of shapes inside an arena)
N{sub="SH"} = [12,5 × N{sub="P"}]

N{sub="P"} - Number of Players

-----
Unit System of Diep:
Unit of time|t:Second[s]
Unit of loop|L:Loop[x] = {1/25}s
Unit of distance (squares on the grid)|s:GridUnits[gu];DiepUnits[du]={1/50}gu
Unit of general health (can be MH or BP)|GH:HealthPoints[HP]
Unit of max health|MH:HealthPoints[HP]
Unit of penetration|BP:HealthPoints[HP]
Unit of Durability (equal to 1 hit from a Square)|D:Squares[S]
[1] means it's dimensionless

-----
# Tanks Bulletfactor (the comparison to a basic bullet)
Tanks|Bulletfactor
Destroyer, Annihilator, Hybrid (Bullet)|6
Mega Trapper|5,12
Rocketeer (Large Bullet)|5
Skimmer (Large Bullet)|3
Factory (Drone)|2,8
Trapper, Tri-Trapper, Overtrapper (Trap), Gunner Trapper (Trap), Auto Trapper (Trap)|2
Overlord, Overseer, Manager|1,4
Basic Tank, Flank Guard, Sniper, Assasin, Ranger, Stalker, Tri-Angle (Front Bullet), Booster (Front Bullet), Fighter (Front Bullet), Spread Shot (Large Bullet)|1
Hybrid (Drone), Overtrapper (Drone)|0,98
Necromancer|0,84
Fighter (Side Bullet)|0,8
Quad Tank, Hunter, Predator|0,75
Machine Gun, Triple Shot, Sprayer (Large Bullet)|0,7
Octo Tank|0,65
Spread Shot (Small Bullet)|0,6
Twin|0,585
Penta Shot|0,55
Twin Flank, Triple Twin, Gunner Trapper (Bullet)|0,5
Triplet|0,42
Auto 3, Auto 5|0,4
Auto Gunner (Auto Bullet), Auto Trapper (Auto Bullet), Auto Smasher (Auto Bullet)|0,3
Gunner, Auto Gunner (Manual Bullet)|0,225
Streamliner, Tri-Angle (Rear Bullet), Booster (Rear Bullet), Fighter (Rear Bullet)|0,2
Skimmer (Small Bullet), Rocketeer (Small Bullet)|0,18
Factory (Drone Bullet)|0,16
Battleship|0,15
Sprayer (Small Bullet)|0,1

# Tanks Damagefactor
Tanks|Damagefactor|Damage per Loop (1 dm)
Destroyer, Annihilator, Hybrid (Bullet)|7,5|30 HP
Necromancer|4,2|16,8 HP
Mega Trapper|4|16 HP
Basic Tank, Flank Guard, Sniper, Assasin, Ranger, Stalker, Tri-Angle (Front Bullet), Booster (Front Bullet), Fighter (Front Bullet), Spread Shot (Large Bullet), Trapper, Tri-Trapper, Overtrapper (Trap), Gunner Trapper (Trap), Auto Trapper (Trap), Skimmer (Large Bullet), Rocketeer (Large Bullet)|2,5|10 HP
Fighter (Side Bullet)|2|8 HP
Quad Tank, Hunter, Predator|1,875|7,5 HP
Machine Gun, Triple Shot, Sprayer (Large Bullet), Overlord, Overseer, Manager, Factory (Drone), Hybrid (Drone), Overtrapper (Drone)|1,75|7 HP
Octo Tank, Twin|1,625|6,5 HP
Triplet, Spread Shot (Small Bullet), Skimmer (Small Bullet), Rocketeer (Small Bullet)|1,5|6 HP
Penta Shot|1,375|5,5 HP
Twin Flank, Triple Twin, Gunner Trapper (Bullet), Gunner, Auto Gunner (Manual Bullet)|1,25|5 HP
Auto 3, Auto 5, Factory (Drone Bullet)|1|4 HP
Auto Gunner (Auto Bullet), Auto Trapper (Auto Bullet), Auto Smasher (Auto Bullet)|0,75|3 HP
Streamliner, Tri-Angle (Rear Bullet), Booster (Rear Bullet), Fighter (Rear Bullet)|0,5|2 HP
Battleship|0,375|1,5 HP
Sprayer (Small Bullet)|0,25|1 HP

# Tanks Penetrationfactor
Tanks|Penetrationfactor|Bullet Health (0 bp)
Rocketeer (Large Bullet)|2|40 HP
Factory (Drone)|1,6|32 HP
Mega Trapper|1,28|25,6 HP
Skimmer (Large Bullet)|1,2|24 HP
Annihilator, Hybrid (Bullet), Destroyer, Trapper, Tri-Trapper, Overtrapper (Trap), Gunnertrapper (Trap), Auto Trapper (Trap), Overlord, Overseer, Manager|0,8|16 HP
Hybrid (Drone), Overtrapper (Drone)|0,56|11,2 HP
Basic Tank, Flank Guard, Machine Gun, Sniper, Assassin, Ranger, Stalker, Tri-Angle, Booster, Fighter, Spread Shot,Quad Tank, Hunter, Predator, Octo Tank, Penta Shot, Twin Flank, Triple Twin, Gunner Trapper (Bullet), Triple Shot, Auto 3, Auto 5, Streamliner, Battleship, Sprayer, Auto Gunner (Auto Bullet), Auto Gunner (Auto Bullet), Auto Smasher (Auto Bullet)|0,4|8 HP
Twin|0,36|7,2 HP
Triplet|0,28|5,6 HP
Necromancer|0,2|4 HP
Gunner, Auto Gunner (Manuell Bullet)|0,18|3,6 HP
Factory (Drone Bullet)|0,16|3,2 HP
Rocketeer (Small Bullet), Skimmer (Small Bullet)|0,12|2,4 HP

# Tanks Knockbackfactor (the knockback per bullet at 1dm)
Tanks|Knockbackfactor|Knockback per Loop (1 dm)
Smasher, Landmine, Spike, Auto Smasher (Body), All Tank Bodies|-|1,6 gu
Overseer, Overlord, Manager, Necromancer, Factory (Drone), Hybrid (Drone), Overtrapper (Drone)|-|0,8 gu
Mega Trapper|1,0666...|1,0666... gu
Basic Tank, Flank Guard, Sniper, Assasin, Ranger, Stalker, Tri-Angle (Front Bullet), Booster (Front Bullet), Fighter (Front Bullet), Spread Shot (Large Bullet), Trapper, Tri-Trapper, Overtrapper (Trap), Gunner Trapper (Trap), Auto Trapper (Trap)|0,666...|0,666... gu
Fighter (Side Bullet)|0,5333...|0,5333... gu
Quad Tank, Hunter, Predator|0,5|0,5 gu
Machine Gun, Triple Shot, Sprayer (Large Bullet)|0,4666...|0,4666... gu
Octo Tank, Twin|0,4333...|0,4333... gu
Triplet, Spread Shot (Small Bullet), Skimmer (Small Bullet), Rocketeer (Small Bullet)|0,4|0,4 gu
Penta Shot|0,3666...|0,3666... gu
Twin Flank, Triple Twin, Gunner Trapper (Bullet)|0,333...|0,333... gu
Auto 3, Auto 5, Factory (Drone Bullet)|0,2666...|0,2666... gu
Auto Gunner (Auto Bullet), Auto Trapper (Auto Bullet), Auto Smasher (Auto Bullet), Destroyer, Hybrid (Bullet)	0,2	0,2 gu
Streamliner, Tri-Angle (Rear Bullet), Booster (Rear Bullet), Fighter (Rear Bullet)|0,1333...|0,1333... gu
Battleship, Annihilator|0,1|0,1 gu
Sprayer (Small Bullet), Skimmer (Large Bullet), Rocketeer (Large Bullet)|0,0666...|0,0666... gu

-----
# Tanks Fieldfactor (the comparison to basics FOV)
Tanks|Fieldfactor
Ranger|0,7
Assassin, Stalker|0,8
Hunter, Streamliner, Predator|0,85
Sniper, Overseer, Overlord, Necromancer, Manager, Overtrapper, Battleship, Factory, Trapper, Tri-Trapper, Gunner Trapper, Mega Trapper, Overtrapper, Auto Trapper, Smasher, Landmine, Auto Smasher, Spike, Skimmer, Rocketeer|0,9
All other tanks|1

-----
# Tanks Recoil (the recoil per bullet)
Tanks|Recoil
Annihilator|6,8 gu
Destroyer, Hybrid (Bullet)|6 gu
Sniper, Assasin, Ranger, Stalker, Skimmer (Large Bullet), Rocketeer (Large Bullet)|1,2 gu
Fighter (Rear Bullet), Booster (Inner Rear Bullet), Tri-Angle (Rear Bullet)|1 gu
Basic, Machine Gun, Gunner Trapper (Trap/Bullet), Sprayer (Large Bullet), Manager, Factory (Drone), Overtrapper, Hybrid (Drone), Tri-Trapper, Mega Trapper, Auto Trapper (Trap), Factory (Drone Bullet)|0,4 gu
Twin|0,3 gu
Penta Shot|0,28 gu
Triplet|0,2 gu
Auto 3, Auto 5, Auto Smasher (Auto Bullet), Auto Gunner (Auto Bullet), Auto Trapper (Auto Bullet), Hunter, Predator|0,12 gu
Streamliner, Gunner, Auto Gunner (Manual Bullet), Tri-Angle (Front Bullet), Fighter (Front Bullet), Booster (Front Bullet), Booster (Outer Rare Bullet)|0,08 gu
Spread Shot (Large/Small Bullet)|0,04 gu
Sprayer (Small Bullet)|0 gu

# Tanks Technical Reload Time
Tanks|Technical Reload Time|Reload Time (0 br)
Rocketeer (Small Bullets)|3 x|0,12 s
Skimmer (Small Bullets)|5,4 x|0,24 s
Machine Gun, Sprayer (Large Bullet)|7,5 x|0,32 s
Basic, Twin, Flank Guard, Triple Shot, Twin Flank, Octo Tank, Quad Tank, Tri-Angle, Booster, Fighter (Front/Rear Bullet), Auto 3, Auto 5, Triple Twin, Penta Shot, Triplet, Gunner, Auto Gunner (Manual/Auto Bullet), Streamliner, Gunner Trapper (Bullets), Auto Smasher (Auto Bullet), Auto Trapper (Auto Bullet), Battleship, Factory (Drones), Sprayer (Small Bullet)|15 x|0,6 s
Sniper, Fighter (Side Bullet), Trapper, Tri-Trapper, Auto Trapper (Trap) , Overtrapper (Trap)|22,5 x|0,92 s
Spread Shot, Assasin, Ranger, Stalker|30 x|1,2 s
Hunter|37,5 x|1,52 s
Manager, Factory (Barrel), Gunner Trapper (Trap), Predator|45 x|1,8 s
Mega Trapper|49,5 x|2 s
Destroyer, Hybrid, Annihilator, Skimmer (Large Bullet), Rocketeer (Large Bullet)|59,9 x|2,4 s
Overlord, Overseer, Hybrid (Drone), Overtrapper (Drone)|90 x|3,6 s