Project

General

Profile

Bug #25730

The use of the excavator to mine asteroids increases the mass of the system

Added by diego_he over 4 years ago. Updated over 3 years ago.

Status:
Resolved
Severity:
Low
Assignee:
-
Category:
Physics
Target version:
Start date:
07/07/2020
% Done:

100%

Version:
Platform:
Windows
Expansion:
Core Game
Language:
English (US), Português-Brazil (Portuguese-Brazil)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

When it extracts ore from the asteroid to the ship, the total mass of the system cannot change, because it is moving the ore from the asteroid to the ship and not creating ore.

Apparently, the game is keeping the total mass of the asteroid fixed and, when using the excavator, the ore's mass is added to the system.

In my test the mass of the ship is 6.7t (picture1) and the asteroid mass is 178.4t.
The total mass of the system (ship + asteroid) is 185.1t (picture2).
If I remove 1.5t of ore from the asteroid and put it on the ship, the mass of the asteroid decreases by 1.5t and the mass of the ship increases by 1.5t, so the total mass must remain 185.1t.
Picture3 shows that the amount of minerals is added to the system, indicating an increase in the total mass of the system by 1.5t. I believe there is a bug here, because the game is keeping the mass of the asteroid fixed and adding ore mass to the system.
If disengage the ship from the asteroid, the mass will return to 6.7t + 1.5t = 8.2t (picture4)
Now, if I discard the ore from the ship and connect to the asteroid again, we can see that the game keeps the mass of the asteroid fixed because it considers the total mass equal to picture2, even with the asteroid without 1.5t of ore. (picture5)

The video showing the problem https://youtu.be/SRzGvAtCRrA

picture1.png (1.41 MB) picture1.png diego_he, 07/07/2020 05:31 AM
picture2.png (1.46 MB) picture2.png diego_he, 07/07/2020 05:31 AM
picture3.png (1.47 MB) picture3.png diego_he, 07/07/2020 05:31 AM
picture4.png (1.38 MB) picture4.png diego_he, 07/07/2020 05:31 AM
picture5.png (1.55 MB) picture5.png diego_he, 07/07/2020 05:31 AM
Fig2.jpg (363 KB) Fig2.jpg tjandreas, 07/18/2020 02:10 AM
Fig1.jpg (408 KB) Fig1.jpg tjandreas, 07/18/2020 02:10 AM
kerbal_asteroid_bug.png (1.58 MB) kerbal_asteroid_bug.png mahanako, 01/05/2021 10:19 AM
x.zip (29.4 KB) x.zip save file jj, 03/23/2021 10:49 AM
vessel.png (2.53 MB) vessel.png jj, 03/23/2021 10:58 AM
before.png (1.01 MB) before.png jj, 03/23/2021 10:58 AM
after.png (1.39 MB) after.png jj, 03/23/2021 10:58 AM
TJx3W5G - Imgur.jpg (97.4 KB) TJx3W5G - Imgur.jpg flart, 05/01/2021 09:59 AM
Capture d’écran 2021-06-25 195411.png (5.49 KB) Capture d’écran 2021-06-25 195411.png image 1 vinix38, 06/25/2021 05:55 PM
Capture d’écran 2021-06-25 195436.png (5.27 KB) Capture d’écran 2021-06-25 195436.png image 2 (25s later) vinix38, 06/25/2021 05:56 PM
53465
53466
53467
53468
53469
53657
53658
55577
56476
56477
56478
56830
57775
57776

History

#1 Updated by RafaHdz over 4 years ago

  • Status changed from New to Confirmed
  • % Done changed from 0 to 10

#3 Updated by tjandreas over 4 years ago

Could be related to the fix for Bug #24855. Unlike that bug, this one appears to have no workaround...

#4 Updated by tjandreas over 4 years ago

53657
53658

Additional info: apparently the game is resetting all asteroids to their original mass values when you fly them. Even on asteroids I mined out years ago. The PotatoRoid "mass" property in the save file is no longer consistent with the "currentMass" property of the ModuleAsteroidInfo module.

#5 Updated by jj over 4 years ago

  • Expansion deleted (Making History)
  • Language English (US) added

Basically the mass of the asteroid doesn't actually decrease when mined. This affects the mass display in the tracking station and I have also confirmed in testing that the inertia of the asteroid stays the same.

