Snark

[1.8.x] BetterCrewAssignment v1.4: Smarter by default. Remembers your choices. No UI.

Recommended Posts

What it does

  • It makes better automatic default choices for crew assignments (e.g. "labs need scientists" or "drills need engineers").
  • It remembers your assignments, so that the next time you launch that ship, it will try to do the same thing.  (No more discovering, *after* you're in orbit, that your gosh-darn rescue ship filled up all the slots and you've got nowhere to put the stranded kerbal!)
  • You can customize the default behavior with ModuleManager config.
  • NOTE: This mod is not compatible with Kerbal Construction Time.

Download from SpaceDock
License: CC-BY-NC-ND 4.0
Source code

gdOo6e4.png

 

How to install
Unzip into your GameData folder, same as any mod.


How to use
Just play KSP!  The mod is deliberately minimalistic.  It adds no UI, it doesn't require any special actions to use.  It just silently makes the crew-assignment experience better.

The only thing that affects you at all is:  if you go into the "crew" tab of the editor and change crew assignments, then your choices won't be persisted unless you hit the "save" button before launching the ship.  That's it, that's all there is to know.


Cool things it does by default

  • Makes sure there's a pilot on board, if you don't have any SAS-capable probe cores.
  • Staffs science labs with scientists.
  • If you have any non-rerunnable science experiments on board, makes sure there's at least one scientist.
  • If you have any parts that need an engineer (ISRU, drills), makes sure there's at least one engineer.
  • Repairable parts (parachutes, landing legs, wheels) also have an engineer requirement (if there's an available engineer of sufficient level).
  • Tries to pick the highest-level crewmembers available. (Except for pilots; if you have an SAS-capable probe core and your pilots are all lower-level than the core, it picks the *lowest* pilot available.)
  • Tries to fill all command pods; doesn't try to fill passenger cabins.
  • If you do manual assignments in the crew tab and then save the ship, it remembers your choices the next time you load the ship.  Empty slots will be left empty.  It will try to assign specific kerbals by name (e.g. "Jeb goes in slot 0 of this command pod"), and if that crewmember is unavailable, will try to assign another kerbal of the same profession (e.g. "I want Jeb, but he's on a mission already, so I'll use this pilot here.")


How it decides
The mod works with two types of assignments:  default choices, and player choices.

Default choices
Default choices are controlled by ModuleManager config in a file that comes with the mod (see "How to customize", below).  There are two flavors of default choices, *assignments* and *requirements*.

Assignments are default choices for crew slots in specific crewable modules.  The default config that comes with the mod assigns scientists to science labs, and all crewmembers to command pods. The default config deliberately leaves passenger cabins empty, though you can tweak this by adding your own config if you like.

Requirements are added to parts that are not themselves crewable, but which need a particular type of kerbal to operate them.  If your vessel has any parts that specify requirements, then the mod will try to ensure that at least one of the specified kerbal type is present in the crew. The default config that comes with the mod adds a "scientist" requirement to all non-rerunnable science experiments (Mystery Goo, Science Jr.), and an "engineer" requirement to ISRU units and ore drills.

Player choices
When you load a new ship, or add a new part, then everything is controlled by the default behavior and assignments will be updated dynamically as you switch stuff around on your ship. It can do this because you haven't *observed* the assignments and it's therefore free to shuffle assignments around without invalidating any of your choices.

However, the moment you switch to the "crew" tab in the editor and see what the assignments are, it then nails all the assignments in place.  (It's a Heisenbergian sort of thing.)  Basically, what it's doing is assuming that the moment you *see* the assignments, they become your conscious choices rather than something the program assigned.

Once you see the assignments (and make any changes of your own), those get persisted to the ship, and will be saved when you hit the "save" button.  Such specific choices are assumed to be for a specific kerbal, or for a kerbal of that profession if the kerbal isn't available.


How to customize
Since all crew assignments/requirements are controlled by ModuleManager config,  you can add your own .cfg file to change the behavior to whatever you like.

If you'd like to customize the behavior, the following references may be helpful:

  • BetterCrewAssignment.cfg: This is the ModuleManager config that is installed with the mod. It includes detailed comments explaining how it works, so that you can write your own config.
  • ModuleManager documentation:  You can find helpful information here and here.

 

A word of thanks
Many thanks to @sarbian for a small but vital bit of advice that unblocked the completion of this mod.
Thanks to @HebaruSan for the feature suggestion of adding engineer requirements to repairable parts.

 

Edited by Snark
Update to v1.4 (KSP 1.8 compatibility)

Share this post


Link to post
Share on other sites
1 hour ago, aluc24 said:

Great stuff, Snark. Could you please make this mod CKAN available?

It is.  :)

Note the little "CKAN" label next to the mod's name on its KerbalStuff page.

One of the things I love about KerbalStuff is that when you post a mod there, it has a simple little checkbox for "would you like to put it on CKAN?", which of course I'd have to be an idiot not to check.

I don't use CKAN myself, so I don't know the details of exactly how it works.  But I'd guess that if you're looking for it there and not seeing it yet, maybe it takes a little while to propagate through the system.  I just posted the mod an hour or two ago.

Edited by Snark

Share this post


Link to post
Share on other sites

If this works as promised it is yet another one in a long line of tiny mods that deserve/should to be stock.

The real question is however; If an amateur user can write a 37.5 kB mod to fix an ancient issue, why isn't this still not stock?

Share this post


Link to post
Share on other sites
On 12/9/2015, 1:35:28, Tex_NL said:

If this works as promised it is yet another one in a long line of tiny mods that deserve/should to be stock.

The real question is however; If an amateur user can write a 37.5 kB mod to fix an ancient issue, why isn't this still not stock?

Yeah, I occasionally wonder that myself.  :)  The "burn time" indicator is an even sorer point (here's my mod for that one).

On the other hand... this wasn't a one-day fix for me, and there's a fair amount of sophistication under the hood, and I've been a professional software engineer for a very long time.  Squad's a tiny company.  They're operating in a target-rich environment.  There's so much that needs doing that I honestly can't blame them much-- it's not like they're frittering away their time on pointless stuff.

I suppose one could argue that they could implement it way faster than I did, simply because they're not starting from a state of blinkered ignorance of how the internals work.  And that would be true. On the other hand, making it part of the stock game would require far more testing and QA resources than I put on it.

What it all boils down to is:  if it bothers enough people, and there are enough voices about it loud enough for long enough, I expect Squad will get around to addressing it.  :)

 

