Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: Stomach capacity, metabolism, and digestion  (Read 4589 times)

Demonic Gophers

  • Bay Watcher
    • View Profile
    • The Tunnels
Stomach capacity, metabolism, and digestion
« on: September 09, 2018, 02:25:51 am »

In the current system, adventurers seem to be able to consume up to four items in one sitting, while citizens in fortress mode generally eat one unit of food at a time.  This is a reasonable approximation for dwarves, elves, and humans.  It gets a little silly with the addition of playable animal people in a wide range of sizes.  Modding can make it truly ridiculous, with a civilized dragon that should snack on whole sheep eating the same meals as a gremlin.  Scaling food intake would be a nice boost to realism, and would also provide a bit of a downside to large size, which plays such a major role in combat ability.  Once predators actually eat their kills in fort mode, their stomach capacity should also determine when they're hunting (and thus likely to attack), and when they're resting (and trying to avoid trouble).

It would probably be simplest to just scale meal size and requirements with creature size.  But there's a better way!  With each body part having a set RELSIZE, and the basic volume of every creature known, the actual volume of the stomach is either already recorded, or simple to calculate.  And food items have a specific weight and material density, so their volume must also be known.  Stomach capacity could be linked directly to the actual properties of the creature's stomach (or stomachs, if a creature has more than one).

A possible token could be STOMACH_CAPACITY:NORMAL:MAXIMUM, where NORMAL and MAXIMUM are percentages of the creature's total relaxed stomach volume - either rounded to the nearest number of food items, or tracked directly.  NORMAL would be the creature's preferred meal size, determining when adventurers get a 'starting to feel full' message and how much citizens would usually eat in fortress mode.  MAXIMUM is the total volume that the stomach can hold, triggering the 'really full' message in adventure mode; extremely hungry citizens should consume close to this amount, if they can.

Wiki reports that the average adult human's stomach can expand to hold about one liter.  The default values for STOMACH_CAPACITY could be based on this, or on the current maximum of four items, for the average human.  Creatures like snakes and ticks might have a much higher stomach capacity, relative to their empty volume.

As a bonus, undigested food could count against carried weight and/or increase the volume of the stomach.  For must creatures, this probably wouldn't make any significant difference, but it might for those with an exceptionally high stomach capacity.  Ticks and their variants are prized for their 'ability to expand' - it would be nice if they actually did expand after a full meal.  And it's a common fantasy scenario to stake out livestock as bait for a dragon, then attack it while the meal is making it relatively slow and clumsy.


Of course, changing meal size doesn't help much without also changing food requirements.  Metabolic rate should scale with total volume, probably including thickness of fat layers; with either strength or muscle mass, as muscle cells use more energy even when resting; and perhaps with the activity level personality trait, to represent a general tendency to move around when idle and so forth.  It should also have a METABOLISM:MULTIPLIER token, taking a percentage of the default metabolic rate, to properly allow for the lower food requirements of cold-blooded creatures, and for animals like shrews and hummingbirds that burn through energy very quickly. Every action and movement should also use up energy, especially gaits that have an energy cost and other actions that tend to cause exertion, such as fighting.  Moving while carrying a heavy burden should also have a higher cost, along with pushing wheelbarrows and mine carts.

Digestion should determine the rate at which food in the stomach is converted into energy.  Of course, most nutrients are actually absorbed in the intestine, but this seems like an unnecessary distinction - I don't think creatures can survive having their guts severed unless they're sustained by magic already, and no one ought to be starving to death in the time it takes food to pass through their stomach and begin being absorbed.  If some sort of nutrition system ever goes in, then exact stomach contents will need to be tracked; without that, it's probably sufficient to track total volume of food and drink.  Digestion rate could be determined direction by metabolism, or have a separate token.  Of course, it needs to be fast enough to easily cover the creature's highest probably level of activity, as well as base metabolic rate.  At the default rate, it should probably empty a normal-RELSIZE stomach within a few hours at most.  Absorption of liquid probably ought to be independent from food digestion, and might have a speed boost when the creature is dehydrated.
Logged
*Digs tunnel under thread.*
I also answer to Gophers and DG.
Quote from: Shades of Gray
*Says something inspiring and quote worthy.*
Opinions are great, they're like onions with pi.

UristMcArmok

  • Bay Watcher
  • [CULL:ELF]
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #1 on: September 09, 2018, 08:43:18 pm »