To reproduce:
1. Grab asteroid.
2. Take note of mass of the vessel (ship+asteroid) in tracking station's engineer panel.
3. Mine the asteroid down by at least one ton.
4. Discard ore.
5. Note that, incorrectly the mass of the asteroid has not decreased in tracking station engineer's display.

I don't see how this is low priority, since it
1. Practically breaks the feature and all contracts related to moving asteroids, since it makes moving them exponentially harder than it already is.
2. Breaks a feature that has worked before.

#6 Updated by Neilski about 4 years ago

jj wrote:

I don't see how this is low priority, since it
1. Practically breaks the feature and all contracts related to moving asteroids, since it makes moving them exponentially harder than it already is.
2. Breaks a feature that has worked before.

Good grief. I gave up playing this game many months ago because of the previous asteroid bug (#24855).
Having seen that it had been fixed, I have just resumed playing and tried to finish some missions. After mucking about and editing my save files to (I thought!) fix the initial discrepancy, I found that the mass keeps leaping back up and that indeed the system mass INCREASES when you start harvesting.

So yes, I'd echo jj's comment - how on earth can this be low priority? It completely knackers the asteroid feature of the game.

#7 Updated by Neilski about 4 years ago

tjandreas wrote:

Additional info: apparently the game is resetting all asteroids to their original mass values when you fly them. Even on asteroids I mined out years ago. The PotatoRoid "mass" property in the save file is no longer consistent with the "currentMass" property of the ModuleAsteroidInfo module.

I'm very keen to understand how it's deciding what the original mass of the asteroid was (I'm seeing something like this happening too).
If we can understand what it's using for that calculation, we perhaps stand a chance of editing the save file so as to mitigate the bug - e.g. put the mass down to a reasonable (or even the correct!) level again before each burn...

I've looked in the save file and tried a few things but have not yet found a way to do it. (If this issue is already under discussion on the forum I'd welcome a link, because my searches have turned up nothing.)

#8 Updated by Neilski about 4 years ago

OK, no idea if/where I should post this on the forum - have seen no sign of a discussion about it there, just a few vague references (and maybe one to this bug page) - so here's my recipe for working around the bug, which I found accidentally while attempting to understand it.
It's a faff but it appears to work very reliably (not yet had one I couldn't fix but some took a few attempts).