On 12/9/2015, 4:21:14, jlcarneiro said:

Great idea!

Does it work with mods that interfere with crew assignment like KCT?

I have no idea what "KCT" is, but I would guess that the answer is no.  My mod is pretty much assuming that it has total control over crew assignment in the VAB or SPH.  If there's another mod trying to do the same thing, I expect they're going to end up arm-wrestling over it and hilarity will ensue.

My mod is limited only to the vehicle editor, not the flight scene, so it would have no problem coexisting with a mod that does stuff like moving kerbals around in a "live" ship.

I haven't (yet) made any particular effort to include compatibility patches for various other mods. The most likely scenario would be to add .cfg files to handle parts added by other mods (e.g. "workshops" added by Extraplanetary Launchpads, that sort of thing).  I've designed my mod to be ModuleManager-driven, so adding that sort of config for additional parts is dead simple.

 

Share this post


Link to post
Share on other sites
8 hours ago, Snark said:

I have no idea what "KCT" is, but I would guess that the answer is no.  My mod is pretty much assuming that it has total control over crew assignment in the VAB or SPH.  If there's another mod trying to do the same thing, I expect they're going to end up arm-wrestling over it and hilarity will ensue.

My mod is limited only to the vehicle editor, not the flight scene, so it would have no problem coexisting with a mod that does stuff like moving kerbals around in a "live" ship.

I haven't (yet) made any particular effort to include compatibility patches for various other mods. The most likely scenario would be to add .cfg files to handle parts added by other mods (e.g. "workshops" added by Extraplanetary Launchpads, that sort of thing).  I've designed my mod to be ModuleManager-driven, so adding that sort of config for additional parts is dead simple.

