View Issue Details

IDProjectCategoryLast Update
0021473AI War 2Bug - GameplayAug 8, 2019 6:18 pm
Reporterwm46 Assigned ToDominus Arbitrationis  
Status resolvedResolutionfixed 
Product Version0.879 Many Fixes and the Tutorial Rework Starts 
Fixed in Version0.880 Belatedly Finding Friends... And Enemies 
Summary0021473: Russian Nesting Dolls - Fleets create more flagships when leveling up
DescriptionThis is an odd one that I didn't expect happen from the patch notes.

Picture is from the Raid Fleet, Agile Transport Ship.
TagsNo tags attached.

Activities

wm46

Aug 7, 2019 7:24 pm

reporter  

wm46

Aug 7, 2019 7:27 pm

reporter   ~0052466

The nested dolls also still benefit from crippling instead of dying.

wm46

Aug 7, 2019 7:52 pm

reporter   ~0052468

Alright, a quick check showed what the issue was:

Starting from line 2094 of Fleet.cs:

            default:
                this.EffectiveSquadCap = this.ExplicitBaseSquadCap;
                //higher marks lead to higher squad caps if you're not a drone
                if ( this.ForMark.MarkLevel.SquadCapMultiplier > FInt.One && !this.TypeData.SpecialType.GetIsDrone() )
                    this.EffectiveSquadCap = (this.EffectiveSquadCap * this.ForMark.MarkLevel.SquadCapMultiplier).GetNearestIntPreferringHigher();

"default" meaning not flagships, command stations, guardposts, etc.

Then at line 2142:

                if ( this.ForMark.MarkLevel.SquadCapMultiplier > FInt.One )
                    this.EffectiveSquadCap = (this.EffectiveSquadCap * this.ForMark.MarkLevel.SquadCapMultiplier).GetNearestIntPreferringHigher();

---------

This leads to two errors:
1. Mark level caps are squared, rounded up twice. Mk2 grants 0000001:0000001.55 ships, or 2.0 for frigates.
2. The only qualifier before this is "If not a drone", which includes flagships and command stations.

Solution:
Maybe define a bool at the start of the loop, bool IsFlagship = false.
Change the switch case for ship type to, case <IsFlagship>: bool IsFlagship = true
    Remove the squad cap increase from case default:
Then at the end of all the squad cap stuff, if (IsFlagship) EffectiveSquadCap = 1;

Is there anything that might be wrong with a fix like this?

wm46

Aug 7, 2019 8:20 pm

reporter   ~0052469

I don't know what I did, but I think I should stay far away from the fleet code: https://youtu.be/0PmzKc-y3SA

I leave this to someone more experienced.

Dominus Arbitrationis

Aug 8, 2019 2:47 am

administrator   ~0052476

So you'll notice that in that code, where it says case SpecialEntityType.MobileOfficerCombatFleetFlagship:, it lists a bunch of others, then under those it says

                        this.EffectiveSquadCap = 1;
                        this.LocalPlayerUISquadCap = 1;
                        break;

So it does basically what you suggested already. Adding a bool is unncessary. Also, case <IsFlagship>: wouldn't work, since it would have to be a special entity type.

wm46

Aug 8, 2019 6:54 am

reporter   ~0052477

I understand that <IsFlagship> is not a valid case, I was just using that term in general to refer to the lines of SpecialEntityType already there. That few lines of code for the case of flagship does not work though, because below that line of code that you copied there is:

                    if ( !this.TypeData.SpecialType.GetIsDrone() )
                    {
                    ...
                        //We already checked for drone status, so now see if this thing gets bonus ships from higher marks
                        if ( this.ForMark.MarkLevel.SquadCapMultiplier > FInt.One )
                            this.EffectiveSquadCap = (this.EffectiveSquadCap * this.ForMark.MarkLevel.SquadCapMultiplier).GetNearestIntPreferringHigher();

                        //higher marks give more ships
                        if ( this.LocalPlayerUIForMark.MarkLevel.SquadCapMultiplier > FInt.One )
                            this.LocalPlayerUISquadCap = (this.LocalPlayerUISquadCap * this.LocalPlayerUIForMark.MarkLevel.SquadCapMultiplier).GetNearestIntPreferringHigher();
                    }

Flagships are not drones, so they will get the mark cap bonus. Since their cap is set to 1, the code "Ciel( 1 * 1.25 )" will equal 2 at mark 2, and at mark 5 and above, equal 3.

This bonus needs to be below the code that adds WorkingAddedShipCountFromWhateverSource to the explicit cap for turrets, so that turrets granted from GCAs are affect by mark level increases.

