KSP Interstellar Extended

KSP Interstellar Extended

1M Downloads

Game crash on the least likely part composition.

vdubikhin opened this issue ยท 7 comments

commented

My game crashes if I combine 3 parts, that are not supposed to be part of the same design: magnetic nozzle, pebble bed reactor and charged particle converter:
https://imgur.com/KYTh9bA

The last part of the log just before the crash:

[LOG 10:45:50.689] Unpacking Kraken_test1
[LOG 10:45:50.704] [KSPI] - Generator Shutdown: No radiators available!
[ERR 10:45:50.705] computeMassAndInertia: Provided mass or density has no valid value

[ERR 10:45:50.706] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)

[ERR 10:45:50.706] computeMassAndInertia: Provided mass or density has no valid value

[ERR 10:45:50.707] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)

[ERR 10:45:50.707] computeMassAndInertia: Provided mass or density has no valid value

[ERR 10:45:50.708] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)

[ERR 10:45:50.708] computeMassAndInertia: Provided mass or density has no valid value

[ERR 10:45:50.709] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)

[ERR 10:45:50.709] computeMassAndInertia: Provided mass or density has no valid value

[ERR 10:45:50.710] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)

[ERR 10:45:50.710] computeMassAndInertia: Provided mass or density has no valid value

[ERR 10:45:50.711] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)

[LOG 10:45:50.713] recalculating orbit for Mark1-2Pod: Kerbin ( Update mode TRACK_Phys )
rPos: [-492249.731903076, -507.598287701607, 343202.684950352]   rVel: [-100.067915925516, 0, -143.525697631301] |174.966321554258|
[LOG 10:45:50.715] recalculated orbit for Mark1-2Pod: Sun ( UT: 5733.78000003231 )
rPos: [NaN, NaN, NaN]   rVel: [NaN, NaN, NaN] |NaN|
Delta: [NaN, NaN, NaN] / [NaN, NaN, NaN]
[LOG 10:45:50.717] [Progress Node Reached]: Escape
[LOG 10:45:50.718] [Progress Node Complete]: Escape
[LOG 10:45:50.719] [Progress Node Reached]: Flyby
[LOG 10:45:50.720] [Progress Node Reached]: Sun
[LOG 10:45:50.720] [Progress Node Complete]: Flyby
[LOG 10:45:50.722] Look rotation viewing vector is zero
commented

My gut feeling says that the "No radiators available" has something to do with the problem. Most likely it caused some variable getting 0 values resulting in a divide by zero somewhere else.

commented

Definitely not. The craft in the image is minimum setup that causes kraken to happen. Adding radiators does not influence it at all.

Removing one of the three parts does not cause game crash either. Removing rector module from pebbled bed reactor part cfg also does not cause the game to crash. So, my bet that problem exists somewhere in the resource manager and is associated with charged particle consumption. I still need to check if the problem is unique to pebble bed or happens with any reactor, that has only thermal output.

commented

Any reason why pebble bed reactor has the same module as dusty plasma?

The module InterstellarFissionPBDP has interface IChargedParticleSource, which causes pebble ped reactor to behave like a charged particle reactor from the perspective of the mag. nozzle. A very bad reactor as it does not actually produce any CP, but nozzle still attaches itself to this reactor.

commented

The reason the pebble bed reactor and dusty plasma use the same reactor is because they don't reuse the fuel like the molten salt reactor does. It spend the fuel after which it stored as waste or thrown overboard

commented

Go ahead

commented

I would split InterstellarFissionPBDP module into two: one that implements IChargedParticleSource and is used for dusty plasma and one that does not: pebble bed. As it has turned out having reactor that has "fake" charged particle source causes all sorts of problems.

First of all, I have found the location that caused my game to crash(in InterstellarMagneticNozzleControllerFX):
var ispPowerCostMultiplier = 1 + max_power_multiplier - Math.Log10(current_isp / minimum_isp);

            _requestedElectricPower = _charged_particles_received * ispPowerCostMultiplier * 0.005 * Math.Max(_attached_reactor_distance, 1);

            //This line causes game to crash
            _recievedElectricPower = CheatOptions.InfiniteElectricity
                ? _requestedElectricPower
                : consumeFNResourcePerSecond(_requestedElectricPower, ResourceManager.FNRESOURCE_MEGAJOULES);

For pebble bed current_isp and minimum_isp are 0, so ispPowerCostMultiplier =NaN. As a result _requestedElectricPower=NaN and resourse manager tries to supply vessel with NaN watts of power. Adding a sanity check to consumeFNResourcePerSecond:
if(double.IsNaN(power_per_second))
power_per_second = 0;
Fixes the problem.

commented

While this is a solution to the crash I want to take one step further and add similar sanity checks to other functions of the resource manager. Furthermore, something needs to be done about pebble bed reactor.

One possible fix is to implement a separate class that does not implement interface for CP and so mag. nozzle does not attach itself to the reactor.

Another, more lightweight solution is to add these lines to pebble bed part cfg file:
chargedParticleEnergyEfficiency = 0
chargedParticlePropulsionEfficiency = 0
The nozzle will still attach itself to the reactor but at least it will not use if for propulsion and attempt any calculations, because it checks for ChargedParticlePropulsionEfficiency > 0.

On a side note, is there a more convenient way to troubleshoot bugs other then gaze upon the code and use a lot of debug.log statements? Finding exact cause for this problem took some time, as I had to restart KSP a lot of times and it takes quite a while to load, even with reduced part count.