Jump to content

Variant Limitations Question


klesh

Recommended Posts

I am curious as to the limitations of the variant system.  From what I can tell in the MH expansion, you either have the choice to change the mesh of the part (ex. making engine plate shrouds longer/shorter, removing tank butts from engines etc.) or the color of the part's texture (ex. as seen on the various fuel tanks).   It seems like from what was provided, there are no parts with the option to change both.

Now, were you interested in being able to change both, the execution of that depends on how many variant sliders you can have on the part's action window.  Should you be restricted to one variant slider, you would have to put every combination of size and color within that one variant slider area.  That would be user unfriendly to have to scroll through 27 combinations before you find the one you're looking for.  Should you be allowed more than one variant slider, you could obviously have the mesh choices on one, and the texture choices on another.  This would result in the selectable list of variants being much smaller, and the combinations would be selectable by the player themselves.

I didn't see any part in the expansion that has 2 variant sliders, one for shape/size and the other for texture options.  Do we know if that is possible?  The thinking behind all of this is to give texture options to the engine plate shrouds, so your green/orange themed rockets wouldn't be forced to have white sections in them.

Link to comment
Share on other sites

4 hours ago, klesh said:

I didn't see any part in the expansion that has 2 variant sliders, one for shape/size and the other for texture options.  Do we know if that is possible? 

An interesting question!

Verbose speculation below, but it boils down to:

  • My guess is that it probably is possible to have two independent sliders
  • However, my guess is also that it would be really hard to make those independent sliders adjust things that aren't actually independent, such as having them both target the same mesh.  It's a modeling problem, not a code problem.

My guess is that the limitation would be more in the model than in the game itself.  I'm not at a KSP computer and therefore can't verify this directly, so I'll just give you speculations based on my KSP modding experience thus far:

Variants are accessed using the PAW ("part action window", i.e. the right-click menu for parts).  The way the PAW gets populated with its various buttons and controls is based on PartModules on the part.  Add a PartModule that has associated UI, and it'll add a control to the PAW.  Add two instances of the PartModule, and it'll add two copies of the UI (unless the PartModule author took the trouble to write extra code to spot and handle and prevent that).

ModulePartVariants is just a PartModule.  The fact that you see that variant-selector control for certain parts is because they have a ModulePartVariants on them.  So, I strongly suspect that you can easily get two independent sliders in the PAW just by putting two ModulePartVariants in the part's config.  Easy-peasy, assuming that it works.  (Which, I repeat, I don't actually know, since I haven't actually tried it yet.  But I'm guessing this is how it is, because this is what the path of least resistance would have been-- it would have been extra coding work for them to stop that from happening.)

I suspect that the harder case will be making the model set up in a way that works for this, without setting off some combinatoric explosion in the model.  Depending on the desired behavior of the part, I think some cases would be easy, others would be hard.

Here's an example of what I assume would be an easy case:  Let's say you've got a part that has a "body" and some "trim", with the "trim" being a different set of meshes from the "body".  (For example, the "body" might be the main skin of a fuel tank, say, and the "trim" could be various little greebles attached to it for visual effect.)  Imagine that there's a selection of N different body skins, and there's also a selection of M different trim styles (different greebles in different places).  Well, in a situation like that, the body and trim are completely independent things, so it ought to be fairly easy to have two variant sliders for them.  One ModulePartVariants would switch out the body mesh, a different one would switch out the greebles, so the user gets N*M possible combinations.  Basically exactly what you're asking for.

On the other hand... if the two different things addressed by the slider aren't physically independent, I imagine that it could get ugly.  For example, suppose you wanted to do a thing with engine plates.  An engine plate has several different lengths (short, medium, long, etc.)  Suppose you also wanted to have several different colors (white, green, gray, whatever).  Well... the problem is that the physical shape, and the texture, are both being applied to the same mesh.  Each option on a ModulePartVariants is basically just a set of boolean on/off switches for turning individual meshes on and off.  So I could imagine that it could get very tricky to make that work, because the "which texture do you want" slider wouldn't know anything about what the setting of the "how long do you want it to be" slider's state, and vice versa.

I haven't worked with ModulePartVariants enough yet to figure out if there might be some clever way around that.  But I wouldn't be surprised if it turns out that it would be really, really hard to do what you're describing, for the particular case of one slider choosing a shape, and a different slider choosing the texture of that same shape, since what you're trying to do is to get two completely independent controls to somehow work together on one thing where the effects aren't independent.

  • Independent controls causing independent effects -> easy.
  • Independent controls working together for effects that depend on each other -> hard.

So anyway, that's just my initial speculation.  Like I said, I could be completely wrong about all this.  :)   But in the absence of further information, that's what my default guess would be.  Perhaps someone who knows more about all this could chime in.

@benjee10 was kind enough to provide some insight about ModulePartVariants over in the MissingHistory mod thread... perhaps he might have some advice to offer?

Link to comment
Share on other sites

I am curious if the variants could also change the parameters and/or modules of a part? :/

It seems the mass of the engine is not affected by the variants, which is kinda dumb because the engine has to weigh more with the big shroud (for example)

Link to comment
Share on other sites

7 minutes ago, Snark said:

An interesting question!

 

And a great reply.  Thank you, I don't know the first thing about models and parts and modules in this game, as every time I've considered learning about it (to solve a particular problem) I find someone else has already taken care of it.  You explanation makes sense and help me understand the relationship between the models, meshes, and textures etc.

Link to comment
Share on other sites

I forget how many million (billions?) of variable parts there are in SSTU (model switches, and complete color customization). It's certainly possible in KSP, unsure about the MH setup's possibilities.

Link to comment
Share on other sites

I don't know about multiple modules/sliders on one part, haven't tried that. 

However we do know that the only things ModulePartVariants can modify are mesh, texture and nodes. Unfortunately it seems that resources etc. cannot be affected, which seems like a sad oversight given that AFAIK all of the part-switching mods that exist are able to do this. 

Link to comment
Share on other sites

44 minutes ago, benjee10 said:

I don't know about multiple modules/sliders on one part, haven't tried that.

 

Just gave it a try, it works.  Just copying and pasting the entire ModulePartVariants a second time into the .cfg results in both sliders being able to function the same. So at least that works.

 

ati6Bng.png

 

 

So then I went into a random fuel tank so as to grab the code for texture swapping.  Knowing full well it would look ridiculous, I pasted it in the .cfg as well.  It proceeded to allow me to place the 3 variant textures for the fuel tank over the model of the Mastodon... but its the Mastodon with its shroud included (and the shroud selection button is gone).

 

FtrkeRe.png

 

 

@Snark I suppose this only gets us about halfway-ish, but at least its something. 

 

-Yes, 2 variant sliders can be added to a part.

-Yes, one variant slider can change the model, and the other can change the textures.

 

I guess we're at the "On the other hand" portion of your above post Snark, as I don't know how to look inside these .mu files or models or whatever to find out what is pointing to what.  It seems like its pretty easy to simply define a new path for a new texture, I'll try that next.

 

I'm kind of stuck here as I don't really know how to get inside the files to look at the various paths for textures etc.  Anyway, fun tinkering here.

Edited by klesh
Link to comment
Share on other sites

  • 1 month later...
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...