Jump to content

Module For Impact Probes With Science Point Payouts


Recommended Posts

Howdy everyone,

I've successfully created a plugin that allows for planet specific conditions to experiments, along with some added requirements such as resources in order to allow a experiment to complete itself. But as I'm working on creating custom experiments to mirror historical probes, there are a lot of impact probes.

I wanted to know if someone would have an idea of how to go about to create a module that would detect a vessel crashing, and upon this happening automatically award the player with science points?

It's specifically the crash detection + science payout I need help with, since I already have code to check body/EC/data. So if someone can help me out that would be amazing. My C# skills are by no means amazing, so if the kind souls helping can be as descriptive as possible, it would be doubly amazing.

Impact probes would be a great addition for KSP!

Thanks in advance,

Link to comment
Share on other sites

This one is tricky. The vessel would have to be active, since otherwise they are just removed once the get close to the surface and its hard to get actual drop location & speed. But even for the active vessel there are at least 3 separate code paths you would have to cover, if i remember it correctly:

- "average" collisions

- "missed" collisions (actual surface collision was missed, but vessel is destructed because of pos below surface)

- splashdown (recording it would be nice; btw, what about splashdown + surface hit due to low water depth?)

Also does there have to be a special part on the crashing vessel that is required record the vessel? Does it have to hit the surface first?

The science part should be more easy, since that system is new and more likely designed in a flexible way, though i didn't yet had an in-depth look into it.

Allowing a satellite in orbit above it with an instrument to measure it would be awesome. Line of sight check could be taken from RemoteTech. Another option would be to have (nearby?) gravity sensors report the impact. Both do not really offer any good way to for the user to "debug" mistakes, though. Maybe with a listing on the sensor ala "last events; did it record? yes=>result-data; no=>reason"...

Link to comment
Share on other sites

I don't think you have to worry about the separate situations unless you want to--you can just use either a coroutine or a KSPAddon class that gets tripped when the part module is destroyed, and is sent the vessel ID.

Won't part.onDestroy get you the same thing? It still has the problem of not telling you what destroyed it. It could be a collision with other parts or overheating for example.

Don't know how to use coroutines or KSPaddon classes... ^_^

Going to need some hand holding through this I'm afraid. If anyone is bored and wants to help me out, PM me and I'll be eternally grateful.

Cheers,

Using KSPAddon is pretty easy. Make a class that extends MonoBehavior and add the KSPAddon attribute above it.

For example:


[KSPAddon(KSPAddon.Startup.Flight, false)] // Launch the addon at the start of every flight
public class MyPlugin
{
public void Start()
{
Debug.Log("Hello from MyPlugin!");
}
}

Edited by pizzaoverhead
Link to comment
Share on other sites

Alright, so finally got it working!

But there is one thing I think I'm doing wrong.

After the probe crashes and I award science by using:

ResearchAndDevelopment.Instance.Science += 500;

Even if I do a Revert flight, I still keep those science points. Is there another way to add science that gets reversed when using revert?

Link to comment
Share on other sites

You dont actually get any real science from the probe that's crashing after it impacts. You get it from something else observing the impact. Maybe you could ad a part that observes impacts? Also if the probe is giving science, its only up until it hits.

Link to comment
Share on other sites

You dont actually get any real science from the probe that's crashing after it impacts. You get it from something else observing the impact. Maybe you could ad a part that observes impacts? Also if the probe is giving science, its only up until it hits.

This is meant to be used with RT2, so you need to have a constant radio contact with the probe. And I'm also going to check out to have a check in place to see if there is a vessel nearby. But first things first. :)

Link to comment
Share on other sites

After careful review of the mission profiles of the early 'impact' probes, it was more about taking readings/pictures/videos leading up to the impact than the impact itself. (Talking about the 1950's) And Luna 2 was more about getting something on the moon, so an accomplishment in of itself.

So I'm assuming only Luna 2 should reward science like this.

Link to comment
Share on other sites

You dont actually get any real science from the probe that's crashing after it impacts. You get it from something else observing the impact. Maybe you could ad a part that observes impacts? Also if the probe is giving science, its only up until it hits.

Yeah, this. The probe usually only provides the metaphorical brick you throw. The science value is in observing your brick hit and seeing the consequences of it. Is the thrown out material light or heavy? Is it spread widely or very locally? Stuff like that.

Edited by Camacha
Link to comment
Share on other sites

That's true of later impacters (like the spent S-IVB stages), but the early stuff like Luna 2 and the Rangers, were all about close-up photography. Only way to _get_ pictures, since soft-landing was much harder (and not achieved until mid 60s).

You are of course right, altough I feel those are maybe not true impact probes in the sense that they were only that for lack of better technology. I think non-soft-landing-probes might be a more accurate description :D Lithobreakage through lithobraking!

Link to comment
Share on other sites

Yup, I agree with the comments. Hence why I guess only Luna 2 should get 'science points' for simply crashing into the moon. The rest I'll use my video/photo module with altitude restrictions, so the science can be awarded via the regular ScienceModule.

Fractal I'm talking with Fractal about how, or if, he's able to have his science lab points reverted or if they are permanent regardless. At least this will be a good lead for the later 'true' impact probes, where the orbiter "observes" the impact to get actual data from it.

:)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...