View Issue Details

IDProjectCategoryLast Update
0023432AI War 2Bug - GameplayJul 21, 2020 7:00 pm
ReporterCRCGamer Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Fixed in Version2.104 Negative Build Percentage Hotfix 
Summary0023432: Negative structure build percentage bug
DescriptionAfter a failed attempt by the AI to take a system via Usurper wave all structures that had gotten destroyed and needed repairs ended up with build percentages in rather extreme negatives numbers of up to -20000%. Resulting in persistent drains on economy state because builders attempt repairing items that take extreme amounts of time and material to recover.
TagsNo tags attached.

Relationships

related to 0023434 resolvedChris_McElligottPark Economic stations don't rebuild after they're destroyed. The percentage goes into the thousands and it never stops rebuilding 

Activities

CRCGamer

Jul 21, 2020 12:02 pm

developer  

negative build bug.save (801,144 bytes)

Puppet Master

Jul 21, 2020 12:12 pm

reporter   ~0057745

I have also had turrets have -% after a battle, wasn't fast enough to make a save, but can confirm that the issue is happening on vanilla + DLC1 at least.

Chris_McElligottPark

Jul 21, 2020 4:05 pm

administrator   ~0057750

This has got to be related to my changes yesterday to make this area of the code more thread-safe. I should be able to get this sorted shortly.

Chris_McElligottPark

Jul 21, 2020 7:00 pm

administrator   ~0057751

Thanks! Hotfix will be out in about 30 minutes, max.

* Somehow or other, it became possible for some self-building ships to go very negative in their build percentage (instead of counting up to 100%, they would be way in the negative percentages of building process).
** This seems to be a new bug in the last day or so, based likely around some changes that we made to improve the cross-thread reliability of the game. The problem is, upon manual code review of the areas that would be relevant, we just can't see anything that looks like a bug.
** Ultimately what is happening is that the SelfBuildMetalRemaining is getting absolutely giant in value, far larger than the original metal cost of the ship that is constructing. This was probably an integer overflow from it going really negative first, and then wrapping back around, but it's hard to be sure.
** We've put in some extra defensive code to make sure that if it goes negative at all, it marks itself as complete. We've also put in protections so that if you "owe more than it is worth" in general, that it will assume that there was an overflow and just go ahead and finish it now. These two changes should help to keep the problem from happening again, and fix the cases where it was already in progress.
** While we were already at it, we put in a small general improvement that prevents you from being overcharged for the last tiny percentage of constructing a ship. If you had a bunch of engineers building, and each frame cycle they normally would do 1.1% of the construction of a ship, and charge you accordingly, then you might wind up in a case where you had only 0.2% remaining work to do, and yet got charged the full 1.1% rate. It is now careful to only charge you for what you would owe, so the 0.2% rate in this example.
** Hopefully there are no other errors in any of the metal flows, with things like drones building, anything engineers would claim or repair, etc. The code looks clean, but then again the code for the self construction also looks clean. In the next couple of days, please let us know if you see anything else that seems amiss with how metal is being charged against you. So far we can't duplicate anything like that anymore, now.

Issue History

Date Modified Username Field Change
Jul 21, 2020 12:02 pm CRCGamer New Issue
Jul 21, 2020 12:02 pm CRCGamer File Added: negative build bug.save
Jul 21, 2020 12:12 pm Puppet Master Note Added: 0057745
Jul 21, 2020 3:11 pm BadgerBadger Relationship added related to 0023434
Jul 21, 2020 4:04 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
Jul 21, 2020 4:04 pm Chris_McElligottPark Status new => assigned
Jul 21, 2020 4:05 pm Chris_McElligottPark Note Added: 0057750
Jul 21, 2020 7:00 pm Chris_McElligottPark Status assigned => resolved
Jul 21, 2020 7:00 pm Chris_McElligottPark Resolution open => fixed
Jul 21, 2020 7:00 pm Chris_McElligottPark Fixed in Version => 2.104 Negative Build Percentage Hotfix
Jul 21, 2020 7:00 pm Chris_McElligottPark Note Added: 0057751