PapaJoesSoup / BDArmory

Gun turrets and other weapon systems for KSP
113 stars 57 forks source link

Cluster Munitions Overhaul #313

Open SquaredRoot opened 7 years ago

SquaredRoot commented 7 years ago
ISSUE TYPE

While on the topic of overhauling things, cluster munitions could use a redo. Having worked with BDA's cluster weaponry before, it's not super well documented and also a bit confusing, and it leaves some features to be desired.

Here's a concept:

Enhanced Features:

1) Documentation-- this is crucial. While the player probably won't see this part, from what I've seen many modders find BDA's cluster munitions confusing to write. 2) A more tweakable system: Perhaps no longer requiring the submunitions to be part of the model, though this isn't as important as the documentation.

New Features:

1) Guided Submunitions: Allow submunitions to have their own propulsion or at least their own guidance, and act as a weapon in their own right. 2) Independently Targetable Submunitions: An expansion of the above, this would allow one weapon to take multiple targets using independent submunitions. <<Moved to #316

All in all, keep up the good work. I'm loving what I'm seeing in regards to the stealth expansion, by the way! --njmksr

SquaredRoot commented 7 years ago

I'm trying to kludge together a basic version of guided submunitions myself, I'll keep you all posted.

SquaredRoot commented 7 years ago

I probably messed a ton of stuff up, but an attempt was made: https://github.com/SquaredRoot/BDArmory/blob/master/BDArmory/Parts/ClusterBombGuidedSubs.cs

demonfiren commented 7 years ago

Is independent targeting even possible with the current system? I don't know about radar, but I'm fairly certain infrared, laser and GPS don't allow it.

SquaredRoot commented 7 years ago

I don't think so, but the way I'd do it is have them each act as separate munitions, which would use the code from the missiles that lock after firing to seek out any targets on their own.

jrodrigv commented 7 years ago

@SquaredRoot thanks for your request.

Regarding the attached code. Did you tested it?

SquaredRoot commented 7 years ago

@jrodrigv Not quite yet, I wanted to see if you could notice anything as immediately wrong.

demonfiren commented 7 years ago

@SquaredRoot Wait, we have lock-on after launch capability now? Man, I missed a lot.

SquaredRoot commented 7 years ago

@demonfiren I believe so. The code you'd need to do it would be weird but you could probably hack the two together.

SquaredRoot commented 7 years ago

@demonfiren Yep, LOAL is implemented in the code, just checked

edit: Actually, @jrodrigv wrote it!

jrodrigv commented 7 years ago

Hi @SquaredRoot !

I have been looking at your code:

So, after thinking a bit. Maybe you can try to control all the submunitions rigidbodies at the same time from the FixedUpdate step of the ClusterBomb part module. And you will need to re-implement a specific AirToGround guidance method for rigidbodies and a specific DoAero for rigidbody submunition.


Now, a different request from this one. Could it be to allow to fire missiles from a missile :)

SquaredRoot commented 7 years ago

@jrodrigv

I assume some experience with VStudio etc. So I guess this would not be an impediment for you.

Nah, I've just worked with Java before and it's pretty similar syntax, so it's not a huge leap.

Finally, regarding the code. I think that it would not be possible to try to use the current missiles logic to guide the subminitions (at least not as it is). The reason is because a sub-munition is not a vessel or a part but just a Rigidbody. And all missiles are considered vessels once they are fired.

So, after thinking a bit. Maybe you can try to control all the submunitions rigidbodies at the same time from the FixedUpdate step of the ClusterBomb part module. And you will need to re-implement a specific AirToGround guidance method for rigidbodies and a specific DoAero for rigidbody submunition.

I was thinking about that, and I arrived at the conclusion that it was probably best to actually overhaul how cluster munitions work; rather than assigning the fairing and submunitions as Rigidbodies, making the fairing a MissileLauncher and having it launch a bunch of missiles (the submunitions).

This is a pretty big undertaking, I understand if this isn't your biggest priority. I'd like to possibly have a go at it if I could, though.

The way you would make this work in a model is keeping the fairing system as is, but having the submunition be a separate model. The fairing model would have any submunitions replaced with empty GameObjects, which would be the points where the submunitions would launch from. This system would possibly use a different cfg for the submunition (though maybe not) and allow much greater flexibility for modders, as well as the ability to reuse assets for the submunitions. The biggest problem I see with this could be resource utilization-- it could cause some lots of lag.

EDIT:

Now, a different request from this one. Could it be to allow to fire missiles from a missile :)

Basically, yeah.

I'm pretty new to this, but that's just my two cents.

jrodrigv commented 7 years ago

@SquaredRoot I'm thinking then to create a new issue as a feature request to Allow to attach and fire missiles from missiles.

That would be more generic than this one and it would cover a wider range of use cases.

Do you agree?

SquaredRoot commented 7 years ago

@jrodrigv Absolutely. I'd love to help with this too, if I at all can; I'm trying to make a comeback with BDAc expansion making so I'd like to lend a hand in the plugin that makes it work!

SquaredRoot commented 7 years ago

@jrodrigv should I close this issue? The documentation part is something I still think needs to happen.