View Issue Details

IDProjectCategoryLast Update
0021191AI War 2Gameplay IssueMay 13, 2019 11:35 am
ReporterBadgerBadger Assigned ToBadgerBadger  
Status resolvedResolutionreopened 
Product VersionBETA 0.858 Hotfix: The Lobby... Ate My Galaxy? 
Fixed in VersionBETA 0.859 Lobby Raid 
Summary0021191: Unexpected metal flows being wasted
DescriptionIf you load this save game and go to Teufel, you'll see all my engineers spending a ton of metal doing something with a Rejuvenator Combat Factory (a support fleet). This structure doesn't seem to be building anything and it's at full health, so I don't know where all that metal is going... It's literally all my metal income.
TagsNo tags attached.

Activities

BadgerBadger

May 9, 2019 1:58 am

manager  

BadgerBadger

May 9, 2019 2:04 am

manager   ~0051555

I know both Chris and Weapon Master were in this code recently.

Chris_McElligottPark

May 9, 2019 12:34 pm

administrator   ~0051563

I have another report of engineer metal costs being really wrong in general, which I don't think is a recent-only development but is exacerbated by some of the other changes of late. I'll look into these things now. I could use a break from staring at the lobby, and this seems pretty serious to put it mildly.

wm46

May 9, 2019 2:25 pm

reporter   ~0051567

The recent change I made was to only how claim metal costs are calculated, no clue what's happening with the assist metal in this case.

I'll give a look too once I'm home.

wm46

May 9, 2019 7:25 pm

reporter   ~0051569

The factory was working perfectly normal, a snippet of debug log:

Unit <Factory>, Flow <FactoryConstructionForPlayerMobileFleets>, Flow rate <199.70703125>
Unit <Rejuvenator Combat Factory>, Flow <FactoryConstructionForPlayerMobileFleets>, Flow rate <199.70703125>
Unit <Combat Engineer>, Flow <AssistConstruction>, Flow rate <74.89013671875>
Unit <Combat Engineer>, Flow <AssistConstruction>, Flow rate <74.89013671875>
etc,

The main issue I think is that there is no info in the tooltip that the combat factory is even producing ships. I built one of the factories on the planet, and it showed that you had several frigates being constructed.

The fix would be for some tooltip magic to be done (by someone who understands GUIs more than I do) to display the same construction readout that factories do.

BadgerBadger

May 9, 2019 7:45 pm

manager   ~0051570

Thanks for doing the analysis! I've fixed the tooltip.

BadgerBadger

May 9, 2019 7:46 pm

manager   ~0051571

Fixed

wm46

May 9, 2019 7:49 pm

reporter   ~0051572

On the subject of flows not being right -