Oops! KCT is Kerbal Construction Time. Sorry, guess I spent too much time in that thread, where using KCT is easier. :)

It simulates building times and when the ships and planes are about to be launched it allows you to select the crew...

Share this post


Link to post
Share on other sites
3 hours ago, jlcarneiro said:

Oops! KCT is Kerbal Construction Time. Sorry, guess I spent too much time in that thread, where using KCT is easier. :)

It simulates building times and when the ships and planes are about to be launched it allows you to select the crew...

Ah, okay.  I've heard of Kerbal Construction Time, just not in circles where it's popular enough to be a commonly known TLA, like KER or KIS / KAS.

I have no idea how it works or is implemented.  Depending on how it's set up, any of the following might be the case:

  1. direct conflict between KCT and BetterCrewAssignment, resulting in weird/buggy behavior
  2. overriding BetterCrewAssignment, so that the latter doesn't hurt anything but doesn't help, either
  3. they work just fine together

I can say that BetterCrewAssignment hooks in only in the following places:

  • when a new part is added to the ship in the editor
  • when entering the crew tab in the editor
  • when leaving the crew tab in the editor
  • continuously at intervals while in the crew tab

If KCT does its hooks specifically and only at launch time, then the odds are better that it may be compatible with BetterCrewAssignment, since BetterCrewAssignment does not hook into anything at launch time.

That's all speculation, though.  If you use KCT, all I can suggest is try it out and see.  :)

 

Share this post


Link to post
Share on other sites

Just Saw this in Monday's blog post, and had to install it! I've long wanted the ability to sort the roster so that pilots would be at the top of the list, with engineers, scientists, and tourists also grouped together. This looks like it does better than that by making sure you get a pilot in your pilot's seat, even if it still leaves the list unsorted. Thanks!

Share this post


Link to post
Share on other sites
2 hours ago, Tfin said:

Just Saw this in Monday's blog post, and had to install it! I've long wanted the ability to sort the roster so that pilots would be at the top of the list, with engineers, scientists, and tourists also grouped together. This looks like it does better than that by making sure you get a pilot in your pilot's seat, even if it still leaves the list unsorted. Thanks!

Whoa, thanks for the heads-up!  I can't believe that I actually made Modding Monday.  (And that this week, of all weeks, I actually missed Monday's post.) :blush:

Edited by Snark

Share this post


Link to post
Share on other sites

Hi,

Nicely worded, your explanation "why this isn't stock (yet)".

I have a question (until I actually get to play with this mod); Would it help me, by default, with rescue rockets that [are supposed to] have an empty capsule where that capsule is *not* the root part, instead the root part is a probe core underneath? By "by default" I mean "rocket was created and saved before mod installation, then loaded for a new rescue mission after installation".

Many thanks.

A.

Edited by Andersenman

Share this post


Link to post
Share on other sites
On 1/18/2016 at 11:20 PM, Andersenman said:

I have a question (until I actually get to play with this mod); Would it help me, by default, with rescue rockets that [are supposed to] have an empty capsule where that capsule is *not* the root part, instead the root part is a probe core underneath? By "by default" I mean "rocket was created and saved before mod installation, then loaded for a new rescue mission after installation".

Alas, no.  Doesn't matter what the root part is.  Without this mod, the game will automatically fill the command pod with a crew member, regardless of whether there's a probe core present, regardless of what the root part is.

Adding to the confusion:  actually, in the stock game, if it's not the root part (for example, you start building from a probe core and then add a command pod), the game doesn't fill the pod, if you have just now built it in the VAB and you're launching it for the first time.  However, if you save the ship, and then some time later you come back to the VAB and load the ship and launch it, the pod will be filled.  This just makes the darn-it-I-forgot-to-leave-an-empty-slot problem a lot worse, IMHO, because it's inconsistent.  The player is more likely to forget the second time because it appeared to work the first time.

<rant>
For me, the fact that the stock game doesn't remember crew assignments is a missing feature, which is no big deal (the game has plenty of missing features, it's unavoidable, and Squad's gradually making it richer with each patch).  However, the fact that it behaves inconsistently as described above is a bug.  I'd love it if the stock game had smarter behavior about crew assignments, but until and unless Squad adds that, I'd like it to at least be consistent.  Being wrong is a merely venial sin; being inconsistent is a mortal one.
</rant>

