simplyWiri / Loadout-Compositing

GNU Lesser General Public License v3.0
12 stars 8 forks source link

One per tag minus other tags #45

Closed sdfg2 closed 2 years ago

sdfg2 commented 2 years ago

I've got a group of soldiers. I'd like to set default weapon as assault rifle, say, and then have another priority tag for applying snipers and heavy weapons and so on. Obviously, that means I don't need as many assault rifles! Would it be possible to add a bill type that is "One per tag X minus tags Y"?

simplyWiri commented 2 years ago

This kind of falls under my comments here #46 . I think the actual issue here is that it isn't convienient enough to have more granular tags.

In my head, the general loadout for a pawn is:

Tools (IA)
Weapon (IA)
Secondary Weapon (IA)
Work-specific clothing
Armour
sdfg2 commented 2 years ago

Yeah but that's only one way of looking at composing something. The power of your mod over any others is exactly what you mention, composition, but there are different ways of composing things, especially as you've added a priority mechanism. With the tools you've given use, composition can work this way as well:

General Colonist (Minimal base gear, i.e. devilstrand duster, shirt and pants)
Specialized Colonist (Soldier base gear, i.e. recon armour (replaces duster) and charge rifle)
Specialized Soldier (Sniper base gear, marine armour (replaces recon armour) and sniper rifle (replaces charge rifle)

So that's a deep approach as opposed to what you have in your head which is a breadth approach.

It seems to me that you've already got a system in place for figuring out exactly what each pawn should have if everything is available to them with the slot loadout viewer you have (which is an utter godsend, specific props for having that, it makes finding gaps so much easier, thankyouverymuch <3 ). i.e. if someone is a General Colonist, Solder, and Sniper, it will show marine armour, sniper rifle, shirt and pants. So maybe as well as having 'X per tag', iterate though all colonists and enumerate how much of everything the colony needs for that final loadout only and use that for bills? It shouldn't be too expensive, it only needs to be run whenever a tag is changed or a tag is applied/removed from a pawn?

(It's been over a decade since I last did any C# development, but I can help with algorithms).

Edit: Just read #47 and I think this might provide a solution for those problems?

simplyWiri commented 2 years ago

It seems to me that you've already got a system in place for figuring out exactly what each pawn should have if everything is available to them

Unfortunately not, this is a pretty difficult problem with the current vanilla system, re-inforced by how awkward the vanilla implementation is. I.e. the distinction of how clothes clash, based on both layering and slots covered.

The vanilla algorithm for apparel optimisation is basically a greedy heuristic, and my modification of this is an exponential weighting based on the priority of the tag within the loadout.

Don't get me wrong - I am not happy with the current state it is in, I have just not had a eureka moment as to how I could design a system such that there is a ubiquitous / consistent 'solution' which a loadout should always resolve to. If/When I do however, it will mean I can knock out #19, and implement what you are mentioning above, which is something i would definitely like to do.