I like this idea very much, just imagine throwing out your undesirables to be eaten by a hungry dragon, then rushing it with armed troops when it’s fat and lethargic. This would also balance out the Elephant-men adventurers and incentivize more viable character creation
Logged
When in doubt, Succeed from the union.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #2 on: September 10, 2018, 01:47:47 pm »

IIRC, the Recuperation attribute is tied to metabolism, affecting weight gain.
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

voliol

  • Bay Watcher
    • View Profile
    • Website
Re: Stomach capacity, metabolism, and digestio
« Reply #3 on: September 11, 2018, 01:42:48 am »

+1 After reading this I’m surprised it doesn’t already exist in some simpler form.

Regarding hunting and hungry predators, I imagine they would have to have some debuff on their hunger, or they would starve to death like bigger grazers used to do. At the same time having to feed each of your cave dragons two whole pigs a season is clearly fun, so it shouldn’t be overdone.

I guess to prevent them from starving the moment they walk into the fortress map they could spawn fully satiated, you could hand-wave that as them eating off-site, and then leave the map if there’s nothing left to eat. Things they want to eat include your lifestock and dwarves, of course.

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: Stomach capacity, metabolism, and digestion
« Reply #4 on: September 11, 2018, 12:40:26 pm »

This could also go together with giving food different nutritional values, representing the energy that can be extracted from it along with the difficulty in digesting it.  Instead of neatly separating herbivores and carnivores (in reality, very few animals are strictly one or the other, most fall somewhere on a spectrum) material definitions could have a NUTRITIONAL_VALUE and animals could have a NUTRITION_ABSORPTION value.  Meat and fruit have a high nutritional value compared to green leaves, which has a higher nutritional value than grass.  Dedicated herbivores have a higher nutrition absorption rate, allowing them to digest low-value plants.

The base value here would mainly relate to carbohydrates.  There could also be parameters relating to specific nutrients to handle things like obligate carnivores such as cats.

Azerty

  • Bay Watcher
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #5 on: September 11, 2018, 03:27:14 pm »

This could also go together with giving food different nutritional values, representing the energy that can be extracted from it along with the difficulty in digesting it.  Instead of neatly separating herbivores and carnivores (in reality, very few animals are strictly one or the other, most fall somewhere on a spectrum) material definitions could have a NUTRITIONAL_VALUE and animals could have a NUTRITION_ABSORPTION value.  Meat and fruit have a high nutritional value compared to green leaves, which has a higher nutritional value than grass.  Dedicated herbivores have a higher nutrition absorption rate, allowing them to digest low-value plants.

The base value here would mainly relate to carbohydrates.  There could also be parameters relating to specific nutrients to handle things like obligate carnivores such as cats.

We could divide the nutritional input in proteins, glucids and lipids, and check if the input of these match the requirements of the creature.
Logged
"Just tell me about the bits with the forest-defending part, the sociopath part is pretty normal dwarf behavior."

GoblinCookie

  • Bay Watcher
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #6 on: September 13, 2018, 06:56:06 am »

This could also go together with giving food different nutritional values, representing the energy that can be extracted from it along with the difficulty in digesting it.  Instead of neatly separating herbivores and carnivores (in reality, very few animals are strictly one or the other, most fall somewhere on a spectrum) material definitions could have a NUTRITIONAL_VALUE and animals could have a NUTRITION_ABSORPTION value.  Meat and fruit have a high nutritional value compared to green leaves, which has a higher nutritional value than grass.  Dedicated herbivores have a higher nutrition absorption rate, allowing them to digest low-value plants.

The base value here would mainly relate to carbohydrates.  There could also be parameters relating to specific nutrients to handle things like obligate carnivores such as cats.

We can handle that by having different creatures have different nutrient absorption rates for different types of food.

The cat gets next-to-no absorption of nutrients from eating vegetables, while the herbivore gets a greater amount of nutrients as a %.

The unabsorbed nutrients really ought to be pooped out of the other end in either case and be usable for fertiliser.  That way we can handle the whole ecology through simply numbers, without having to magically create nutrients. 
Logged

Strik3r

  • Bay Watcher
  • Persistently work-in-progress.
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #7 on: September 15, 2018, 07:46:19 am »

Before i made my account on this forum, a feature like this was something i wanted to suggest, but i guess someone beat me to the punch.