So basically, there's no way to solve this problem unless you use my mod (or some other mod that does something similar).  The stock game simply doesn't have an answer for it.

Edited by Snark

Share this post


Link to post
Share on other sites

Hi all...

As you may have heard, KerbalStuff has gone permanently off the air.  :(

This makes me very sad, because I've absolutely adored it.

I loved it as a user:  I could browse mods, find the ones I want, etc.  And I loved it as a modder:  I can see the traffic history, I can see how many people are actually downloading my mod, which is a huge thrill.  It gives me an endorphin rush to see that this little thing I made has been downloaded thousands of times.  It gives me motivation to keep on modding.  It's why I've chosen KerbalStuff as the download location for all my mods.

And now KerbalStuff is gone, and I don't have that any more.  It's a tragic loss.

You may not realize that KerbalStuff was a thankless, expensive labor of love by one guy, who ran and maintained the site for years, unpaid, in his spare time.

With heavy heart, I have updated the topic post for BetterCrewAssignment so that it now gives a direct link to github instead of to KerbalStuff (may it rest in peace).  Therefore, you (and anyone else) can continue to download BetterCrewAssignment... it's just that I won't know about it, since I now have no way of seeing how many people have downloaded the thing.

I'll continue to support my mods (and, probably, write new ones).  I'll just have a lot less fun doing it, now that KerbalStuff is gone.

Thank you for your interest in my mod.  And if you enjoyed using KerbalStuff, you might take a moment to go and thank SirCmpwn (sir@cmpwn.com) for what his site has given to this community over the last couple of years.

Edited by Snark

Share this post


Link to post
Share on other sites

Thanks for another great little mod Snark.

Has anyone tried this with KCT? That has its own method of assigning crew (at launch rather than in the VAB).

Share this post


Link to post
Share on other sites

KerbalStuff's replacement, SpaceDock, is now up and running.  (Mostly.  They're still working the kinks out, and it will take a while until all the mod authors have re-uploaded their mods, but it's "up enough" to be able to put mods there.)

I've updated the download link in the OP to point at SpaceDock.

Thanks to the hardworking devs and admins who have gotten SpaceDock up and running so quickly!

Share this post


Link to post
Share on other sites
On 12/8/2015 at 9:54 AM, Snark said:

Player choices
When you load a new ship, or add a new part, then everything is controlled by the default behavior and assignments will be updated dynamically as you switch stuff around on your ship. It can do this because you haven't *observed* the assignments and it's therefore free to shuffle assignments around without invalidating any of your choices.

However, the moment you switch to the "crew" tab in the editor and see what the assignments are, it then nails all the assignments in place.  (It's a Heisenbergian sort of thing.)  Basically, what it's doing is assuming that the moment you *see* the assignments, they become your conscious choices rather than something the program assigned.

Once you see the assignments (and make any changes of your own), those get persisted to the ship, and will be saved when you hit the "save" button.  Such specific choices are assumed to be for a specific kerbal, or for a kerbal of that profession if the kerbal isn't available.

I finally understand why I thought that this mod wasn't functioning either at all, or correctly. I wish I would of read this in the first place! Why is it set this way; I'm assuming it's on purpose?

Share this post


Link to post
Share on other sites
41 minutes ago, KocLobster said:

I finally understand why I thought that this mod wasn't functioning either at all, or correctly. I wish I would of read this in the first place! Why is it set this way; I'm assuming it's on purpose?

Yes.  It's very deliberate.

It's one of those things that's kinda subtle, that you don't even think about until you try it the other way and discover how bad it is.  ;)

The one thing I wanted with this mod, above all, is for it to be unambiguously Better Crew Assignment.  That is, I wanted to make sure that it never does something that might be worse than the stock game experience.  I especially wanted to make sure that it never, ever does a thing that drives me freakin' nuts when I run into it:  software that tries to be helpful, does something I don't want it to do, and I can't make it stop doing that.

If a player goes to the crew tab, and sees who is assigned where, then the player has an idea in mind of what the state of the vessel is.  Imagine that the craft didn't nail things down when you go to that tab.  Suppose you're going to Minmus and really, really want to send Bob.  You go to the crew tab and see that "oh good, it assigned Bob."  Then you leave the crew tab, and are about to launch, but as an afterthought you decide to add on an ore drill.  Imagine if the mod then swapped out Bill for Bob because it decided you needed an engineer to run the drill?  You don't realize it did that, you launch, you get all the way to Minmus before you notice that the wrong kerbal is in the pod and you have no idea what happened.

There's also the complexity that if a player manually assigns a given kerbal to a given slot-- i.e. "I don't care whom the mod wants to put there, I want this Kerbal"-- then the mod really needs to respect that choice, or else cause player rage.  But if we've made that decision... what about a kerbal that you just saw there, and decided "yeah, that's good" and left it?  Does the game decide that that assignment is okay to change, but not the one that you manually put in place?  Okay, so let's say it's a craft with 8 crew slots, and 2 of them you manually installed.  How do you keep mental track of which kerbals are manually assigned and which aren't?  Or even know that it matters?

I played around with this a bit-- not just in my head, but literally played around with it, i.e. tried coding the behavior various ways and then ran it in my game to see how it felt.  And I came to the conclusion that once a player sees anything in the crew tab, the game has to treat that as gospel.  It's not perfect (e.g. it caused you confusion, in this case)... but believe me when I say I tried the alternatives and they were considerably worse.  :)

That's not to say that one couldn't come up with an even better solution if one had a free hand with the UI.  For example, suppose that the crew tab in the UI had some enhancements so that manually, explicitly assigned kerbals appeared normal, and default-assigned ones had some different visual appearance (e.g. grayed out, or semitransparent, or something) to show that they're more "ephemeral", or something like that.  Then maybe it would be okay.  However, I had the limitation that I didn't want to touch any UI in my mod (I'm not even sure if changing those editor buttons would be possible, but even if it is, it would be a lot more work for me, and I only have just so many hours available for modding, this is a spare-time thing for me).

So what I came up with was what I found to be the best compromise, given the constraint of "have no UI whatsoever."

Share this post


Link to post
Share on other sites

Hi all,

I have released v1.1 of BetterCrewAssignment.  This is a compatibility update for KSP v1.1; there are no new features with this release.

  • If you are running KSP 1.1, you must update to this new version; older versions of BetterCrewAssignment won't work on KSP 1.1.
  • If you are running KSP 1.0.5 or older, stick with 1.01; the new 1.1 update of BetterCrewAssignment requires KSP 1.1 or later to run.

Enjoy!

Share this post


Link to post
Share on other sites

Would it be possible to have this sort of thing in flight? where you enter a kerbal anywhere on a vessel and they automatically rearrange the seating so that the best scientists are in the lab, pilots are in cockpits, etc?

Share this post


Link to post
Share on other sites
8 hours ago, passinglurker said:

Would it be possible to have this sort of thing in flight? where you enter a kerbal anywhere on a vessel and they automatically rearrange the seating so that the best scientists are in the lab, pilots are in cockpits, etc?

I don't know of any reason why it wouldn't be possible to write a mod that would do that sort of thing, but it would be a completely different mod from BetterCrewAssignment with a completely different codebase.

Vessels instances in flight are a completely different data structure from vessel designs that exist in the vehicle editor.  Ditto the crew therein.  You're asking for the former, which is not unreasonable, but BetterCrewAssignment is written to work with the latter.

There would also be game-design issues to solve with a "live flight" version that BetterCrewAssignment doesn't have to deal with.

So yeah, neat idea.  :)  But I doubt I'd try to extend BetterCrewAssignment to do that any time soon-- it would be a whole 'nuther mod to write.

If you're looking for a mod to make "moving stuff around in my ship" more flexible, I've heard good things about Ship Manifest:

...however, I've never used it myself and don't know anything about its exact capabilities, so I can't say anything about whether it addresses your exact feature wishlist.

Share this post


Link to post
Share on other sites

Yet another "why haven't I heard of this mod before" experience, courtesy of Snark! This will be going into my post-pre-release 1.1 install for sure. I've clicked the link in your sig to see if I've missed any others.

A few suggestions:

  1. Option to auto-assign an engineer if there are rover wheels, which I will probably need to repair
  2. Option to auto-assign an engineer if there is a parachute, which I might want to repack
  3. Option to use Courage or Stupidity stats as a tiebreaker, all things being equal

I haven't looked at the modulemanager configurability yet; does it allow things like that?

Share this post


Link to post
Share on other sites
2 minutes ago, HebaruSan said:

"why haven't I heard of this mod before"

I guess it's "because you don't follow Modding Monday".  :P

 

4 minutes ago, HebaruSan said:

A few suggestions:

  1. Option to auto-assign an engineer if there are rover wheels, which I will probably need to repair
  2. Option to auto-assign an engineer if there is a parachute, which I might want to repack

Great idea!  :)

Yes, you can add that with ModuleManager config.  Take a look at the BetterCrewAssignment.cfg file that's installed with the mod; I loaded it up with comments to make it easy to understand.

Basically, what you need is a section like "@PART[*]:HAS[@MODULE[SomeModuleYouCareAbout]]" which adds a ModuleCrewRequirement of profession Engineer.  So you'd have one for parachutes, another for wheels-- you just need to go find what the appropriate module name is.

The interesting wrinkle there is that having an engineer for such parts is only useful if the engineer is of the required skill level.  For example, an engineer has to be level-3 to fix rover wheels.  So unless there's a level-3 engineer available, the rover wheel doesn't give you any reason to bring an engineer along.

And right now, BetterCrewAssignment doesn't have any way to specify that.  That's a great idea, and I should update the mod to handle this.  It's pretty clear where the functionality should go-- I should add a "minimum level required" field to ModuleCrewRequirement (which defaults to zero).

That's... just a Really Good Idea.  I should add that feature, and then add it to everything repairable, by default.  Thank you for bringing it to my attention!  :)

In the meantime, until/unless I update the mod, yes, you can add it with ModuleManager config, though you can't add the "minimum level" requirement.

14 minutes ago, HebaruSan said:

3. Option to use Courage or Stupidity stats as a tiebreaker, all things being equal

Longer discussion of this idea below, but the TL;DR is:

  • No, you can't do that with this version of the mod.  It doesn't look at those stats at all, and there's no way to make it do so.
  • In principle, I could add such a feature.
  • However, unless something happens to change my mind, I probably won't add such a feature any time soon.
  • Not because it's a bad idea, but because it would be a non-trivial feature to add, and would benefit only a small target audience.

Details:

I suppose in principle it would be possible to add, but I'd be a bit hesitant (at least, I'd give it a lower priority), for a few reasons:

  • "All things being equal" isn't as frequent as you might think.  When the mod does something like "pick the highest-level engineer", for example, it's actually going by experience rather than level.  So two level-2 engineers are "equal" only if they have exactly the same number of experience points.
  • Those attributes have absolutely zero effect on the stock game.  So adding it would reduce the target audience for such a feature to people who have installed my mod, and are also running another mod that cares about such things (such as Extraplanetary Launchpads).  That number starts to get small enough that I have to consider "return on investment", here (i.e. "how many users do I help" versus "how many hours of my time does it take").  I've gotten a fair amount of traffic for this mod, but it's nowhere near the popularity of, for example, BetterBurnTime, which has many times more users.  If BetterCrewAssignment popularity exploded and I had thousands of people hammering on my door for the feature, then it would be a different matter.
  • It's a non-trivial design problem.  It's certainly doable, and just sitting here thinking a few minutes I already have a pretty good idea how I'd go about adding it, if I were to add it.  But "doing it right" would take quite a bit of code.  The problem is that, unlike experience, these attributes' importance is highly context-dependent (e.g. which  mods do you have, and how do they care about the attributes).  Which means there's no simple one-size-fits-all solution here-- it would have to be a highly-configurable thing where the mod would assign a "weight" based on some numerical formula that would have to be encoded in ModuleManager config, so that it could be appropriately customized depending on which mods are running.

 

Share this post


Link to post
Share on other sites

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.