The flow rate for the combat factory to build ships is 2000 metal / s, the debug log reports a flow rate of 200 (and at 1x speed there's 10 ticks per step), but the outflow from the GUI reports 1343 metal / s.

An engineer assists construction for 750 metal / s, the debug log reports 75 metal / s, and the GUI metal outflow increases from 1343 to 1847 ( 504 metal / s ).

The metal flows are different from what they're supposed to be, but its actually low balling ( 2/3 of expected metal rate ) rather than using too much metal, confusing. Sounds like an ArcenCore issue.

Chris_McElligottPark

May 10, 2019 5:09 pm

administrator   ~0051576

Okay, I've been out working on finance stuff with my dad all day today. And still dealing with residual nausea. I think I'll leave this to you guys and focus on the lobby in that case.

The fact that the debug log is reporting 75 m/s where it should be 750 is something I'd be careful of, because potentially it's divided by ten because of the fact that there are 10 sim frames per second. Whatever it did that frame should be extrapolated x10 in order to get what it is doing per second.

It's also entirely possible that it is either doing things wrong, like really only spending 75 m/s when it should be 750, or it's actually spending 7500 instead of 750. Those math errors are easy to make, and it sounds like someone at some point (probably Keith or I) made one.

If it's actually spending too little, then we should fix it to spend the proper amount that the GUI states.

At that point, I'm sure that then everything will be waaaaay too expensive in terms of how fast it gets your metal sucking out, which would then mean Puffin to the rescue hopefully in the xml. But in general if we can be sure that it's doing what the xml tells it to, and the interface and the reality of the simulation both reflect that, then that's going to be the basis of what "correct" is for us to be able to balance things.

Thanks so much for looking into this!

wm46

May 10, 2019 8:32 pm

reporter   ~0051579

I think I found the issue in ArcenCore, in Faction.cs - line 1058 is the start of the case for spending metal allocated to a factory for that step.

First metalToSpend is calculated as the sum of the factory metal rate, plus the rate of any engineers assisting
Then the code steps through each ship it assists in producing
    --metalToSpend is divided by the total number of ships being constructed, stored in metalToSpendOnThisItem--
        If metalToSpendOnThisItem is less than the cost to build the ship outright, set the cost to that remaining cost
After calculating metalToSpend, send that number to the summation of metal used this frame (GUI, subtracting metal from bank)
***Subtract metalToSpend by metalToSpendOnThisItem***
Do ship construction logic if ship completed

By subtracting from metalToSpend, the total amount of used metal that step gets reduced from the maximum. If we had 5 ships being constructed, the first ship in line would get 20% of the metal, second would get 16%, third 12.8%, 10.24%, 8.192%, for a total metal spent of 67.2% of metal spent.

Fancy that, I found the magic 2/3 number.

How I'm thinking I'll fix it:

Change for loop to - for ( i = workingMembers.Count - 1; i >= 0; i-- )
Change dividing metalToSpend from the list size, to ( i + 1 )
Change i-- to i++ when completing a ship

Now for the situation of building 5 ships: The last ship in the list gets ( 100 / 5 = 20% ) metal, next ship gets ( 80 / 4 = 20% ) metal, next ship ( 60 / 3 = 20% ) metal, etc.

BadgerBadger

May 12, 2019 1:55 pm

manager   ~0051586

This seems to be resolved now, with code from both weapon master and I

Chris_McElligottPark

May 13, 2019 11:35 am

administrator   ~0051595

Thanks guys!

Issue History

Date Modified Username Field Change
May 9, 2019 1:58 am BadgerBadger New Issue
May 9, 2019 1:58 am BadgerBadger Status new => assigned
May 9, 2019 1:58 am BadgerBadger Assigned To => Chris_McElligottPark
May 9, 2019 1:58 am BadgerBadger File Added: CombatFactoryMetalFlows.save
May 9, 2019 1:58 am BadgerBadger File Added: CombatFactoryMetalFlows.savemet
May 9, 2019 2:04 am BadgerBadger Note Added: 0051555
May 9, 2019 12:34 pm Chris_McElligottPark Note Added: 0051563
May 9, 2019 2:25 pm wm46 Note Added: 0051567
May 9, 2019 7:25 pm wm46 Note Added: 0051569
May 9, 2019 7:45 pm BadgerBadger Note Added: 0051570
May 9, 2019 7:46 pm BadgerBadger Assigned To Chris_McElligottPark => BadgerBadger
May 9, 2019 7:46 pm BadgerBadger Status assigned => resolved
May 9, 2019 7:46 pm BadgerBadger Resolution open => fixed
May 9, 2019 7:46 pm BadgerBadger Fixed in Version => BETA 0.859 Lobby Raid
May 9, 2019 7:46 pm BadgerBadger Note Added: 0051571
May 9, 2019 7:49 pm wm46 Note Added: 0051572
May 10, 2019 5:09 pm Chris_McElligottPark Note Added: 0051576
May 10, 2019 5:09 pm Chris_McElligottPark Status resolved => feedback
May 10, 2019 5:09 pm Chris_McElligottPark Resolution fixed => reopened
May 10, 2019 8:32 pm wm46 Note Added: 0051579
May 12, 2019 1:55 pm BadgerBadger Status feedback => resolved
May 12, 2019 1:55 pm BadgerBadger Note Added: 0051586
May 13, 2019 11:35 am Chris_McElligottPark Note Added: 0051595