View Issue Details

IDProjectCategoryLast Update
0021667AI War 2Bug - GameplayOct 7, 2019 4:57 pm
Reporterulu Assigned ToChris_McElligottPark  
Severitymajor 
Status resolvedResolutionfixed 
Product Version0.890 Lighting and Darkness 
Fixed in Version0.898 Galactic Linkages 
Summary0021667: Fleets have got more ships than they should
DescriptionMy fleet got 102 of 60 fusion bombers.
TagsNo tags attached.

Activities

ulu

Sep 20, 2019 2:38 pm

reporter  

bug.png (1,137,873 bytes)
bug.savemet (48 bytes)
bug.save (591,707 bytes)

Asteroid

Sep 20, 2019 3:33 pm

reporter   ~0053204

I've noticed this for a while. I don't know if it's a simple calculation error or it corresponds to something in the game world. I was wondering if perhaps fleets only take into account units that are in the current system when rebuilding, which would cause them to build over their cap?

wm46

Sep 20, 2019 8:35 pm

reporter   ~0053207

It's a visual bug only it seems, it only appears when the ships are in transports. Started happening since the introduction of player stacks.

Chris_McElligottPark

Oct 4, 2019 7:37 pm

administrator   ~0053493

Any help in solving this one, Asteroid or WeaponMaster, would definitely be welcome. This sounds annoying to players, but like a simple logic thing that will be tricky to track down but isolated to fix. I'm trying to hit some wider things at the moment with the galaxy map, then achievements, then the sidebar revamp. I'm picking up various bugfixes along the way, but this one looks a bit too time consuming to track down from a glance at it.

BadgerBadger

Oct 5, 2019 12:27 pm

manager   ~0053510

In the EntityHover code we call

int effectiveHere = mem.GetCountPresent( true, ExtraFromStacks.IncludePrecalc );

to get the number of ships in a Fleet Membership. In GetCountPresent we say

int count = this.Entities.Count + ( this.NumberCreatedButNotDeployed > 0 ? this.NumberCreatedButNotDeployed : 0 ) + ( this.TransportContents != null ? this.TransportContents.Count : 0 );

note this includes transported ships. But we also pass in ExtraFromStacks.IncludePrecalc, so we update the count by
                            case ExtraFromStacks.IncludePrecalc:
                                count += this.ExtraShipsFromStacksInRawAndTransports;

This leads to some confusion, since apparently there are 44 stacks and 58 individual units.

10/5/2019 10:19:07 AM base count 58 tranposrtcontents 58
10/5/2019 10:19:07 AM Including extra ships from stacks in raw and transports: 44
10/5/2019 10:19:07 AM Mem Fusion Bomber effective here 102 squadCapToUse 60 transported 58

If I unload and reload the ships the problem goes away for this save. Needs more analysis to understand what's going on.

wm46

Oct 5, 2019 8:54 pm

reporter   ~0053515

I can take a look tomorrow when I get back from seeing my GF, where is the main function that handles the tooltip?

