Jump to content

[1.1.3] Orbital Decay v1.5.2 (17/07/2016) - Total Overhaul


Whitecat106

Recommended Posts

2 minutes ago, ZAJC3W said:

@MaximumThrustLan updating to zero seems to be game not returning correct values, same error happens with mass,area and fuel left. it's beyond my capability to eliminate those. Might be game issue or mod requesting data at the wrong moment, no idea.

I did run 50 debris and 20-ish satelites before it bogged down fx8350

Thanks!

I really wanted to use this mod, but this is a serious problem for me, I do a lot of constellations where half of the vessels have LAN at 0, and half LAN at 180. Sadly I don't have knowledge to help with this, hope someone can.

And a suggestions to increase performance is to only apply the mod in vessels until a certain altitude, like only below Space High (250 km for Kerbin). Anything too high takes a huge amount of time to decay or use all the fuel for station keeping anyway.

Link to comment
Share on other sites

8 hours ago, AlliedForth said:

@MaximumThrust

I dont know if I’m missing something or if its some value related to the mod, but what does LAN stand for in this context?

The mod is exactly what i was looking for, just want to know what value is set to 0 sometimes.

Longitude of Ascending Node.

Pretty much what it sounds like, just tells you where the AN is located.

Link to comment
Share on other sites

On 4/1/2018 at 9:00 AM, MaximumThrust said:

Thanks!

I really wanted to use this mod, but this is a serious problem for me, I do a lot of constellations where half of the vessels have LAN at 0, and half LAN at 180. Sadly I don't have knowledge to help with this, hope someone can.

And a suggestions to increase performance is to only apply the mod in vessels until a certain altitude, like only below Space High (250 km for Kerbin). Anything too high takes a huge amount of time to decay or use all the fuel for station keeping anyway.

Ahhh, so that is why my constellation got out of whack. Had to use hyperedit to fix it.

Link to comment
Share on other sites

 

I may be mistaken but after quickly glancing at the code it seems that the line  in Decay Manager

orbit.LAN = VesselData.FetchLAN(vessel);

should be

orbit.longitudeOfAscendingNode = VesselData.FetchLAN(vessel);

That should get it to fetch the proper LAN I think.

 

Edited by Frylovespi
Link to comment
Share on other sites

On 4/15/2018 at 3:42 PM, Frylovespi said:

 

I may be mistaken but after quickly glancing at the code it seems that the line  in Decay Manager

orbit.LAN = VesselData.FetchLAN(vessel);

should be

orbit.longitudeOfAscendingNode = VesselData.FetchLAN(vessel);

That should get it to fetch the proper LAN I think.

 

Have you tried it? Does it work? Please share it!

Link to comment
Share on other sites

7 hours ago, White Owl said:

Have you tried it? Does it work? Please share it!

I am not much of a programmer and couldn't get it to compile. So all it needs is someone to fix the error and to recompile. Easy enough but slightly above my level. I can only do monkey work like program contracts. I've managed to re-compile a few mods over the years but tried for 3 hours on this one and just couldn't get all the references in that were needed. If a .csproj was included in the source, then I would have had better luck figuring it out.

Edited by Frylovespi
sp fix
Link to comment
Share on other sites

5 hours ago, Frylovespi said:

I am not much of a programmer and couldn't get it to compile. So all it needs is someone to fix the error and to recompile. Easy enough but slightly above my level. I can only do monkey work like program contracts. I've managed to re-compile a few mods over the years but tried for 3 hours on this one and just couldn't get all the references in that were needed. If a .csproj was included in the source, then I would have had better luck figuring it out.

I'm pretty much in the same boat. I can get a simple project done if it comes with step-by-step instructions... looked at this one last night and couldn't figure it out.

Link to comment
Share on other sites

I'm not really familiar with KSP modding in general, but I've at least worked with C# and Mono enough to compile stuff, so gave it a shot.

Unfortunately, the result is that change doesn't even compile:

