Concept for a Colonist Scoring Mod - Need Tips/Help on the Coding End

Started by WindyWriter, April 03, 2019, 03:39:56 PM

Previous topic - Next topic

WindyWriter

So something I've been doing with my colonists for quite some time is manually scoring them based off of their skills, traits, etc. I've tossed around the idea of making a mod using the concept but have had difficulties thinking how I would go about doing such a thing as I have very little coding or modding experience - but from my understanding shouldn't be terribly hard to pull off and should allow for some simple user modification as well. The mod would not need very much UI, only as much as any other generic tab mod if I were to imagine or less possibly.

If you were to have any tips or would be willing to help out with such a concept I'd love to get into contact about it! Contacting me, I could go into a little more detail about what I have in mind and maybe make any of this understandable, but for now I'll leave the gist of the "algorithm" and an example below. Pardon if it makes no sense, I suppose this is all very...ehhhhh...specific. I've attached a screenshot of my manual page to maybe give a glimpse of a better idea on how I do it.

The "algorithm" is fairly simple I would say. To start, it adds together all their skill points, multiplying each by a multiplier dictated by user preference. So, for example, I think Crafting is a very important skill - so I would multiply points in this skill by 2. This full number I refer to as the Skill Score After this is the Work Score or Passion Score; I get this number by taking the previous multipliers and multiplying that number based on a pawn's passion towards that skill while subtracting a flat number if they're incapable of that skill. For example, if a pawn had a double-passion in my Crafting skill, that passion would give 10 points since I multiply double-passion by 5 but if they're incapable of Social, that'd subtract 10. Next is the Trait Score which very simply adds all the scores of the individual traits a pawn has; for example - Industrious could give a +20 since it's a really good trait while Wimp could give a -40 since it's pretty detrimental. This one is highly dependent upon a player's judgement of each skill - though I would imagine alot of people would be applying a -1000 multiplier to Pyromaniac. Either way, last is the Health Score which simply scores colonists based on how healthy they are. This score will generally be 0 or lower, but can go positive thanks to things like Bionics and Implants or simply by just being young since they're less susceptible to aging defects. This tallies out to their Total Score which could be displayed on their name-slate or be compared with other pawns in a work tab.

TL;DR HERE'S THE "ALGORITHM"
[PAWN SCORE] = ([SKILLS]*[SKILL MULTIPLIERS])+(([SKILL MULTIPLIERS]*[PASSION MULTIPLIERS])-[INCAPABILITIES])+[TRAITS]+[HEALTH]

So to show off my "algorithm" for scoring my colonists I'll use my current favorite colonist, Rose, while using my applied scores and multipliers.
Following default order, her skills are: 7, 2, 14, 2, 6, 9, 0, 3, 2, 5, 3, 6. The multipliers are: 1.5, .5, 1.5, 1.5, 1.5, 1.25, .75, 2, 1, 1.75, 1, 1.
This means that Rose's Skill Score is 81.5.
Rose has no incapabilities and has minor passion in Shooting[1.5], Construction[1.5], Mining[1.5], Cooking[1.5], Plants[1.25], and Social[1]. I give minor passion and x2 multiplier when calculation work, so Rose's Work Score is 16.5.
She has only a few traits; Jogger, Master Medic, Nyctophobe, and Very Neurotic - 2 Good and 2 Bad by my standards. In order, I give those traits a +10, +30, -5, -7.5. This gives Rose a Trait Score of 27.5.
And lastly, Rose is in tip-top shape. She is in her late 20's [a +20 mod] but has no bionics to add any more to her score. This gives her a Health Score of 20.
All these things together means that Rose's Pawn Score is 145.5.

Now this number is ultimately arbitrary, but helps me dictate how good she is in relation to other colonists and pawns. For example, my Janitor Stan has a score that would otherwise soar into the 180s but his Health Score is a painful -145 due to various defects in conjunction with his extreme age. It also proves helpful in deciding if a raider would make a good recruit before patching them up. For example, Olathe - one of my current prisoners - has a Pawn Score of ~115 which puts her below champs like Rose, but still strongly places her ahead of my colony average of 93 which I think makes her reasonable enough to go through the effort of recruiting.

Anyway, rambling over. This is mostly something I'd like to pursue as a concept to improve other's gameplay while also saving me a bit of time by not having to do all this math manually. If anyone would have an idea on how to pull this off - please feel free to get in touch with me! I can be reached quickly on Discord via WindyWriter#0690 but should respond timely here as well. Thank you for taking the time to read and considering!

[attachment deleted due to age]

Mehni

Quote from: WindyWriter on April 03, 2019, 03:39:56 PM
The mod would not need very much UI, only as much as any other generic tab mod if I were to imagine or less possibly.

Start there then. Look at Numbers, look at Medical Tab, look at Work Tab.

Making this "mod" is fairly simple I would say. You'll need:
- A way to open the table. This is commonly done with a MainButtonDef, so you have a button to click. That button will then need to be linked to a C# class. The example I linked references <tabWindowClass>Numbers.MainTabWindow_Numbers</tabWindowClass>, which will open a MainTabWindow_PawnTable. Now, the one for Numbers is absolutely massive and 99% of the code in there will be unnecessary for you. The most important thing is that you override the PawnTableDef to point to yours.
- So back to XML. Numbers has a bunch of PawnTableDefs, but all they really are is a list of columns.
- Those columns are PawnColumnDefs. Numbers has a bunch of these as well, but they're pretty simple. They are used to point to a C# class; like so: <workerClass>Numbers.PawnColumnWorker_Bleedrate</workerClass>.
- And that's it!

Good luck. Since you like discord; there's a mod-dev channel on https://discord.gg/RimWorld which can help you along if you get stuck with your code.

P.S. ideas are cheap, don't expect anyone to do this mod for you. You're going have to do it yourself.

togfox

I would start with looking at the numbers mod and then try adding a column to that. Start with hard coded weightings and then work up from there.

WindyWriter

Thank you both. It's a starting point for me to work from. I'm sure I can get a foothold from here also thank you for the Server recommendation.

eddieballgame

Just noticed this post & I am intrigued.
I have been thinking about some way to implement a 'performance rating' per one's colony.
I see many posts where folks really enjoy the early parts of setting up a colony but then tend to lose interest as the colony continues to grow & survive.
Thus, maybe having a mod that takes this into account could be most welcomed.
The idea is to rank one's colony per its'...viability, successes, size, etc.
Playing to a certain number of years & attaining a good score doing so could be a type of challenge that could be fun via competition vs others.

LeatherCat


eddieballgame

Quote from: LeatherCat on December 12, 2019, 09:25:51 AM
There is already kind of score in pawn price attribute.

Not sure what you are referencing, but there are some 'graphs' in the History section.

LWM


LeatherCat

You can see pawn price at Numbers mod. This number includes pawn stats, current health state, body parts installed price. But Ratings described in this topic are much more better. I like it!