Steps:
  • capture one or more asteroids, because you can't "fix" them until after capture
  • release the asteroids to be fixed, and back off a wee bit because the shape will change (then cancel velocity to make recapture easier later!) - if you don't release first you can still fix it but will regret it later when you try to release it :-D
  • make a note of the asteroid names
  • save the game, make a copy of the SFS file, and edit the copy
  • for each asteroid to be fixed: search for the asteroid name until you find its VESSEL entry, and then find the seed value in the ModuleAsteroid section
  • search and replace all instances of that seed with a new value (one instance in ModuleAsteroid, one for each contract for which the asteroid is a match, maybe others)
  • how to choose "a new value"? bizarrely almost anything seems to work - this could mean changing it by a single digit or going for something totally different; I've tried various things and more than 90% of my changes were successful, but of course I have no clue why
    (class C example: I replaced 5ish instances of 35983897 with 35983898; class D: replaced 4 instances of -58758673 with -58758672; class E: I replaced -28602474 with -28602462 when -28602473 and -28602472 didn't work)
  • load the edited file and recapture each asteroid (shape change means some repositioning may be necessary for a clean capture)
  • verify if the system mass is now correct (i.e. matches sum of pre-capture ship mass & asteroid mass shown when you right-click) and that the system mass stays constant when mining; if not, re-edit file and choose another seed (even 0 worked for me during testing(!!), but would clearly have bad implications for asteroid-related contracts and I didn't test having two asteroids with the same seed)
  • ponder why in heck changing the seed should influence the buggy behaviour (I really really want to see that bit of source code!)

#9 Updated by Neilski about 4 years ago

Update: the workaround can "expire". I've observed that with a particular class E (the same one that had required several attempts), the system mass was suddenly way too high and increasing, after I had taken its true mass down from 1950ish tons to 1650 ish. Need more testing to understand what happened and at what mass, but its definitely reproducible. (This may be an insight into what madness is going on in the source code :-))
Happily I was still able to "fix" it again by re-changing the seed, so at worst the workaround seems to do what I originally wanted and permit maneuvering, even if it needs to be recharged now and then. (NB: only one asteroid seems to have exhibited this so far, with several others behaving OK.)

Edited 5 days later to add:
Sadly, the fix now seems likely to be temporary on all asteroids, and stops working entirely at some point (i.e. I stop being able to find a new seed which "works").
The combination of seed and class appears to create a non-zero minimum mass for each roid. So I can't land my 112 t mined-out class E on Kerbin because KSP thinks it's more like 800 t. I tried a bunch of seeds for that one (literally a couple of dozen), and the effective asteroid mass ranged from roughly 800 t to almost 3600 t. (Again, I'd love to see the code because just maybe there's a seed which gives an effective mass closer to the real thing.)
No more asteroid contracts for me for the time being; back to waiting for the bug to be fixed.

Edited again to add:
Well heck, seriously red face here. I have no idea how it took so long for the penny to drop, but I've belatedly realised that all I was ever doing by tweaking the seed was "choosing" a lighter "birth" mass for the roid. As long as this was lighter than the current mass, the bug didn't bite because (as tjandreas pretty much says above), the bug simply means that the roids can never be lighter than their nominal birth mass. If you start with a roid that's relatively heavy for its class, you will easily find a new seed which corresponds to a much lighter birth mass, allowing you to mine it and move it without pain. If you start with a light roid, or mine most of the mass away, you're stuffed unless you change the class, but that change would I imagine break any contracts you might want to complete. (PS: I no longer feel like I need to see the source code because the behaviour is no longer a mystery, LOL.)

#10 Updated by svpluto2 about 4 years ago

This affects console edition too.

#11 Updated by mahanako almost 4 years ago

55577

Excavating the asteroid, converting the ore to fuel and burning all the fuel should make the asteroid lighter - as shown in the asteroid info itself. But the asteroid does not get lighter.

#13 Updated by vinix38 almost 4 years ago

I can confirm this bug is still happening as of KSP 1.11.2 (windows-10 64bits)

#14 Updated by victorr almost 4 years ago

vinix38 wrote:

I can confirm this bug is still happening as of KSP 1.11.2 (windows-10 64bits)

Vinix38. We made some changes in 1.11.2, but are very interested in learning more about what you are seeing after the update. Could you give us more details? A save file would help us a lot.

#15 Updated by jj almost 4 years ago

56476
56477
56478

The craft is attached to a comet, has drills, ISRU and an engine. It drills the comet, converts the ore to fuel and burns it. This should reduce the mass of the system.

I first took a screenshot of the mass of the system from the tracking station, see before.png.

I then drilled, converted and burned some of the comet and took another screenshot from the tracking station, see after.png.

Note how the mass has increased, instead of decreased.

Save file is also attached.

#16 Updated by flart over 3 years ago

56830

also can confirm the bug.
Lowering asteroid mass, when you mining it (the mass in the PAW, the PART[PotatoRoid]/MODULE[ModuleAsteroidInfo]/currentMass) does not propagate to the real mass of the asteroid PART[PotatoRoid]/mass, that probably is used for the dV calculation

#17 Updated by vinix38 over 3 years ago

victorr wrote:

vinix38 wrote:

I can confirm this bug is still happening as of KSP 1.11.2 (windows-10 64bits)

Vinix38. We made some changes in 1.11.2, but are very interested in learning more about what you are seeing after the update. Could you give us more details? A save file would help us a lot.

As described many times above : mining an asteroid decreases the mass shown in the PAW, but not the physical one. A completely mined out asteroid has the exact same weight as when it was fresh. This is a stock behavior, but the addition of informative mods shows clearly the ship's mass increasing when it should be in equilibrium.
It is most game-breaking when trying to land with parachutes or calculating delta-V.

#18 Updated by victorr over 3 years ago

We have made some changes in this last 1.12.0 release and would like some feedback on this issue. Thanks.

#19 Updated by victorr over 3 years ago

  • Status changed from Confirmed to Ready to Test
  • Target version set to 1.12.0
  • % Done changed from 10 to 80

#20 Updated by vinix38 over 3 years ago

57775
57776

Tested on an 1.12.0 install, on a freshly generated asteroid, and I can still see the mass of the system increasing. Same thing on an asteroid generated in previous versions. The bug seems to be still there.

#21 Updated by Technicalfool over 3 years ago

  • Status changed from Ready to Test to Resolved
  • % Done changed from 80 to 100

This should be fixed in the very latest version. Please continue to report if this is not the case.

#22 Updated by flart over 3 years ago

I can confirm, the bug is fixed (also on an old save)

Also available in: Atom PDF