Just in InGameEntityHover (or whatever it's called) in the external code?

BadgerBadger

Oct 5, 2019 9:45 pm

manager   ~0053516

Yeah, it's the giant 3000 line function in HoverEntityInfo in External Code. Look for the int effectiveHere = mem.GetCountPresent( true, ExtraFromStacks.IncludePrecalc ); line.

I suspect something is going wrong with the calculation of Membership.ExtraShipsFromStacksInRawAndTransports; having 44 stacks worth of units out of 60 total seems implausible.

Unfortunately unloading and reloading that fleet seemed (in my quick test) to fix the problem, so I haven't found a consistent reproduction scenario. That said, I only looked for like 10 minutes, so you might have better luck.

wm46

Oct 6, 2019 9:59 pm

reporter   ~0053521

The solution isn't actually in the hover text or anywhere in the faction code, but something to do with transporting. We are loading ships off the top of the stack, and not the whole stack itself. All of the transported ship info seems to be busted, but it works out in the end somehow anyways?

A long debug snippit included, I cycled through and printed each TransportedShip inside the transport when adding a ship to the transport (my fleet has 120 turbo stingrays). Note there are 120 ships stacked in, but there's tons of ships it thinks are stacked with each of those ships.:

Ship added to transport ( 120 ship(s) now )
  CONTENTS:
    Ship < Turbo Stingray > with < 15 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 27 > extra ships in it
    Ship < Turbo Stingray > with < 15 > extra ships in it
    Ship < Turbo Stingray > with < 15 > extra ships in it
    Ship < Turbo Stingray > with < 19 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 14 > extra ships in it
    Ship < Turbo Stingray > with < 15 > extra ships in it
    Ship < Turbo Stingray > with < 14 > extra ships in it
    Ship < Turbo Stingray > with < 13 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 18 > extra ships in it
    Ship < Turbo Stingray > with < 14 > extra ships in it
    Ship < Turbo Stingray > with < 13 > extra ships in it
    Ship < Turbo Stingray > with < 14 > extra ships in it
    Ship < Turbo Stingray > with < 17 > extra ships in it
    Ship < Turbo Stingray > with < 26 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 12 > extra ships in it
    Ship < Turbo Stingray > with < 13 > extra ships in it
    Ship < Turbo Stingray > with < 25 > extra ships in it
    Ship < Turbo Stingray > with < 16 > extra ships in it
    Ship < Turbo Stingray > with < 13 > extra ships in it
    Ship < Turbo Stingray > with < 12 > extra ships in it
    Ship < Turbo Stingray > with < 12 > extra ships in it
    Ship < Turbo Stingray > with < 15 > extra ships in it
    Ship < Turbo Stingray > with < 24 > extra ships in it
    Ship < Turbo Stingray > with < 12 > extra ships in it
    Ship < Turbo Stingray > with < 11 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 10 > extra ships in it
    Ship < Turbo Stingray > with < 11 > extra ships in it
    Ship < Turbo Stingray > with < 23 > extra ships in it
    Ship < Turbo Stingray > with < 14 > extra ships in it
    Ship < Turbo Stingray > with < 11 > extra ships in it
    Ship < Turbo Stingray > with < 11 > extra ships in it
    Ship < Turbo Stingray > with < 10 > extra ships in it
    Ship < Turbo Stingray > with < 10 > extra ships in it
    Ship < Turbo Stingray > with < 13 > extra ships in it
    Ship < Turbo Stingray > with < 22 > extra ships in it
    Ship < Turbo Stingray > with < 10 > extra ships in it
    Ship < Turbo Stingray > with < 9 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it
    Ship < Turbo Stingray > with < 8 > extra ships in it
    Ship < Turbo Stingray > with < 9 > extra ships in it
    Ship < Turbo Stingray > with < 21 > extra ships in it
    Ship < Turbo Stingray > with < 12 > extra ships in it
    Ship < Turbo Stingray > with < 9 > extra ships in it
    Ship < Turbo Stingray > with < 9 > extra ships in it
    Ship < Turbo Stingray > with < 8 > extra ships in it
    Ship < Turbo Stingray > with < 8 > extra ships in it
    Ship < Turbo Stingray > with < 11 > extra ships in it
    Ship < Turbo Stingray > with < 20 > extra ships in it
    Ship < Turbo Stingray > with < 8 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 19 > extra ships in it
    Ship < Turbo Stingray > with < 10 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 9 > extra ships in it
    Ship < Turbo Stingray > with < 18 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 17 > extra ships in it
    Ship < Turbo Stingray > with < 8 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 16 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 15 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 14 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 13 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 12 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it
    Ship < Turbo Stingray > with < 11 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 10 > extra ships in it
    Ship < Turbo Stingray > with < 9 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it
    Ship < Turbo Stingray > with < 8 > extra ships in it
    Ship < Turbo Stingray > with < 7 > extra ships in it
    Ship < Turbo Stingray > with < 6 > extra ships in it
    Ship < Turbo Stingray > with < 5 > extra ships in it
    Ship < Turbo Stingray > with < 4 > extra ships in it
    Ship < Turbo Stingray > with < 3 > extra ships in it
    Ship < Turbo Stingray > with < 2 > extra ships in it
    Ship < Turbo Stingray > with < 1 > extra ships in it
    Ship < Turbo Stingray > with < 0 > extra ships in it

wm46

Oct 6, 2019 10:06 pm

reporter   ~0053522

CreateGameEntity_SquadFromMe does not attempt to reform stacks, so that's why ships are conserved.

So:

TryToPutMeIntoTargetTransport is bugged because it transports ships off the top of the stack, and then says it loaded the whole stack in.
CreateGameEntity_SquadFromMe is bugged because it does not properly set ExtraSquadsStackedInMe

wm46

Oct 6, 2019 10:17 pm

reporter   ~0053523

The reason why things are "fixed" sometimes is that once all ships of a membership are built and loaded into a transport (this.Entities.Count == 0), the tooltip just spits out the squad cap instead of doing any calculations.

Interestingly, this bug could also cause factories to not rebuild ships in the fleet if you have the squad stack limit set low enough. If I have 50 / 120 Turbo Stingrays, but when transported the code misreports the count as 500, it'll stop factories from creating more ships.

Chris_McElligottPark

Oct 7, 2019 4:57 pm

administrator   ~0053536

Fingers crossed!

* When stacked ships go into a transport, it now properly puts the whole stack in (but this is untested).
** It also now properly takes the stack out as a whole (also untested).
** It also now should properly count the extra ships in the stack for GUI purposes, factories, and other conditions (also untested, and this is where more bugs might be creeping in, because these were a ton of changes).

Thanks, all!

Issue History

Date Modified Username Field Change
Sep 20, 2019 2:38 pm ulu New Issue
Sep 20, 2019 2:38 pm ulu File Added: bug.png
Sep 20, 2019 2:38 pm ulu File Added: bug.savemet
Sep 20, 2019 2:38 pm ulu File Added: bug.save
Sep 20, 2019 3:33 pm Asteroid Note Added: 0053204
Sep 20, 2019 8:35 pm wm46 Note Added: 0053207
Oct 4, 2019 7:37 pm Chris_McElligottPark Note Added: 0053493
Oct 5, 2019 12:27 pm BadgerBadger Note Added: 0053510
Oct 5, 2019 8:54 pm wm46 Note Added: 0053515
Oct 5, 2019 9:45 pm BadgerBadger Note Added: 0053516
Oct 6, 2019 9:59 pm wm46 Note Added: 0053521
Oct 6, 2019 10:06 pm wm46 Note Added: 0053522
Oct 6, 2019 10:17 pm wm46 Note Added: 0053523
Oct 7, 2019 4:57 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
Oct 7, 2019 4:57 pm Chris_McElligottPark Status new => resolved
Oct 7, 2019 4:57 pm Chris_McElligottPark Resolution open => fixed
Oct 7, 2019 4:57 pm Chris_McElligottPark Fixed in Version => 0.898 Galactic Linkages
Oct 7, 2019 4:57 pm Chris_McElligottPark Note Added: 0053536