Simple Food Selection

MOD Desc
Replaces the vanilla food searching algorithm with a better one, but is less heavy and intricate than Smarter Food Selection.

Currently works for humanoids and pets. Special priorities are set for ascetics. Humanoid meat and meals should be eaten normally by cannibals and avoided by others. Others (wild animals) simply fall back to the vanilla food search.

Shouldn’t matter where you load it. Worked fine for me during testing whether it was near the top or at the bottom.

Mod can be safely added and removed without breaking saves.

Source is available here if you would like to suggest changes:
https://github.com/calvin-fisher/RimWorld-SimpleFoodSelection

If you need to use this mod with 1.0 you can download or compile from the last compatible version:
https://github.com/calvin-fisher/RimWorld-SimpleFoodSelection/releases/tag/1.0

———-

[How it works]

This mod intercepts all requests to find the best food (FoodUtility.TryFindBestFoodSourceFor and FoodUtility.BestFoodSourceOnMap) and redirects them to a new, simpler food search algorithm.

Each Pawn is assigned a diet profile based on race, faction, etc. Each Profile defines three tiers of food: Good, Bad, and Desperate. Good food is anything that is totally acceptable for the Pawn to eat and will be chosen whenever the Pawn is hungry. Bad is anything that is mildly undesirable or annoying (raw food for colonists; meals for pets; fertilized eggs) and will only be considered when the Pawn is on the verge of starvation. Desperate is anything that will give severe mood penalties (humans eating corpses) or makes no sense at all (pets eating lavish meals) and will only be eaten when the Pawn is actually starving.

For each food tier, the algorithm iterates through a ranked list of locations. Inventory is first, then the Home area (for colonists), then anywhere. This means that colonists will look for any Good food in the Home area before looking outside. As a result, they will prefer the simple meal in your refrigerator over the chocolate from a cargo pod on the other side of the map, without performing a goodness vs distance calculation for all foods on the map like the vanilla algorithm does.

Individual food types can be ranked higher, lower, or equivalent to each other. For example, the Colonist profile prefers lavish meals over fine meals, but the Pet profile treats insect meat and insect corpses exactly the same and will just pick whichever is closer.

The search respects forbidden items for pawns that care about it (wild pawns will eat your stuff, but tame animals won’t). It also respects any other restrictions, like food restrictions in the Assign tab.

Performance seems to be good, since the algorithm sorts only by distance once and then works under the assumption that most Pawns have a Good food source nearby most of the time. In these cases, it should be faster than vanilla. Most performance issues seem to happen when there are a lot of edible items to scan through (e.g. wildlife unable to raid your base) and when Pawns search repeatedly (e.g. when out of food and starving). Some additional caching or optimization could help with those cases. in the future

Only a few diet Profiles are defined currently. In any case where one is not defined, Pawns will fall back to the original vanilla food search logic.

———-

[Background & Credits]

Based on the original, wonderful, semi-abandoned, and atrociously messy Smarter Food Selection mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=887716138&searchtext=smarter

Why a new mod? I went to try to fix a Combat Extended compatibility issue in the original and walked away hours later still not fully understanding how it all fit together. Seriously, that code has more spaghetti than an Olive Garden. There seem to be hundreds of lines of code just to handle cannibal nutrient paste meals correctly.

But on the other hand, have you tried playing without it? The decisions that vanilla Pawns make about what to eat make no sense whatsoever. Smarter Food Selection is basically required for player sanity.

So I started from scratch, trying to see the minimum amount of intervention required to make Pawns behave sensibly. The result – for now – is a small, non-configurable set of defaults, rather than a bulky customizable system. It is much more compact and manageable; this mod’s dll is a quarter the size of the SFS dll.

This mod uses an adaptation of the Smarter Food Selection mod’s FoodCategory logic, since that system works very well.

Many thanks to WishMaster for making the original Smarter Food Selection, and to Vathand for keeping it running for years.



Summery This game is an incredible exprerence every time, it has the tendency to captivate you into its world while telling a compelling story each time. It is now one of my favorite games to play.

