Woot

Woot

24M Downloads

Int overflow with configured RF demand too high

OrdinatorStouff opened this issue ยท 14 comments

commented

In the ATM settings (corrected) for the Chaos Dargon (and also for normal Ender Dragon but with all upgrades except efficency) the RF/t and total RF needed seem to "overflow" and become negative numbers in the UI and not needed to perform spawns.

If there should be a "max cap" to configs I can understand but currently there are none and I have unexpectedly "broken" the mod by requiring it to need too much RF.

I can provide more details/configs if needed but I would just like to know:

  1. Do I need to lower my "cruel" configs lower until there is no overflor,

or 2) Is this something you'd like to look into in the mod code to see if it can be prevented or limited?

commented

image

commented

I'll need to see where the root cause is.
I'm using Forge energy storage which is all limited to a 32bit integer and I think I sync everything as int as well.
If the calculations are exceeding that then I'll need to see about capping them to MAX_INT so that they all display correctly and are used, although I thought that still gave 2 billion for max stored RF(?)

Let me have a bit of a dig in my code and see what the underlying issue is.

[update]
I've caused the same issue by spawning 16 Ender Dragons at once, so I'll try and get to the bottom of this.

If you could let me see the configs that you are using, then I'll make sure that I'm not just fixing it for one situation (mine) and missing another (yours).

commented

Just to chime in, here is the config that has been used when the atm3 pack was being tested for this.
factory_config.txt
Its just been change to .txt so github recognizes it as a supported file and could attach it.

commented

Thanks @FallenEagle1
I'll need the woot.cfg as well, as that contains the underlying factory costs.

commented

Sure thing, forgot about that one being changed also.
woot.txt

commented

I put the other two up also since they've been changed, just to complete the set.
custom_drops.txt
factory_ingredients.txt

commented

My that is a lot of power for a Chaos Guardian!
So with your configs I believe I've fixed it.
Basically the underlying power requirement for a single mob was
5000 spawnUnits @ 200RF power unit * 12000 ticks = 12,000,000,000 RF per mob
Which far exceed the int storage of 2,147,483,647

So I've changed the calculation code to use longs and then capped the power costs at Int.MAX_VALUE.
That means that no matter what, the maximum power that can be required by any Woot recipe will be about 2.1GRF.

So your Chaos Guardian (1 of) now uses 2.1GRF @ 179KRF/tick!

2018-03-18_12 43 32

commented
commented

I thought this was all down to just the client syncing issue, but clearly the issue is deeper than that.
I'll reopen and investigate the internal functionality.

Think this is on the recipe progress tracker. Calculation is performed using recipe total power, which will probably break when it hits integer max. Need to move all internal recipe handling to use long instead of int to stop this from happening.

commented

Hey this bug still isn't resolved. The RF shows up properly and drains RF properly until 100%, but then it doesn't take any items, output any items, and has broken mass behavior intended ATM3 behavior.

To be precise:

Enderdragon Factory in an untouched ATM3 setup, Tier 4 factory (or whatever max is):

  • By itself it works fine.
  • Mass 1 works as intended.
  • Mass 2 does literally nothing. It's as if you didn't place it on. Dragon is still x2 (expected x3). RF is still the same as Mass 1. Takes input and outputs the same as Mass 1. Mass 2 would normally pass MAX_INT if working as intended. Working as intended
  • Mass 3 breaks the factory. It no longer takes items. It no longer outputs items. It says it will spawn 3x Dragons (expected x4) intended. When it finishes a cycle it stays at 0% for a certain amount of time (or you can rebuild the multiblock) draining RF the entire time before it starts going above 0% again, that lasts for over a minute I believe, I haven't timed it.
commented

Mass 2 does literally nothing.

This was intentional as seen in the ATM3 config here: https://github.com/AllTheMods/ATM-3/blob/master/overrides/config/woot/factory_config.json#L81

Mass 2 is a "stepping stone" to Mass 3 for the Dragon specifically although I hadn't considered it appearing as a bug since the players would expect mass upgrade to do something and in this case mass 2 does nothing

I'll consider addressing that in ATM3 but it's unrelated to the issue @nullKomplex has brought up that while the GUI appears fixed, the internal functionality at these high RF usage rates still does not work correctly. I have had multiple reports of this bug (mass3 dragon woot farm stops working) and it's consistently reproduceable w/ ATM3 configs as well

commented

I've updated the internal handling to support Long for the total recipe power and that fixes the wrapping round of the progress causing the factory to stop. RF per tick is still capped at 2^31 as exceeding that will not work with internal Forge power handling.

I've also had to change the NBT to write Long instead of Int, but it should correctly load the old values and write out the new.

This also means that recipes can now exceed 2^31 RF.
eg. I maxed out the total RF with a recipe that needs 9,223,372,036,854,775,807RF @ 2.1GRF/tick.

I've got more testing to do, as I want this fixed properly, rather than 99% of the way there.

2018-03-31_10 33 18

commented

I've completely rewritten the power handling with very large power usage is mind and tried to cover all the cases.

I ran with the ATM3 mod config and the new "give me all the power" handling.

Chaos Guardian
Base mob cost = spawnUnits(5000) * powerPerSpawnUnit(200) * spawnTicks(12000) = 12,000,000,000RF
That is 12 BILLION RF just for the mob!

No Mass gives 1 Chaos Guardian - 12,076,800,000RF @ 12000 ticks -> 1,006,400 RF/tick
Mass III gives 2 Chaos Guardian - 48,172,800,000RF @ 12000 ticks -> 4,014,400 RF/tick

Ender Dragon
Base mob cost = spawnUnits(500) * powerPerSpawnUnit(200) * spawnTicks(6000) = 600,000,000RF
So 600 Million RF for the mob.

No Mass gives 1 Ender Dragon - 638,400,000RF @ 6000 ticks -> 106,400 RF/tick
Mass I gives 2 Ender Dragon - 2,450,400,000RF @ 6000 ticks -> 408,400 RF/tick
Mass III gives 3 Ender Dragon - 7,886,400,000RF @ 6000 ticks -> 1,314,400 RF/tick

commented