Jump to content

[1.4] StageRecovery - Recover Funds+ from Dropped Stages - v1.8.0 (March 11, 2018)


magico13

Recommended Posts

I also added some things to the API that should make KerbalKonstruct support super easy, but it will require a change on their side...

- Added OnRecoveryProcessingStart and OnRecoveryProcessingFinish events to API, for Kerbal Konstructs support. Fire when first starting recovery code (after determining viability for recovery, but before Vt calculations) and at the end of recovery code (doesn't include information about recovery, just for cleaning up)...

Sounds good chap and I'll have a look-see. KK is only concerned with recovery of splashed and landed missions so I'm not sure this is the right way round to do it though. What might be a better approach is if KK's calculation of distance to nearest open base was exposed for StageRecovery to be able to hook on. TBH though, my coding skills are sucky and rusty so I'll probably need some help with that.

Link to comment
Share on other sites

Sounds good chap and I'll have a look-see. KK is only concerned with recovery of splashed and landed missions so I'm not sure this is the right way round to do it though. What might be a better approach is if KK's calculation of distance to nearest open base was exposed for StageRecovery to be able to hook on. TBH though, my coding skills are sucky and rusty so I'll probably need some help with that.

I considered trying to get at that function through reflection, but it's always a pain to do properly. I figured others might want to use the new events in the API for some reason, and it should be pretty plug and play for you, if you decide to include it. If you want me to make the changes for you and do a PR I can, otherwise I'll try to quickly go through what you'd need to do.

1. Include the StageRecovery Wrapper in KK (and change the namespace to that of KK's)

2. Where you add GameEvents in the KerbalKonstructs.cs file, add


if (StageRecoveryWrapper.StageRecoveryAvailable)
{
StageRecoveryWrapper.AddRecoveryProcessingStartListener(OnVesselRecoveryRequested); //This uses the already existing function in KK that change the space center instance when something is being recovered
StageRecoveryWrapper.AddRecoveryProcessingFinishListener(SRProcessingFinished); //This requires a new function for now, but it will just link to the OnVesselRecovered function
}

3. You'll need to add one tiny function for resetting the space center, but we'll call the already existing OnVesselRecovered function in it so you won't need to make changes in the future.


void SRProcessingFinished(Vessel vessel)
{
OnVesselRecovered(vessel.protoVessel);
}

And that's it! If SR isn't installed, it won't do anything, but if it is it'll set the SpaceCenter instance when SR goes to do calculations, then reset it at the end. If you make changes to how the normal recovery works, it should change for SR based recovery as well. Note that the SRProcessingFinished doesn't say whether or not the recovery was successful, just that it finished processing. If you want to do anything on only a successful recovery, you'll need to add a new event listener with StageRecoveryWrapper.AddRecoverySuccessEvent().

I should note that I haven't been able to test it a whole lot. It occurs to me now that it might be possible for the RecoveryProcessingFinish event to not be fired if an error occurs during recovery processing, meaning the SpaceCenter instance would get "stuck". Except, thinking about it the code still continues when it catches the most common errors. Other errors would indicate a more severe problem anyway, so I don't think that will be an issue. Just something I'll need to watch out for.

If you decide you'd rather just expose the GetClosestBase function, we can talk more to figure out a way to do that. Thanks :)

- - - Updated - - -

I haven't updated to the latest version yet, but I've been getting a few stages that the SR dialog tells me are recovered without any notifications popping up for the recovered funds. The last one was a stage I separated from in atmo, after aerobraking below 2000m/s. It had sufficient parachutes to land safely, but stayed in physics bubble until I landed the capsule, and then just disappeared.

SR can only work (and does only work) when vessels are unloaded and destroyed as a result. If they're still in physics range, that's on you to recover. Make sure it didn't also land and just can't been seen in the map because it's listed as "debris" (so, in the map/tracking station modify the filters at the top until you can see debris).

Link to comment
Share on other sites

Not sure how to give you a +1 or something, so another post of thanks.

I personally use a bit of imagination on what I call "near volume space" rather than the CLS mod. A space holding adapter for instance might have some of the fuel tank shifted into it to create space in the fuel tank. I do empty out fuel tanks either fully as a habitable space sometimes to. So having the option to self regulate vs CLS is great as Im also glad to see folks supporting each other's mods.

Sometimes with my near volume approach it can be tricky during a refuelling to do it right or balanced without filling up the wrong tank. So glad how your mod works and gladder still for it being patched.

Edited by brygun
Link to comment
Share on other sites

Mission successful :)

allgood.png

This rocket was launched from Round Range and the recovery distance used for the dropped booster stages is correct. Same issue KSP has with the name of the base reported for the recovery of a landed or splashed mission, but that's a minor concern.

Thanks magico13 for making this so easy to sort and for the great mod. I'll get the new version of KK out later today.

Edited by AlphaAsh
Link to comment
Share on other sites

So I am using 1.5.6 with 1.0 KSP and I am getting nothing of the sort of what you have in the images. When I load a craft, all I get is the recovered and destroyed options, nothing that says parts, crew, or anything else..... And even though I equip my stages with parachutes and drop them, it doesn't tell me anything about them being either recovered or destroyed.

Whats more is I cannot seem to get the menu to pull up during the VAB at all either.

Link to comment
Share on other sites

Those pictures are a bit out of date, so what you describe isn't too far from what you should be seeing. Let me see if I can help.

The window in flight will just list recovered/destroyed until something is actually recovered or destroyed, then clicking on the button will list all of the recovered/destroyed stages. Clicking again on a stage in the list will bring up the parts/crew/etc tabs.

KSP 1.0 increased the physics range, so it's possible that the stages you're dropping are hitting the ground before they would go out of physics range. Try either deploying the chutes when you decouple, or decoupling at a higher altitude. You need to get 22.5km away from them before they hit the ground in order for StageRecovery to kick in (that's when KSP deletes them).

In the VAB/SPH clicking the SR button will cause a message to appear in the stock messaging system (where contract completion messages go). There isn't a SR specific GUI in the editor.

If you still need help, let me know and I'll try my best to help you :)

Link to comment
Share on other sites

Set set the chutes pressure setting to .32. This keeps the chutes from popping out until I think it was ~15-20k? I forget now. I was having a problem with the retro burn section burning off chutes during reentry if it followed too close to the pod. With a setting of .32, you can stage the chutes, but they don't deploy until after reentry. Even at .3 I was loosing chutes. .32 puts it a bit low if the part happens to come down over mountains. They may not slow down enough before hitting.

Link to comment
Share on other sites

Those pictures are a bit out of date, so what you describe isn't too far from what you should be seeing. Let me see if I can help.

The window in flight will just list recovered/destroyed until something is actually recovered or destroyed, then clicking on the button will list all of the recovered/destroyed stages. Clicking again on a stage in the list will bring up the parts/crew/etc tabs.

KSP 1.0 increased the physics range, so it's possible that the stages you're dropping are hitting the ground before they would go out of physics range. Try either deploying the chutes when you decouple, or decoupling at a higher altitude. You need to get 22.5km away from them before they hit the ground in order for StageRecovery to kick in (that's when KSP deletes them).

In the VAB/SPH clicking the SR button will cause a message to appear in the stock messaging system (where contract completion messages go). There isn't a SR specific GUI in the editor.

If you still need help, let me know and I'll try my best to help you :)

Okay, I will try it with your suggestions and see how well it works. Thanks!

Link to comment
Share on other sites

Those pictures are a bit out of date, so what you describe isn't too far from what you should be seeing. Let me see if I can help.

The window in flight will just list recovered/destroyed until something is actually recovered or destroyed, then clicking on the button will list all of the recovered/destroyed stages. Clicking again on a stage in the list will bring up the parts/crew/etc tabs.

KSP 1.0 increased the physics range, so it's possible that the stages you're dropping are hitting the ground before they would go out of physics range. Try either deploying the chutes when you decouple, or decoupling at a higher altitude. You need to get 22.5km away from them before they hit the ground in order for StageRecovery to kick in (that's when KSP deletes them).

In the VAB/SPH clicking the SR button will cause a message to appear in the stock messaging system (where contract completion messages go). There isn't a SR specific GUI in the editor.

If you still need help, let me know and I'll try my best to help you :)

Hi there!

First of all, thx a lot for your awesome job on your mods. I totally love them!

Unfortunatly i've got a little issue with SR. The SR button in the VAB dont show up at all, and messages of recovered/destroyed stages neither. But the last point must be because of the increased physic's loading distance as you mentioned.

Can you just help me about that invisible button? Thank you :)

Link to comment
Share on other sites

Hi there!

First of all, thx a lot for your awesome job on your mods. I totally love them!

Unfortunatly i've got a little issue with SR. The SR button in the VAB dont show up at all, and messages of recovered/destroyed stages neither. But the last point must be because of the increased physic's loading distance as you mentioned.

Can you just help me about that invisible button? Thank you :)

Could be that the mod is installed wrong (make sure the StageRecovery folder is inside the GameData folder, and not that there's a GameData folder inside the GameData folder). It should look like {KSP Folder}\GameData\StageRecovery, not {KSP Folder}\GameData\GameData\StageRecovery. If that's not the problem, it might be that a mod is having an error and is preventing StageRecovery from loading, which the log files might be able to point out. Alternatively, Active Texture Management might be affecting it (but usually that just turns it white). One last option is that you have the toolbar mod installed, in which case the button will appear there but not in the Stock toolbar. You should be able to choose between them in the SR settings (which you can do in game once you find the button, or out of game by modifying the Config.txt file)

Link to comment
Share on other sites

Ok! I've found where does this issue come from! It appears that SR mod might be in conflict with FMRS mod. I will delete FMRS that i dont really have the need of and everything shoud will be fine after that. Thanks for your quick replay anyway Magico. I really apprecied it :)

Edited by b0bby
Link to comment
Share on other sites

Ok! I've found where does this issue come from! It appears that SR mod might be in conflict with FMRS mod. I will delete FMRS that i dont really have the need of and everything shoud will be fine after that. Thanks for your quick replay anyway Magico. I really apprecied it :)

Well that's unfortunate, because I tried to add FMRS compatibility in one of the most recent updates :( It was working fine in 0.90, but I didn't get to test it in 1.0 before release. Since I play with both mods, I'll probably run into issues at some point and will fix them. Thanks for doing some problem solving on your own as well :)

Link to comment
Share on other sites

Well that's unfortunate, because I tried to add FMRS compatibility in one of the most recent updates :( It was working fine in 0.90, but I didn't get to test it in 1.0 before release. Since I play with both mods, I'll probably run into issues at some point and will fix them. Thanks for doing some problem solving on your own as well :)

Wait, my problem is solved, but my SR icon wasnt showing up till i've found it in my toolbar mod. Maybe i was wrong about FMRS compatibility. You should wait for some more feedback about this ;)

Link to comment
Share on other sites

Hi Magico! Thanks for this great mod. It has really made the CFO of To Space Inc a nicer person to be around ;)

I have one suggestion for this mod. Would it be possible to add one extra line to the recovery message that states what the maximum recovery funds would have been.

We are of course able to check this in the editor, but I think this might really add to wanting te recover as efficiently as possible.

Edited by Vandros
Spelling
Link to comment
Share on other sites

I have one suggestion for this mod. Would it be possible to add one extra line to the recovery message that states what the maximum recovery funds would have been.

Definitely doable! I think I was even wanting this the other day, so I'll try to remember to add it in next version :)

Link to comment
Share on other sites

Added FMRS support. The two shouldn't try to recover the same things now and should play nicely together!

Does this mean that if FMRS is active, StageRecovery will not fire? I thought that perhaps I had hit a bug when SR refused to recover my spent stages, until I tried turning FMRS off.

Link to comment
Share on other sites

Does this mean that if FMRS is active, StageRecovery will not fire? I thought that perhaps I had hit a bug when SR refused to recover my spent stages, until I tried turning FMRS off.

If FMRS is on it will handle recovery of controlled stages and stages with RealChutes on them. That also includes all parachutes when FAR is installed, on SR's side at least. FMRS might not try to recover those.

With stock chutes or FMRS turned off, StageRecovery takes over completely. Unfortunately, that's about all I can do because FMRS hasn't made any changes on their side for the compatibility (nor is there an FMRS API)

Link to comment
Share on other sites

Hey Magico, This is not a bug report, im just curious if you or anybody else have the same experience as me.

Whats up with the huge cpu spikes every 5-10 seconds?

Im running this on a low-end computer which pulls around 25 FPS with 200-part ship in VAB, every 10 or so seconds fps comes to a halt for around 1-4 sec.

Is it possible for the you (Magico) to stop whatever check / loop running at least while in the VAB or increase the timer to say: 60 seconds?.

edit: This goes without saying that im only running your mod, on a clean steam install.

Edited by neskire
Link to comment
Share on other sites

Hey Magico, This is not a bug report, im just curious if you or anybody else have the same experience as me.

Whats up with the huge cpu spikes every 5-10 seconds?

Im running this on a low-end computer which pulls around 25 FPS with 200-part ship in VAB, every 10 or so seconds fps comes to a halt for around 1-4 sec.

Is it possible for the you (Magico) to stop whatever check / loop running at least while in the VAB or increase the timer to say: 60 seconds?.

edit: This goes without saying that im only running your mod, on a clean steam install.

This is with StageRecovery, not with Kerbal Construction Time, right? StageRecovery doesn't run anything inside a loop, ever, except for GUI code that only runs when an SR GUI is open (which only can happen in flight and in the space center). I'd be very surprised if it was StageRecovery related.

Now, if you meant Kerbal Construction Time, then I can totally see that happening. Whenever parts are changed, KCT has to update the BP value, meaning it has to recalculate everything, including parsing the build rate formula. That check is restricted to happen once per second (I believe it's once per second, it might be longer) and only when parts have been changed within that time, meaning just sitting in the editor without clicking things can't trigger it.

If you want to send log files I can try to see if anything is being reported there. I'd also double check that it doesn't happen under otherwise identical circumstances in a vanilla install. To minimize other variables, I suggest you load up the game with SR installed, load that ship, and observe if you get the problem. Then close KSP, remove SR, load up KSP and that ship and see if you still get the freezes. If you do, it's a KSP problem, not a mod problem. If you don't, then I'll definitely need to see log files from when you have SR installed.

Link to comment
Share on other sites

You are right, im seeing this using only StageRecovery. At first i thought it was freezing every time i put a part on, since as you say thats where addons usually recalculate stuff, like Kerbal Engineer. However this happens statically, every 10 seconds.

Anyway heres a log. I cleared it in advance so it the smallest size.

https://www.dropbox.com/s/es7azlxsjt1ybmm/Player.log?dl=0

I fear that i'll have to record the problem, dont get me wrong, i will record it if it means finding a solution to this. Since your addon really is a must. :)

Edited by neskire
autocorrect -.-
Link to comment
Share on other sites

I tried to replicate the issue you were having neskire, but unfortunately I'm not seeing anything similar. I took one of the stock ships and upped it's part count to over a thousand and didn't see any slowdowns in the editor with just SR installed. According to the FPS counter in the debug menu my fps stayed at about 33 fps (but leveled out there and didn't change at all which makes me wonder if that's working properly). Moving the camera so basically no parts were visible raised that up substantially, but no spikes were noticed. When panning around I didn't notice any lag. And, before you ask, yes I did try to launch the monstrosity. It went about as expected :P

l1STNlc.png

NbXuaJ5.png

qc402Ad.png

Link to comment
Share on other sites

When I have an upper stage set into a degrading orbit (peri ~45k) I noticed that it does not experience any drag effects that would normally cause the stage to finish falling to the ground so stage recovery never takes it. I think if I put the orbit down to <0 it will recover, but the faster reentry speed tends to burn things up...

Sometimes I even land my ship and recover it with the debris still floating in an orbit that should decay with drag. Would it be possible to have SR check for debris that has not yet landed to see if it should decay and do the recovery at the same time you recover the command part of the ship?

Edited by Smurfalot
Link to comment
Share on other sites

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