The Battle Manual:Weapon Charging
From PlanetsWiki
Contents |
[edit] Overview
- New: All objects start with empty systems but charge immediately when entering vcr.
- New: Even if an object "is there" but not visible it charges. I.e. re-docked wings and 2nd wave objects charge all the time even if they are waiting for (re-)entering combat.
- New: Except for the old power boost of the cloakers and the super weapons the power bank also starts empty and has to be charged by surplus energy which was left after normal charging.
- "PowerBoost Cloak" still takes place at tick 25.
- The old power boost of the super weapons still take place at tick 310 and tick 4000.
- New: Charging takes now place any single tick. There isn't a difference before or after tick 300 like it was till host212.
[edit] Ships
If Crew > 0 and Control Damage < 99,9% then charging takes place.
[edit] Normal weapon charging
- If the ship is not in power boost mode then normal charging takes place. This means if the weapons are not yet overloaded with the full energy from the power bank.
- If the Engine Damage < engine's hardness then the energy of the engines is used.
- If the Engine Damage < generator's hardness then the energy of the generators is used.
- Mivorari (if race is "activated") only use half of the generator's energy.
- Aczanny ECM Jammer drains 150GW before charging other systems.
- Then if ship's Weapon Damage < single weapon's hardness weapons are charged in this order:
- Point Defense
- If Exotic PD Boost is activated, then PD gets twice the normal charge per tick
- Small Weapons
- Large Weapons
- Ill Wind Class Battlecruiser charges LWs with 5GW extra (Hull feature not a race feature)
- Plasma Stream Enhancer on Aurora Class Flagship and Lotus Class Pursuit Ship charge a Plasma Bolt Cannon with twice the normal energy per tick (hull feature not a race feature)
- Super Weapons
- Point Defense
[edit] New: Power Bank (due to new power boost) charging
After the aforementioned charging process the charging of the power bank can take place. The conditions are
- One (or both)of the both new power boost modes is activated
- There is energy left after the aforementioned normal weapon charging
- The power boost sequence (which overloads the weapons with the full energy from the power bank) is not yet initiated
Power boost will cause the weapons to fire more quickly, at considerable danger to the ship.
Each tick a maximum amount of energy is calculated which CAN be added to the power bank. But to charge the powerbank by this amount you need 5 times the energy (Feeding the power bank wastes energy. 80% of the energy goes into void):
PL : Powerbank limit as seen in the hulls stats PB : Current power bank enegy E : Energy left after normal chanrging dE : Maximum increase of the power bank this tick dE = (5 + PL / 100) * (0.5 + RND) IF 5 * dE > E THEN PB = PB + E / 5 ELSE PB = PB + dE
Good to know:
- The charge time of a big (~10,000) power bank is ~ 100 ticks. The carge time of a small (~100) is 20.
- Only the surplus energy after normal charging is used. So consider using GF Tokamak 8080s as generators and Tylium Thrusters as engines or the charge times can even be greater.
[edit] Wings
[edit] Energy
Each single fighter type in a wing (not each fighter) has its own energy bank. So there are three energy banks if all there possible types in a wing are filled by fighters.
Each tick the following takes place for all three types:
New: EnergyBank = EnergyBank + fighterCount * fighterGenerator / g_fig(57)
IF EnergyBank > 1,000,000,000 THEN EnergyBank = 1,000,000,000
[edit] Good to know
- "g_fig(57)" is the HConfig parameter "WingChargeDivisor". The default is 50. So a single fighter uses 1/50 of the fighter generator stat to charge the weapons.
- 50 fighters with a generator value of 10 produce enough energy to fire a single beam (10GW) per tick (if the corresponding HConfig parameter "FighterBeamDrain" for the beams is 10 of course).
- New: The + 0.99 in the charging formula from Host versions prior to 213 has been dropped.
Before this change the formula was Energy = Count * Generator / 400 + 0.99 which can be written as Energy = Count * (Generator + 396 / Count) / 400
So the old formula gave a fighter type a count depending generator bonus of 396/count. For example in a micro wing of ten fighters the fighter had a generator bonus of 39.6. This bonus vanished more and more as the type count became greater and geater. Micro wings therefore were too strong. And so at many places in the code penalties for the micro wings and bonuses for the bigger wings were introduced.
Instead of this now the + 0.99 was removed together with with a re-scaling, i.e. the /400 was replaced by /50. Also all the penalties and bonuses were removed.
[edit] ORD
New:
- There is now a difference between the available ord in vcr and the displayed in the client
Here is the procedure how the wing's vcr-ord in space combat is calulated from the displayed ord in the client:
- DO for all three types:
** MaxOrd = MaxOrd + OrdCapacity (from fighter stats) * type's count
- DO for all three types
** Type's vcr-ord = Round(wing's ord (outside vcr) / MaxOrd * SQR(OrdCapacity) * type's count)
Simple spoken if a fighter can carry N ord outside vcr (like in it's stats) then in vcr it has SQR(N) ord.
Note: The SQR(OrdCapacity) is now replaced by
IFF[OrdCapacity<=4; 2 * OrdCapacity; 8 + SQR(OrdCapacity - 4)]
This gives a vcr ord bonus to all fighter types. The percentage increase decreases as the ord capacity grows. Fighter types with a ord capacity of 8 now have at least one missile shot.
There is also a hconfig parameter "Fighter Missile VCR Ord Usage" which by default 10. If one now thinks that this will lead to only a few missile shots for some types: Yes, this is true. But
1) A missles shot per type uses 100 energy. One fighter charges with generator/50 by default. So the the time to fire M missiles takes at least M x 5000/Generator. The mean generator stat is 13. The mean ord capacity 109.
2) Don't forget the "Return mode" for wings. Their carrier will load them with fresh ord.
3) One can adjust it with the aforementioned hconfig parameter.
[edit] Probable vcr ord change (host 213L)
As it has turned out that some types suffer too much from the reduced vcr ord the vcr ord will calculated with
IF OrdCapacity <= 4 THEN WingVCROrd = 2 * OrdCapacity IF OrdCapacity > 4 THEN WingVCROrd = 8 + SQR(OrdCapacity - 4)
Here is a table to demonstrate the change:
| Ord capacity | Vcr ord old | Vcr ord new | Factor of change |
|---|---|---|---|
| 1 | 1.0 | 2.0 | 2.0 |
| 2 | 1.4 | 4.0 | 2.8 |
| 3 | 1.7 | 6.0 | 3.5 |
| 4 | 2.0 | 8.0 | 4.0 |
| 5 | 2.2 | 9.0 | 4.0 |
| 6 | 2.4 | 9.4 | 3.8 |
| 7 | 2.6 | 9.7 | 3.7 |
| 8 | 2.8 | 10.0 | 3.5 (Priv T3) |
| 9 | 3.0 | 10.2 | 3.4 |
| 10 | 3.2 | 10.4 | 3.3 (Stormer T3) |
| 11 | 3.3 | 10.6 | 3.2 |
| 12 | 3.5 | 10.8 | 3.1 |
| 13 | 3.6 | 11.0 | 3.1 |
| 14 | 3.7 | 11.2 | 3.0 |
| 15 | 3.9 | 11.3 | 2.9 (Bird T3) |
| 20 | 4.5 | 12.0 | 2.7 |
| 50 | 7.1 | 14.8 | 2.1 |
| 100 | 10.0 | 17.8 | 1.8 |
| 250 | 15.8 | 23.7 | 1.5 |
| 500 | 22.4 | 30.3 | 1.4 (EE T3) |
So for example the Priv T3 now has 3.5 vcr ord more than before. One Priv T3 can now fire one missile.
With this change missile type now should have enough missiles for at least one space combat.
[edit] Charging within a Carrier
If a wings runs out of ord, is set to "return home" and if the carrier is intact and if both are not under fire then a wing can re-dock.
A "carrier" is called intact for recharging wings if
- Ship:
- crew >= 1
- system damage < 100%
- hull damage < 50%
- Base:
- base incoming <= 50 % of max base incoming
If a wing is re-docked to its carrier then it depends on the carriers abilities how long it takes until the wing can be re-launched.
This ability is calculated as follows:
Step 1
- Ship:
- NeededCrew = HullCrewSize
- Damage = ship's hull damage
- IF Borg THEN Skillz = 390 * ship's HGs + ships's skill
- IF non Borg THEN Skillz = ship's HGs / 10 + ship's skill
- Base:
- NeededCrew = 10 * wing's fighter count
- Damage = 1000 * base incoming / max base incoming
- IF Borg THEN Skillz = base HGs * 390
- Skillz = Skillz + base HGs / 10 + training centers
Step 2
NeededCrewRatio = Min(1, Crew / NeededCrew) (maximum 1) IntactLevel = 1 - Damage / 500 (minimum 0) Status = (IntactLevel + NeededCrewRatio) / 3
Step 3
Luck = Sigmoid(Skillz, 500, Status, 0.01) IF elapsed time (since re-docking) * Luck > RND * 100 THEN (evaluated each tick) * Full vcr-ord load * Full battery charge * Skill = Skill + 1 (has only a meaning for ships) * Set wing ready for re-launch * If the carrier wasn't under fire for the last ten ticks then the wing re-launches
Step 4
If the carrier is still intact then the wing re-launches. It appears where the carrier currently is and starts with the velocity vector of the carrier.
Good to know:
- The less missiles a type can shot the faster it can re-dock.
- A re-docked wing re-launches FULLY loaded (ord and battery)
- Some types have too many ord to re-dock in finite time
- Sigmoid(Skillz, 500, Status, 0.01) is a function with a sigmoid graph (curve) with respect to the argument Skillz.
- If Skillz -> -oo then Sigmoid -> 0
- If Skillz -> +oo then Sigmoid -> 1
- Around Skillz ~ 500 the output changes from 0 to 1
- Exactly at Skillz = 500 the output is Status
- At Skillz = 0 the output is 0.08
- Elapsed Time (since re-docking) * Luck / 100 is the chance per tick that the wing will be fully charged and marked as ready to re-launch
[edit] Bases
The charge formula for bases that is applied every tick is
baseE = baseE + baseGen * r
[edit] Damage Modifier
"r" is a modifier which reflects the damage state of a base. As only Base Shield, Anti-Aircraft Guns and Base Ion Cannons are directly destroyed due to incoming fire whereas the base generator value ("baseGen") depends on Colonists, Cities, Undercities and Factories, one has to take a measure of the damage of the base. This is the ratio of the damage potential of the received destructive incoming fire and the maximum a base can stand (which depends on all the ground structures a base has).
r = baseIncoming / baseMaxIncoming
[edit] Energy Generation
New: The "baseGen" (the amount of energy each tick can be added to the base energy for the weapons) depends on the number of "used" (under)cities and factories. The increase of "baseE" depends linear up to a certain base size and then grows more and more flatter:
v = baseColonists / 100000 IF v > 500 THEN v = 500 h = undercities + cities IF h > v THEN w = v ELSE w = h h = factories: h = h * h / 200000 IF h > w THEN w = 2 * w ELSE w = w + h IF w > 200 THEN w = 200 + (w - 200) ^ 0.865 baseGen = w * 12 IF baseGen < 20 THEN baseGen = 20
In words: If M x 100k colonists live in (under)cities and if N x 100k can work in factories then M+N is a measure for the energy production of this base.
If you have more factories and/or cities than needed for your amount of colonists, then only the "used" part of the structures is taken into account for the calculation of the energy production.
Example:
You have 23M colonists 150 cities and 3000 factories. Then 150 x 100k colonists live in cites. In the 3000 factories can work 3000^2 * 2 = 45 x 100k colonists. So you take 150 + 45 = 195. This is smaller than 200, so the energy production is 200 * 12 = 2400GW per tick.
Good to know:
- There is always a minimum energy production of 20GW per tick
[edit] Considering weapons as charged
The need to check if weapons are charged (sufficiently) comes mainly from the combat modes "Strike Through" ships and wings and "Return Home" for wings. So currently there is no need to consider bases here. For both modes the units should change their behavior with respect to the charge state of their weapons. If loaded then the enemy should be attacked and if not sufficiently charged the unit should hide at a safe place or return to the carrier or home base.
[edit] Ships
This is very easy. The condition is currently that all weapons have to be full. Point defense, weapons which are to badly damaged and super weapons are not considered.
What is left is to check if an ord weapon has enough ord, if the race is a Stormer, if there is at least one intact weapon and if the powerbank is full if the ship is in new power boost mode.
[edit] Wings
- Abbreviations
fDiv = Firing fighter divisor mOrd = Fighter missile vcr ord usage bDrain = Fighter beam drain mDrain = Fighter missile drain cDiv = Wing Charge divisor fBatt = Fighter battery fG = Fighter generator bDrain = Beam drain mDrain = Missile drain fE = Current fighter energy maxE = fBatt * fCount = maximum energy the batteries can hold nE = needed (desired) energy for being considered as charged fAmmo = fighter vcr ord fCount = fighter count of the currently considered type msC = Desired missle salvo count which should be able to be shot to consider the missiles as charged bsC = Desired beam salvo count which should be able to be shot to consider the beams as charged MeanShotLimit = Number of shots wgich this wing is allowed to fire per tick uE = energy which the remaining missiles can use MaxMissiles = The number of missiles the type can fire if it would be fully charged and loaded Ret = TRUE/FALSE depending on the change state (the returned result of the algorithm) CanFireBeams = TRUE/FALSE depending on the fact if the wing if charged can fire a beam at all CanFireMissiles = TRUE/FALSE depending on the fact if the wing if charged and loaded can fire a missile at all
The last two should reflect that the type could be badly designed or that beam drain is increased too much or if the vcr ord load capacity of the current fighter count in the type does not allow even one missile or there aren't beams or missiles at all.
OC(x,y) is the odds competition function which is defined as
GoodOdds := x
BadOdds := y
If BadOdds < 0 Then BadOdds = 0
If GoodOdds < 0 Then GoodOdds = 0
IF GoodOdds > BadOdds THEN
Ret = 1 - BadOdds / (2 * GoodOdds)
ELSE
IF BadOdds <> 0 THEN
Ret = GoodOdds / (2 * BadOdds)
ELSE
Ret = 0.5
END IF
END IF
OC(x,y) := Ret
With this function RND * x > RND * y is equivalent to RND < OC(x,y). This function shall simulate the competition of the two "odds" x and y. If both are equal (expect both are zero) then there is a 50% the x "wins". The greater x becomes the more likely is it that x wings. The chance for this then tends to 100%. But there is always the rest chance for y for a lucky win. The smaller x becomes (while y is constant) the more seldom x wins. THe motivation for OC is to have a meaning for x and y even if there are greater than 100 to avoid a cut off of the inflcuence once x or y are greater than 100 which was often the case in the code.
- START Algorithm
- Ret = TRUE ' assume the wing is charged
- DO for all three fighter types
- IF fCount > 0 THEN
- IF fCount > 10000 THEN fCount = 10000 ' The number of firing
- MeanShotLimit = fCount / fDiv + 0.25 * OC(fG - 10, 10)
- msC = MeanShotLimit * 500 * (fDiv / cDiv) / mDrain: IF msC < 1 THEN msC = 1 ' Intended missile salvos
- bsC = MeanShotLimit * 500 * (fDiv / cDiv) / bDrain: IF bsC < 1 THEN bsC = 1 ' Intended beam salvos
- IF maxE >= bDrain THEN ' if the type fire at least one beam when fully charged
- IF fighterBeam > 0 THEN ' if the type has beams
- CanFireBeams = TRUE ' the type can fire beams at all
- nE = bsC * bDrain ' needed energy
- IF nE > maxE THEN nE = maxE ' if the battery is the limiting factor
- IF fE < nE THEN ' if type's energy is smaller than needed energy
- Ret = FALSE: EXIT DO
- IF fighterMissile > 0 THEN ' IF the type has missiles
- IF MaxMissiles >= 1 THEN ' If the type is able to fire missiles (with full ord load)
- IF maxE >= mDrain THEN ' if the type can fire one missile when fully charged
- CanFireMissiles = TRUE ' the type is able to fire missiles at all
- IF fAmmo >= mOrd THEN ' if there is ammo for at least one shot
- nE = msC * mDrain: uE = mDrain * Int(fAmmo / mOrd)
- IF nE > uE THEN nE = uE ' if ammo is the limiting factor
- IF nE > maxE THEN nE = maxE ' if the battery is the limiting factor
- IF fE < nE THEN ' if type's energy is smaller than needed energy
- Ret = FALSE: EXIT DO
- IF maxE >= mDrain THEN ' if the type can fire one missile when fully charged
- IF fighterBeam > 0 THEN ' if the type has beams
- IF fCount > 0 THEN
- If all types in the wing are not able to fire a weapon even if fully loaded and charged then the TRUE signal has to be reset:
- IF Ret = TRUE THEN
- IF CanFireBeams = FALSE And CanFireMissiles = FALSE THEN Ret = FALSE
- WeaponsAreCharged = Ret
- END Algorithm
Under default hconfig settings a type in a wing needs an energy of
10 * fCount + 125 * OC(fG - 10, 10)
to be regarded as charged.
If this is more than the batteries can hold or than the remaining missiles need then the type is regarded as charged at the corresponding minimum energy level. All types have to be charged. Missiles, which can't fire anymore due to vcr ord shortage, are not considered.
A types charges under default settings with an energy amount of
dE = fCount * fG / 50
per tick.
A type with fG <= 10 needs a time
T = 500 / fG
to be considered as charged.
A type with fG >= 11 needs
T = 500 / fG + 6250 * OC(fG - 10, 10) / (fCount * fG)
to be considered as charged.
If fG <= 20 then this is
T = 500 / fG + 312.5 / fCount * (1 - 10 / fG)
If fG >=21 then this is
T = 500 / fG + 6250 / (fCount * fG) (1 - 5 / (fG - 10))
On a first look these terms imply a penalty for types with a generator greater than 10 as types with a generator value of 10 or less only have the term 500 / fG. But this is not true as a "fast" charger (fG>10) can effect the charge time within a wing by the type's fighter count within the wing. One can calculate the treshold for the fighter count a fast charger where the fast charger is better as the fastest slow charger (fG = 10):
fCount > 125 * (fG-15)/(fG-10)^2 for fG>20 fCount > 6.25 for 10<fG<=20
This means if you have a type with a generator greater than 10 and if you want to let it operate in strike thru and you do not want to have greater peel off times than the fastest slow charger (generator =10) then just ensure the aforementioned fighter count within the wing and do not forget that the slowest type wtihn a wing determines the strike thru dynamics.
