RimWorld

RimWorld

35 ratings
Simple Food Selection
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.3
File Size
Posted
Updated
335.116 KB
26 Jul, 2019 @ 8:24pm
19 Oct, 2021 @ 12:27pm
11 Change Notes ( view )

Subscribe to download
Simple Food Selection

Description
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://steamhost.cn/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.
59 Comments
LamHK 10 May, 2022 @ 5:51am 
This seems not compatible with Hospitality
Turambar 2 Jan, 2022 @ 4:58am 
Very promising mod! Does it work with Variety Matters Improved?
Narlindir 12 Nov, 2021 @ 3:08pm 
@Lurmey "animal logic", "animal control" and or "Assign Animal Food" are probaly a better choice for that

this mod has huge potential but is buggy for me
Lurmey 12 Nov, 2021 @ 7:34am 
Will this stop my dog from preferring to hunt caribou over eating the kibble I have easily accessible to him??
Narlindir 7 Nov, 2021 @ 11:16am 
My animals keep eating food until its empty
full need bar
(If you need an error log or my mod list let me know)
AndHobbes  [author] 19 Oct, 2021 @ 11:18am 
Updated for v1.3 but I don't have time to do much playtesting. If anyone has any fixes, it's easiest if you fork via github and submit a pull request: https://github.com/calvin-fisher/RimWorld-SimpleFoodSelection/pulls
The Bard of Hearts 3 Jun, 2021 @ 1:59am 
An update to 1.2 would be awesome. maybe @Mlie will be our hero once again. :d5_prinny:
Draco Sicarius 2 Mar, 2021 @ 2:30pm 
Is this not compatible with Hospitality? Guests don't seem to be eating very often, but the Hospitality author says it isn't from their side.
Draco Sicarius 26 Jan, 2021 @ 1:11pm 
I know I'm late to the party, but 1.2 update?