SIDEWINDER'S RETRO-ENGINEERING OF TIM'S GROUND COMBAT ALGORITHMS THE FOLLOWING WAS PUT TOGETHER BY SIDEWINDER IN AUTUMN 2000 AFTER STUDYING SOME OF TIM'S CODE. SIDEWINDER WAS INTERESTED IN DIPLOMAT BEING ABLE TO SIMULATE GROUND ASSAULTS, SO HE PASSED THE INFO TO ME. THE CODE HAS MUTATED A BIT SINCE THEN BUT MY ADDITIONAL COMMENTS MIGHT HELP THERE. - PAUL HONIGMANN Note: Email between Tim and I, 3.2.2001: That's odd: whilst looking at updating Diplomat to takeinto account the new 10,000 colonists required to kill a mech, I noticed: there doesn't seem to be any phase where attacking troops, crew or colonists attack defending base's mechs. Maybe just an error inSidewinder's deconstruction of your algorithms, which I followed? Roughly where should this lie - between which phases of KKK? Sidewinder was correct the defending mechs can only be harmed by attacking mechs or fighters. However the base will fall all the same if all the base colonists / troops / crew are overrun by the attackers, even if mechs remain alive. I will consider changing this and adding troop VS base_mech attack phases. BTW - I take it it takes 10000 colonists to kill a lasercannon? Yes was 400 now it is 10000 ========== Base attack modes: Roaming Defence: 1/4 troops go Deep Ground Patrol: 1/2 troops, 1/2 each mech and fighter type go Attack And Run: 90% of troops and all fighters and all mechs go Kill Kill Kill!: 95% troops and crew, 90% colonists up to 100 000 000 and all mechs and fighters go General casualty formula: DefenderUnits - (AttackPower * HGF * RND) Where RND = random 0-1, HGF = 1 - ((Defender High Guard count * Defender HG ground combat value) / 1000) If HGF < 0.5 then HGF = 0.5 Roaming Defence: General personnel combat formula AttackPower = PM * ((Attacking Personnel * Attacker "Ground Combat" Value / APM) + (Attacking Personnel * (Attacker "Dark Force" Value / DFM)) Personnel against mechs and fighters: AttackPower = PM * (Attacking Personnel * Attacker "Ground Combat" Value / APM) * ((DM - Defending Mech/Fighter "Defence from Ground Troops" Value) / DM) Mechs against personnel: AttackPower = PM * (Attacking Mechs/Fighters * Attacker "Attack Ground Troops" Value) * ((DM - Defending Personnel "Ground Combat" Value) / DM) 1) Troops attack Troops APM=100, DFM=100, PM=1 1A) Defending Troops counter attack (defenders are now attackers) APM=150, DFM=50, PM=1 2) Troops attack Crew APM=100, DFM=100, PM=2 2A) Defending Crew counter attack APM=150, DFM=100, PM=2 3) Troops attack Colonists APM=100, DFM=100, PM=8 3A) Defending Colonists counter attack APM=100, DFM=100, PM=0.5 4) Troops attack Mechs APM=10, DM=200, PM=.025 4A) Defending Mechs counter attack with 70% probability DM=200, PM=0.2 4 and 4A are used three times for each defending mech type (1-3), each with attack and counter attack before the next type. 5) Troops attack Fighters APM=20, DM=200, PM=.02 5A) Defending Fighters counter attack with 50% probability DM=200, PM=.33 5 and 5A are used three times for each defending fighter type (1-3), each with attack and counter attack before the next type. Deep Ground Patrol: 1) Troops attack Troops APM=150, DFM=150, PM=1 1A) Defending Troops counter attack (defenders are now attackers) APM=150, DFM=80, PM=1 2) Troops attack Crew APM=150, DFM=150, PM=1.5 2A) Defending Crew counter attack APM=150, DFM=100, PM=2 3) Troops attack Colonists APM=100, DFM=100, PM=8 3A) Defending Colonists counter attack APM=100, DFM=100, PM=0.5 Personnel against mechs and fighters: AttackPower = PM * (Attacking Personnel * Attacker "Ground Combat" Value / APM) * ((DM - Defending Mech/Fighter "Defence from Ground Troops" Value) / DM) Mechs against personnel: AttackPower = PM * (Attacking Mechs/Fighters * Attacker "Attack Ground Troops" Value) * ((DM - Defending Personnel "Ground Combat" Value) / DM) 4) Troops attack Mechs APM=10, DM=200, PM=.025 4A) Defending Mechs counter attack with 70% probability DM=200, PM=0.2 4 and 4A are used three times for each defending mech type (1-3), each with attack and counter attack before the next type. 5) Troops attack Fighters APM=20, DM=200, PM=.02 5A) Defending Fighters counter attack with 50% probability DM=200, PM=.33 5 and 5A are used three times for each defending fighter type (1-3), each with attack and counter attack before the next type. Attack And Run & Kill Kill Kill!: 1) Defending AA Guns fire against attacking Fighters DM = (120 - Attacking fighter "Defense From Ground Units") / 100 if DM < 0.1 then DM = 0.1 AttackPower = AA Guns * DM [NOTE: THERE IS A BUG IN THIS PART, ACTUALLY FIGHTERS MAY SUFFER ONLY 1 LOSS] 1A) Attacking Fighters attack AA Guns AM = Attacking fighter "Attack Cities" / 100 if AM < 0.1 then AM = 0.1 AttackPower = Fighters * AM AA Gun Losses = AttackPower * RND 1 and 1A are used three times for each defending fighter type (1-3), each with counter attack and attack before the next type. Fighter to Fighter formula: AttackPower = Attacking Fighters * AM AM = (Attacking Fighter "Attack Air" value / 100) * (DM - (Defending Fighter "Defence From Air Attack" value) / DM) AM < 0.1 then AM = 0.1 2) Attacking Fighters attack Defending Fighters DM=200 2A) Defending Fighters counter attack Attacking Fighters DM=250 2 and 2A are used three times for each attacking fighter type against each defending three fighter type (1 vs 1,2,3, 2 vs 1,2,3 and 3 vs 1,2,3). All types attack before counter attack. Mechs and Fighters formula: AttackPower = Attackers * AM AM = (Attacker "Attack Against Defender" value / 100) * (DM - (Defenderr "Defence From Attacker" value) / DM) AM < 0.1 then AM = 0.1 3) Defending Mechs counter attack Attacking Fighters DM=200 3A) Attacking Fighters attack Defending Mechs DM=150 3 and 3A are used three times for each attacking fighter type against each defending three fighter type (1 vs 1,2,3, 2 vs 1,2,3 and 3 vs 1,2,3). All types attack before counter attack. 4) Attacking Mechs attack defending Laser Cannons Laser Cannon Losses = Mechs * Mechs "Attack City / 100 4A) Defending Laser Cannons counter attack Attacking Mechs AttackPower = Laser Cannons 4 and 4A are used three times, once for each mech type (1-3). Mechs and Mechs formula: AttackPower = Attackers * AM AM = (Attacker "Attack Against Defender" value / 100) * (DM - (Defenderr "Defence From Attacker" value) / DM) AttackPower < 0.1 AttackPower = 0.1 [This last one makes no sense, should probably be for AM, not AttackPower] 5) Attacking Mechs attack Defending Mechs DM=200 5A) Defending Mechs counter attack Attacking Mechs DM=200 5 and 5A are used three times for each attacking mech type against each defending three mech type (1 vs 1,2,3, 2 vs 1,2,3 and 3 vs 1,2,3). All types attack before counter attack. Mechs to Personnel: AttackPower = PM * Mechs * Mechs "Attack Ground Troops" 6) Attacking Mechs attack Defending Troops PM=1 7) Attacking Mechs attack Defending Crew PM=1.5 8) Attacking Mechs attack Defending Colonists PM=1.6 6, 7 and 8 are used three times, once for each mech type (1-3). Personnel to Mechs: AttackPower= Personnel / AM * (200 - Mech "Defence From Ground Troops") / 200 9) Defending Troops counter attack Attacking Mechs AM=100 10) Defending Crew counter attack Attacking Mechs AM=200 11) Defending Colonists counter attack Attacking Mechs AM=500 9, 10 and 11 are used three times, once for each mech type (1-3). Mechs to personnel: AttackPower=Mechs * Mech "Attack Ground Troops" 12) Defending Mechs counter attack Attacking Troops 13) Defending Mechs counter attack Attacking Crew 14) Defending Mechs counter attack Attacking Colonists 12, 13 and 14 are used three times, once for each mech type (1-3). 15) Defending Laser Cannons counter attack Attacking Troops AttackPower = Laser Cannons 16) Attacking Troops attack Defending Laser Cannons Laser Cannon Losses = Troops * Troops "Ground Combat" / 400 * RND 17) Defending Laser Cannons counter attack Attacking Crew AttackPower = Laser Cannons 18) Defending Laser Cannons counter attack Attacking Colonists AttackPower = Laser Cannons 19) Attacking Crew attack Defending Laser Cannons Laser Cannon Losses = Crew * Crew "Ground Combat" / 400 * RND Personnel to AA Guns AA Gun Losses = Personnel * Personnel "Ground Combat" / 100 * RND [NOTE: due to a bug none of these three combat takes place if there aren't any laser cannons in the defending base] 20) Attacking Troops attack Defending AA Guns 21) Attacking Crew attack Defending AA Guns 22) Attacking Colonists attack Defending AA Guns Fighters to Personnel AttackPower = Fighters * Fighters "Attack Ground Troops" 23) Attacking Fighters attack Defending Troops 24) Attacking Fighters attack Defending Crew 25) Attacking Fighters attack Defending Colonists 23, 24 and 25 are used three times, once for each fighter type (1-3). Personnel to Fighters AttackPower = Personnel * Personnel "Ground Combat" / 20 * ((150 - Fighters "Defence From Ground Troops") / 150) 26) Defending Troops counter attack Attacking Fighters 27) Defending Crew counter attack Attacking Fighters 28) Defending Colonists counter attack Attacking Fighters Using general personnel combat formula and values PM=1, APM=100, DFM=100: 29) Defending Troops counter attack Attacking Troops 30) Attacking Troops attack Defending Troops 31) Defending Troops counter attack Attacking Crew 32) Defending Troops counter attack Attacking Colonists 33) Attacking Crews attack Defending Troops 34) Attacking Colonists attack Defending Troops PM=1, APM=100, DFM=200 35) Defending Crew counter attack Attacking Crew PM=1, APM=100, DFM=100 36) Attacking Crews attack Defending Crew PM=1, APM=100, DFM=200 37) Defending Colonists counter attack Attacking Crew PM=1, APM=100, DFM=100 38) Defending Colonists counter attack Attacking Colonists PM=1, APM=100, DFM=100 39) Attacking Colonists attack Defending Crew PM=1, APM=100, DFM=100 40) Attacking Crew attack Defending Colonists PM=1, APM=100, DFM=100 41) Attacking Colonists attack Defending Colonists PM=1, APM=100, DFM=100 42) Remaining Attackers return home (mode 3) 43) Surrender (overrun) resolution, mode 4 only ForcePower=Colonists * Colonist "Ground Combat" + Crew * Crew GC + Troops * Troop GC + HG * HG GC If Participant A ForcePower > Participant B ForcePower * 3 then defending base surrenders. Note that both the attacking and the defending base are checked against surrender. 44) Overrun base personnel is taken prisoners 45) In case there was NOT 3 times superiority by either side, bloodbath commences If there is less defender ForcePower, all defenders are killed and attacker losses are 1 - (Defender ForcePower / Attacker ForcePower) * each personnel type. If defenders are stronger, all attackers are killed and defender losses are complemented: 1 - (Attacker ForcePower / Defender ForcePower) 46) Defeated bases are looted This is a sub not included in the source (named LootBase) 47) Own race prisoners in the captured base are released 48) Remaining Attackers return home (mode 4) 50) Maintenance tasks (several loops) [The problem with the losses reports is most probably in CasualtyReport sub.] All surviving HG run away from destroyed bases (all manage to escape, but what happens to them after that is in another sub somewhere). Also some stuff from the destroyed base is transfered to the planet (not listed EmptyBase sub). Notes: - Attacking an enemy base with Kill*3 and resulting in three times less power remaining at the end leads to the capture of the attacking base! - High Guard can drop most losses (HG of both sides for their own side losses) by 50% at most - In most combats fighters suffer the highest losses (prosentual), then mechs and then personnel - Most losses are from 0-max, max defined by the formula and the actual loss by chance - Formulae vary a lot from step to next, somewhere there is more random and static factors, somewhere less - Laser Cannons are not worth a shit (IMHO) - Dark Force value playes a big part in personnel combat ------------------------ Sorry for taking this long. I still haven't got time to do proper analysis of how this could be improved or what exactly are the strenghts of expensive fighters and mechs opposed to cheap troops. I will return to that later, hopefully (for example it should be counted how many more fights there are with mechs & fighters against others vs. how many with personnel against others and how losses go at 100 general mods [such as combat modifiers and dark force etc.] and 0.5 odds). I also included the entire source message from Tim (attached text file). I didn't get any instructions about dissemination, but I advice against spreading this to public access (such as the mailing list or a web site) without asking Tim first (besides there will be changes to the spots I mentioned there between []). Note that there are probably many other bugs that I didn't find in the first pass. - Sidewinder