Dominus Arbitrationis

Aug 8, 2019 11:21 am

administrator   ~0052479

Ah, I thought you meant use the bool. My bad.

And now I see what you're talking about. It should be fixed using your solution now.

RocketAssistedPuffin

Aug 8, 2019 5:25 pm

reporter   ~0052487

Noticed something strange, it might be from this?

Upgrading units through Tech is granting far larger cap increases. The Classic Fleet only has 40 of each unit, and upgrading to Mark 3 (1.5x cap) should have 60, but in this save I have 90 V-Wings and Fusion Bombers instead, and 63 Mark 2 Concussion Corvettes, when that should be 50.

Even the Forcefield Frigate is affected - it only starts with 1, Mark 2 should only have 2, but instead I have 3.
StrangeTechCap.save (267,984 bytes)

BadgerBadger

Aug 8, 2019 5:44 pm

reporter   ~0052488

Last edited: Aug 8, 2019 5:51 pm

It's double counting the bonus from mark level increases. It applies them first from this:
                    default:
                        this.EffectiveSquadCap = this.ExplicitBaseSquadCap;
                        //higher marks lead to higher squad caps if you're not a drone
                        if ( this.ForMark.MarkLevel.SquadCapMultiplier > FInt.One && !this.TypeData.SpecialType.GetIsDrone() )
                            this.EffectiveSquadCap = (this.EffectiveSquadCap * this.ForMark.MarkLevel.SquadCapMultiplier).GetNearestIntPreferringHigher();

and later it it applies the multiplier again here:
                        if ( this.EffectiveSquadCap > 1 )
                        {
                            //We already checked for drone status, so now see if this thing gets bonus ships from higher marks
                            if (this.ForMark.MarkLevel.SquadCapMultiplier > FInt.One)
                                this.EffectiveSquadCap = (this.EffectiveSquadCap * this.ForMark.MarkLevel.SquadCapMultiplier).GetNearestIntPreferringHigher();

The problematic second count was introduced by Dominus' fix for "Now the GCA hack bonuses benefit from tech."

BadgerBadger

Aug 8, 2019 5:53 pm

reporter   ~0052489

Dominus, can you please take a look?

Dominus Arbitrationis

Aug 8, 2019 6:16 pm

administrator   ~0052492

Fixed that now! Sorry!

Issue History

Date Modified Username Field Change
Aug 7, 2019 7:24 pm wm46 New Issue
Aug 7, 2019 7:24 pm wm46 File Added: AIWar2 8_7_2019 7_20_25 PM.png
Aug 7, 2019 7:27 pm wm46 Note Added: 0052466
Aug 7, 2019 7:52 pm wm46 Note Added: 0052468
Aug 7, 2019 8:20 pm wm46 Note Added: 0052469
Aug 8, 2019 12:52 am BadgerBadger Assigned To => Chris_McElligottPark
Aug 8, 2019 12:52 am BadgerBadger Status new => assigned
Aug 8, 2019 2:47 am Dominus Arbitrationis Note Added: 0052476
Aug 8, 2019 6:54 am wm46 Note Added: 0052477
Aug 8, 2019 11:21 am Dominus Arbitrationis Note Added: 0052479
Aug 8, 2019 11:22 am Dominus Arbitrationis Assigned To Chris_McElligottPark => Dominus Arbitrationis
Aug 8, 2019 11:22 am Dominus Arbitrationis Status assigned => resolved
Aug 8, 2019 11:22 am Dominus Arbitrationis Resolution open => fixed
Aug 8, 2019 11:22 am Dominus Arbitrationis Fixed in Version => 0.880 Belatedly Finding Friends... And Enemies
Aug 8, 2019 11:22 am Dominus Arbitrationis Description Updated
Aug 8, 2019 5:25 pm RocketAssistedPuffin File Added: StrangeTechCap.save
Aug 8, 2019 5:25 pm RocketAssistedPuffin Note Added: 0052487
Aug 8, 2019 5:44 pm BadgerBadger Note Added: 0052488
Aug 8, 2019 5:51 pm BadgerBadger Note Edited: 0052488
Aug 8, 2019 5:53 pm BadgerBadger Status resolved => assigned
Aug 8, 2019 5:53 pm BadgerBadger Note Added: 0052489
Aug 8, 2019 6:16 pm Dominus Arbitrationis Note Added: 0052492
Aug 8, 2019 6:18 pm Dominus Arbitrationis Status assigned => resolved