Possible Bug in Combat code with alliances

Playing this 3v3 game … with Brand and I formally aligned. Brand owns the star Wild Holdman and has 21 ships there plus a single ship carrier that just arrived. I send a carrier with 4 ships that also just arrives. At the same time, Nick attacks with 34 ships. All have Weapons 3.

So with 34 ships attacking 26 at W3, you would expect the defenders to win with 2 leftover. Ideally that would be my carrier and Brand’s carrier … but what happened here was BOTH of our carriers got wiped out … so it was just two of Brand’s ships left.

Is this the expected behavior?

np-battle

IIRC, I think Jay’s combat algorithm most of the time favors larger fleets to have residual ships, but I can not be sure. @JayKyburz would know.

Yea, I can understand me losing my carrier (although ideally all formally aligned ships should be exhausted first) … but Brand should not have lost his (?)

I believe he lost his because he didn’t “collect all” when he landed.

I just did some misc. testing and even when just a single player was involved on defense, when the defending carrier lands at the same time as an attacking player (regardless of orders to DROP or COLLECT ALL), it appears it can get clobbered … even if there are plenty of ships to defend.

See screenshot below - most of those carriers arrived at the time of the attack and did various things such as DROP ALL, COLLECT ALL, or NOTHING … but their counts did NOT change - i.e. some had several ships along for the ride.

My guess is the combat code has each carrier “contribute” to the battle “equally” in each “round” of battle … so if the carrier is out of ships (even though another carrier or the star) has plenty, then the carrier gets wiped out. I think it should pull from the star first, then probably biggest carrier, working it’s way down. However, that gets a bit tricky with alliances where each player should contribute … so my guess is that is how the code works.

np

1
When an enemy arrives at a star, the ownership of that star is in dispute, so combat must occur to determine ownership of the star.

Manufacturing of ships & ship transfers can not occur at a star when ownership of the star is in dispute, until after combat. SCI can not discover RP when ownership of the star is in dispute.

If you desire to protect carriers, then the ship transfers should occur on a tick before combat.
If you are expecting a Weapons tech breakthrough, then plan combat to occur on the tick after the RP are discovered from SCI.

2
Defender has W7+1 and 375 ships vs attacker with W9 and 286 ships.

Defender has first strike advantage, and kills attacker in 36 rounds.
Attacker suffers damage = (W7+1) * 36 rounds = 288 > 286 ships available.

Attacker hit defender in 35 rounds.
Defender suffers damage = W9 * 35 rounds = 315 losses.
Defender loss rate = 84 % = 315 / 375
Defender has remaining ships = 60 ships = 375 - 315

There can not be fractional surviving ships. Each fleet suffers approximately 84 % losses so that surviving ships are integer counts.

Here is a previous combat example.

That would be a feature request for @JayKyburz to consider.