My original idea was a bit simpler than tracking stomach capacities and nutrients, in the form of a single creature token; [METABOLIC_RATE:X] where X is a number that determines the creature's food requirements, with 1000 being the default and matching the food requirements of an average adult human.

Of course this rate could be modulated by the game internally and on a per-creature basis. But this is just my idea.

I do think however, that the idea of tracking stomach capacity would be cool. Maybe even tracking the stomach's contents, so it acts like a inventory or container that digests any food items placed into it over time. it could even allow swallowing inedible objects in adventurer mode and being able to get them back.
This could also go together with giving food different nutritional values, representing the energy that can be extracted from it along with the difficulty in digesting it.  Instead of neatly separating herbivores and carnivores (in reality, very few animals are strictly one or the other, most fall somewhere on a spectrum) material definitions could have a NUTRITIONAL_VALUE and animals could have a NUTRITION_ABSORPTION value.  Meat and fruit have a high nutritional value compared to green leaves, which has a higher nutritional value than grass.  Dedicated herbivores have a higher nutrition absorption rate, allowing them to digest low-value plants.

The base value here would mainly relate to carbohydrates.  There could also be parameters relating to specific nutrients to handle things like obligate carnivores such as cats.

We can handle that by having different creatures have different nutrient absorption rates for different types of food.

The cat gets next-to-no absorption of nutrients from eating vegetables, while the herbivore gets a greater amount of nutrients as a %.

The unabsorbed nutrients really ought to be pooped out of the other end in either case and be usable for fertiliser.  That way we can handle the whole ecology through simply numbers, without having to magically create nutrients. 
However, we shouldn't go too crazy tracking individual nutrients and vitamins and whatever as there are performance and gameplay concerns; it would be even more data tacked onto every single creature on the map that the game has to track. And it would be pain in the ass to micromanage the proper nutrient intake for just one adventurer, pure hell trying to do so for a 100+ dwarves(and don't count on them doing it themselves, either), though i can see the argument for increased detail in biological systems.
In regards to the "fertilizer" part: Toady has a hell of a habit of avoiding the issue of creatures' biological functions, which is why i fear that it might take a really long time for related systems(including the topic of this thread) to see any improvement.
Logged
NOTICE: If you can't update your profile/signature, stop using a Imgur URL for your profile picture.
Upload it to somewhere else.

GoblinCookie

  • Bay Watcher
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #8 on: September 15, 2018, 10:49:00 am »

However, we shouldn't go too crazy tracking individual nutrients and vitamins and whatever as there are performance and gameplay concerns; it would be even more data tacked onto every single creature on the map that the game has to track. And it would be pain in the ass to micromanage the proper nutrient intake for just one adventurer, pure hell trying to do so for a 100+ dwarves(and don't count on them doing it themselves, either), though i can see the argument for increased detail in biological systems.
In regards to the "fertilizer" part: Toady has a hell of a habit of avoiding the issue of creatures' biological functions, which is why i fear that it might take a really long time for related systems(including the topic of this thread) to see any improvement.

It's really just static numbers sitting there for the most part.  It might be easier just to move the numbers around than have to have new numbers recalculated all the time. 
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #9 on: September 16, 2018, 07:28:36 am »

Not really static numbers sitting there so much as various numbers moving around, but yes, it's not actually too much of a problem. I think people severely overestimate how much time it takes to adjust a variable every tick. This stuff's O(n), peeps, it's going to be something like 100 microseconds per tick as a ludicrously conservative fermi estimate in the very worst case (15 nanoseconds per unit, 500 units in a gigantic fort). For reference, this would mean that it would slow from 1000 FPS to... 999.9 FPS.
« Last Edit: September 16, 2018, 07:31:37 am by Putnam »
Logged

Dorsidwarf

  • Bay Watcher
  • [INTERSTELLAR]
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #10 on: September 16, 2018, 07:46:44 am »

I do agree that trying to micromanage food intake for a hundred plus dwarves is likely to be excruciatingly painful without a serious overhaul to how we are able manage the consumption of food by our dwarves, but I like the idea of overhauling food so that we can just feed the dwarves minced fat forever any more and hope it gets added once the tools to use it sanely are available
Logged
Quote from: Rodney Ootkins
Everything is going to be alright

Strik3r

  • Bay Watcher
  • Persistently work-in-progress.
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #11 on: September 16, 2018, 09:37:38 am »