DecayManager.cs(547,31): error CS1061: Type `Orbit' does not contain a definition for `longitudeOfAscendingNode' and no extension method `longitudeOfAscendingNode' of type `Orbit' could be found. Are you missing an assembly reference?

I'll poke around in the KSP documentation and edit this if I see any obvious fix.

Edit: Nope, the Orbit class doesn't have anything even remotely resembling a "longitudeOfAscendingNode" member, aside from the "LAN" it was orignally. Searching the Orbit class reference for the word "longitude" shows nothing.

Edited by Maeyanie
Link to comment
Share on other sites

10 hours ago, Frylovespi said:

i honestly have no idea and was just playing around with the code. Could be why it didn't compile

It's exactly why. If you try to access a field or method or property on a class then it better exist or your code won't compile. Did you look at the page that @Maeyanie linked to? (here it is again: https://kerbalspaceprogram.com/api/class_orbit.html)

That website also contains documentation for other KSP classes and their fields and methods.

Look, the problem with the LAN is either that it's being updated with bad information or that the lookup (VesselData.FetchLAN) is failing out right. I'm a little skeptical the latter is the cause but if that method ever DOES fail (to find a vessel and return it's orbital LAN) then the only possible outcome is that it returns a default value of 0 which will then corrupt your orbit's LAN. Instead of the way it is now, failing to find the vessel's associated data should either be treated as a fatal error or at the very least, the orbit's LAN should not be updated with that data.

The reason I'm skeptical of that being the actual cause is because there is a lot of other Fetch* methods that return a vessel's orbital parameters using that technique so you should be seeing a lot more happening than just the LAN being corrupted. (as near as I can tell it's storing each vessel's orbital data in a save file database and retrieving it as needed. I assume it's done that way because of OD operations being performed on it in the database before actually applying it to the actual vessel's orbit...)

If it were me, just to be on the safe side I'd rewrite all those to either throw an error or return some other value that lets the calling method know that we couldn't return useful data. (and then THAT method can either just not set the LAN or find another way of computing and setting the data)

Then I would look at every time that UpdateVesselLAN is called and look at how that value was computed.

I would also get rid of every line that says VesselData.UpdateVesselLAN(vessel, VesselData.FetchLAN(vessel)); 

Because THAT is definitely not doing anything useful. (it's basically telling VesselData to retrieve the LAN value for that vessel from its database and then write it BACK into the same vessel entry in that database without any modification whatsoever)

(maybe those lines exist because some value modification was meant to happen later, but as written now, it's not doing anything)

Edited by Starwaster
Link to comment
Share on other sites

14 minutes ago, Starwaster said:

I would also get rid of every line that says VesselData.UpdateVesselLAN(vessel, VesselData.FetchLAN(vessel)); 

Because THAT is definitely not doing anything useful. (it's basically telling VesselData to retrieve the LAN value for that vessel from its database and then write it BACK into the same vessel entry in that database without any modification whatsoever)

(maybe those lines exist because some value modification was meant to happen later, but as written now, it's not doing anything)

I did poke through the code a bit to see if there were any obvious things which could cause the LAN thing... but, I don't know much about KSP mods, and the math involved in all of this is way over my head, so didn't get too far.

There are a few other coding oddities like that I did see, such as DecayManager.cs line 534, " if (vessel = FlightGlobals.ActiveVessel) "... technically this sets vessel to FlightGlobals.ActiveVessel, and then checks if vessel isn't null, in a single line. I'm guessing that's a typo and supposed to be a == (check if the two are equal) instead, but it could be intentional.

As much as I love the idea of this mod, I've had to stop using it due to running into a wide variety of craft-breaking bugs, so I'm not all that motivated to try to learn enough to fix it.

Link to comment
Share on other sites

10 minutes ago, Maeyanie said:

I did poke through the code a bit to see if there were any obvious things which could cause the LAN thing... but, I don't know much about KSP mods, and the math involved in all of this is way over my head, so didn't get too far.

There are a few other coding oddities like that I did see, such as DecayManager.cs line 534, " if (vessel = FlightGlobals.ActiveVessel) "... technically this sets vessel to FlightGlobals.ActiveVessel, and then checks if vessel isn't null, in a single line. I'm guessing that's a typo and supposed to be a == (check if the two are equal) instead, but it could be intentional.

As much as I love the idea of this mod, I've had to stop using it due to running into a wide variety of craft-breaking bugs, so I'm not all that motivated to try to learn enough to fix it.

Yeah I don't think that line looks right. The method (CatchUpOrbit) containing that line is often called from within loops where the list of vessels in ActiveGlobals.Vessels is walked through and CatchUpOrbit is called for that vessel. So basically the only one of those vessels that will ever actually get operated on by CatchUpOrbit is the active one. That can't be right.

BTW you can link to a line or group of lines in a Github file by clicking on a line number in that file and then shift-click on the last line you want to include. Grab the resulting link from the page's URL and then paste:

https://github.com/Whitecat106/OrbitalDecay/blob/6d648de50261a63fb170f9863106f21ba5131542/Source/DecayManager.cs#L92-L100

Click on that and you will see what that looks like

Link to comment
Share on other sites

It happens once in a blue moon, good luck with it.

Try calling for LAN again if it's returned as zero. By calling for LAN i mean check vessel's land using KSP engine methods, as they seem to be a bit touch and go. 

Or vessel data is being checked at wrong moment. 

Edited by ZAJC3W
Link to comment
Share on other sites

Easier-to-reproduce bugs are having station keeping on, and doing... pretty much any sort of situation change. Suborbital-Orbital, Orbital-Hyperbolic, etc. It tends to crash the game, NaN out the craft, and similarly-bad things.

Link to comment
Share on other sites

I was also thinking about the bugs I'd been running into, and most of them involved leaving station keeping on while something happened... so an easy work-around, add a few lines to turn off SK when the throttle is used.

Not sure whether you'd like a Github PR for this or what, but I put together a couple of patches... one which does the check every OnUpdate(), and one which only does it during the once-per-second check of whether or not the engines have changed. Not sure how much of a performance penalty doing it every frame would have, vs. the chance of messing things up if it only takes a <1 second burn to hit a problem.

Edit: Put a compiled .dll in that file too, if anyone wants to try it without going through compiling it... it also contains that = to == change. :)

Edited by Maeyanie
Link to comment
Share on other sites

Using this mod sets all my crafts' LAN to zero, 100% of the time. I'm not sure when this started happening, but the mod is now unusable for me. The problem is, I'm not sure how helpful I can be in giving reproduction steps, since I'm still running 1.3.1 in a ridiculously heavily modded install with a lot of custom edits. But I can certainly test anybody's changes to see if they fix the LAN bug in particular. Testing station keeping though... honestly, I don't think I've ever even tried to use that function, so don't know what it's supposed to look like.

Edit: @Maeyanie, At first glance, your changes appear to have slightly increased my framerate, but the LAN=0 bug remains.

Edited by White Owl
Link to comment
Share on other sites

1 hour ago, White Owl said:

Edit: @Maeyanie, At first glance, your changes appear to have slightly increased my framerate, but the LAN=0 bug remains.

You have an ongoing saved game with the LAN = 0 bug? As in you can load that game up right now and can see that it's happening? If so please put both the save file (either persistent.sfs or quicksave.sfs where it's been saved while the bug is active) and the VesselData.cfg file from whitecatindustries\orbitaldecay\plugins\ folder somewhere I can download them?

(as an aside, that game is probably permanently corrupted as in even if the bug gets fixed, you can expect existing vessels to still be bugged)

Link to comment
Share on other sites

@White Owl hmmm ok so I'm not actually sure what the role is of the VesselData.cfg file or if it matters whether or not it's present. It was being generated and updated when I first started looking into this but now it's not and that apparently doesn't seem to matter so if it's not there...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...