Rimworld provides endless updates for the foreseeable future, giving the game quality and unmatched depth. It requires time commitment but the returns are well worth it.

Details
In one game, a group of charactors were killed consecutively in battle and I teared for there loss, it was one of those moments you blame your own stupidity, agonize over a simple mistake and moan over a lost friend.

This game teaches you how growth is made off of anothers sacrifice, and it does so the hard way.

When playing Rimworld, it’s like the AI knows when to hit you at THE moment your most vurnable.

In MANY offline games that I had, the AI would hit you hardest when you start changing your defencive structure, the AI would wait untill the perfect moment to let someone torch your storage and freezer. The AI would change the weather to match your current mispreperation, or add a toxic fallout to outlast your food supply when a sudden blight took out all your crops.

THIS game is one of those gems that guilds you into a sandbox managemnet game, but ends up beating the hell out of you and it was your own falt (almost) garrented.

I’ve played many games offline with at least 5 small fires that made ruin to my town, at least 2 times a lone surviver died without the ability to heal himself correctly and countless other times when I was overwelmed by countless raids.

The rough and insane difficulty of the valina game is challenging and rewarding for every accomplishment, and unlike many (finished) games out there, this game provided a extremely entertaining end game. I’ve only finished this game twice out of at least twenty starts, once was in rough and once in insane.

Just look at peoples accomplishments and all those souls that were lost in building that masterpeice of architecture.
It makes the creator proud, and this feeling is a reward in itself.

We’re no strangers to love
You know the rules and so do I
A full commitment’s what I’m thinking of
You wouldn’t get this from any other guy

I just wanna tell you how I’m feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

We’ve known each other for so long
Your heart’s been aching, but
You’re too shy to say it
Inside, we both know what’s been going on
We know the game and we’re gonna play it

And if you ask me how I’m feeling
Don’t tell me you’re too blind to see

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

(Ooh, give you up)
(Ooh, give you up)
Never gonna give, never gonna give
(Give you up)
Never gonna give, never gonna give
(Give you up)

We’ve known each other for so long
Your heart’s been aching, but
You’re too shy to say it
Inside, we both know what’s been going on
We know the game and we’re gonna play it

I just wanna tell you how I’m feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Nearly 50 hours in… and I’ve yet to have a successful colony. In fact I don’t think I’ve even had a colony make it past 2 years yet. Let me describe my last attempt.

I was in the borreal forest for the first time (I usually go with just the temperate forest). Since it was my first time picking this biome, I decided to pick a spot with a growing season of 20 days since most boreal forest maps are only 10 days. I was doing really well and had lots of rice and meat stocked up for the upcoming winter. I was about 15 days into the growing season and my corn was going to be ready to harvest by the next day. Then, overnight, I get the event ‘cold snap’. All of my corn dies overnight while my colonists slept. No bid deal, I felt like I still had plenty of food to get me through the winter. Winter comes and I get through it just fine and spring hits. Now, the beginning of spring, it still doesn’t get above 0 celcius so I still couldn’t grow anything and I was starting to run low on food (not desperate yet though). Lucky for me, a herd of caribou waltzes into my map. I send for my hunter to hunt 2 of them as that was going to be all I needed. Now with caribou, you’ve got about a 50/50 chance of them either running when you start hunting, or the entire herd attacking you. I got the latter. My dog April served as a decoy and I got my colonist back close to my turrets and the turrets basically wiped them out, but not before my colonist litterally lost his leg. Oh well, I wasn’t too worried, he is just gonna be a little slow from here on out. Right after this, I get raided and one of them has grenades. I didn’t realize this and so I had my colonists clustered together. 2 grenades and all but one of my colonists can’t walk and are in need of rescue. The turrets finish off the enemies and I start clicking to have my one standing guy rescue the others. Thats when I realize the one standing guy is the guy that just lost his leg. Long story short, he couldn’t move fast enough to save anyone (there was also thick snow on the ground) and eventually collapsed and my entire colony died.

*sigh*

time to try again


Leave a Reply

Your email address will not be published. Required fields are marked *