Not really static numbers sitting there so much as various numbers moving around, but yes, it's not actually too much of a problem. I think people severely overestimate how much time it takes to adjust a variable every tick. This stuff's O(n), peeps, it's going to be something like 100 microseconds per tick as a ludicrously conservative fermi estimate in the very worst case (15 nanoseconds per unit, 500 units in a gigantic fort). For reference, this would mean that it would slow from 1000 FPS to... 999.9 FPS.

Sure, for any other game, this would be true. However, Dwarf Fortress already tracks a lot of variables per creature, multiplied by the amount of dwarves/creatures on fortress map updated every single tick, on a single thread. Maybe adding dietary information to that list isn't going to impact FPS all that much, but when it's a few variables for this feature, another few for that one and a few more for another feature, it's gonna add up fast. Late-game FPS in fortress mode is already total garbage so its best to avoid more potential lag whenever possible.

I do agree that trying to micromanage food intake for a hundred plus dwarves is likely to be excruciatingly painful without a serious overhaul to how we are able manage the consumption of food by our dwarves, but I like the idea of overhauling food so that we can just feed the dwarves minced fat forever any more and hope it gets added once the tools to use it sanely are available

I more like the idea that we can feed dwarves with only minced fat, and they're not gonna starve but its not the best way to feed them. Not in the nutritional sense nor in the food variety sense.
Other than that I'm total agreement with you.

So, I'm in support of adding some kind of nutrition data to various materials, but having those values only determine how much food items made of those materials satisfy the need for food. With the possibility of food items of some materials being better for some creatures than others.

Anyway, the discussion of nutritional values of different types of food and of creatures' dietary habits is not really the focus of this topic/suggestion, which is better handling of eaten food and how much of it creatures actually need. Which i think should be done by having the stomach behave as a special container whose capacity is determined by the actual size of the organ and which digests/breaks down any edible items in it at a rate set via METABOLIC_RATE or w/e creature token, modulated by the game according to various criteria.
Logged
NOTICE: If you can't update your profile/signature, stop using a Imgur URL for your profile picture.
Upload it to somewhere else.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #12 on: September 16, 2018, 06:21:29 pm »

Not really static numbers sitting there so much as various numbers moving around, but yes, it's not actually too much of a problem. I think people severely overestimate how much time it takes to adjust a variable every tick. This stuff's O(n), peeps, it's going to be something like 100 microseconds per tick as a ludicrously conservative fermi estimate in the very worst case (15 nanoseconds per unit, 500 units in a gigantic fort). For reference, this would mean that it would slow from 1000 FPS to... 999.9 FPS.

Sure, for any other game, this would be true. However, Dwarf Fortress already tracks a lot of variables per creature, multiplied by the amount of dwarves/creatures on fortress map updated every single tick, on a single thread.

For the record, my estimate doesn't change if the game's on 100 threads. It's based entirely on worst-case RAM latency, which is the real FPS killer, not just in this but in games like Factorio, whose developers are incredibly tech savvy.

UristMcVampire

  • Bay Watcher
  • [NOT_LIVING][BLOODSUCKER]
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #13 on: September 16, 2018, 08:10:23 pm »

+1.
I would give +100000000000000000 but I'm only allowed to give 1.
Logged
GENERATION 10: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.


 Naga/Lamia race

Strik3r

  • Bay Watcher
  • Persistently work-in-progress.
    • View Profile
Re: Stomach capacity, metabolism, and digestion
« Reply #14 on: September 16, 2018, 11:30:16 pm »

Sure, for any other game, this would be true. However, Dwarf Fortress already tracks a lot of variables per creature, multiplied by the amount of dwarves/creatures on fortress map updated every single tick, on a single thread.

For the record, my estimate doesn't change if the game's on 100 threads. It's based entirely on worst-case RAM latency, which is the real FPS killer, not just in this but in games like Factorio, whose developers are incredibly tech savvy.

Well, i guess i'll have to admit that you've got me beat. I mean I've done a lttle bit of programming but RAM latency isn't something a dabbling programmer comes in contact with.
This is getting a bit off-topic but im curious now; why is RAM latency the main cause of slowdown on games like this?
Either way, piling up more and more things for the game to track is still gonna have an adverse effect on FPS.
Besides, no matter how minuscule the effect on FPS, it isn't an excuse for adding excessive amounts pointless stats for the player to micromanage.
Logged
NOTICE: If you can't update your profile/signature, stop using a Imgur URL for your profile picture.
Upload it to somewhere else.

Pages: [1] 2 3