Is there an upper limit to character weight?

Just curious. Is there a limit to how phat the character can become? Assuming that I bunker down and have practically unlimited food and water available (and spellbooks to spend the time without technically wasting it).

clarification: I understand that char weight is stored in some kind of int value so it naturally would have an implicit limit, I’m asking if there’s an explicit limit set somewhere in the code.

1 Like

Unless that changed, there isn’t a hard limit.
However, at some point you’re burning the fat faster than you can gain it, so there’s technically a limit to it before you’re reaching the MAX_INT value.

Somewhere around 1470kg with a default character - that’s the point at which your stored calories overflow.
The max kcal and final weight are from before it overflowed, so here’s the info I got.

Before overflow:
  Starting weight: 76.56 kg
  Weariness: 27 Max Full Exert: EXTRA_EXERCISE Mult: 1
  BMR: 15626 Intake: 27398 Tracker: 54 Thresh: 4352 At: 0
  Cal: 2133529/55000 Fatigue: -1000 Morale: -108 Wgt: 1465397 (BMI 478.5)
  Max kcal: 2133133
  Final weight: 1465.13 kg
After overflow:
  Starting weight: 76.56 kg
  Weariness: 26 Max Full Exert: NO_EXERCISE Mult: 0.1
  BMR: -12919 Intake: 27245 Tracker: 52 Thresh: -1291 At: 1663426
  Cal: -2138707/55000 Fatigue: -1000 Morale: -108 Wgt: -1389232 (BMI -453.6)
  Max kcal: 2147363
  Final weight: 1474.64 kg

Here’s my test case.
It’s a little pathological with eating a chunk of tallow every 15 minutes without sleep and doing nothing else, so there may be a lower limit - I’m willing to add in some smarter stuff if anyone has suggestions.
Adding 8 hours of sleep (simply a if( turn > 16_hours ) { continue; }) just delays how long it takes to get there (83 to 132 days).

diff --git a/tests/char_biometrics_test.cpp b/tests/char_biometrics_test.cpp
index 8d222d3fb3..4d9f7213ff 100644
--- a/tests/char_biometrics_test.cpp
+++ b/tests/char_biometrics_test.cpp
@@ -14,6 +14,8 @@
 #include "string_formatter.h"
 #include "type_id.h"
 #include "units.h"
+#include "units_utility.h"
+#include "options_helpers.h"

 // Return the `kcal_ratio` needed to reach the given `bmi`
 //   BMI = 13 + (12 * kcal_ratio)
@@ -716,3 +718,41 @@ TEST_CASE( "body mass effect on speed", "[bmi][speed]" )
     CHECK( kcal_speed_penalty_at_bmi( dummy, 42.0f ) == 0 );
 }

+TEST_CASE( "fatty", "[biometrics][metabolism][bmr]" )
+{
+    override_option opt( "USE_METRIC_WEIGHTS", "kg" );
+    avatar &guy = get_avatar();
+    clear_avatar();
+
+    REQUIRE( guy.get_stored_kcal() == 55'000 );
+
+    INFO( string_format( "Starting weight: %.2f %s", convert_weight( guy.get_weight() ),
+                         weight_units() ) );
+    for( int day = 0; day < 365; ++day ) {
+        printf( "%d : %d kcal\n", day, guy.get_stored_kcal() );
+        int old_kcal = guy.get_stored_kcal();
+        int max_kcal = guy.get_stored_kcal();
+        for( time_duration turn = 0_seconds; turn < 24_hours; turn += 1_seconds ) {
+            max_kcal = std::max( max_kcal, guy.get_stored_kcal() );
+            calendar::turn += 1_turns;
+            guy.update_body();
+            if( turn % 15_minutes == 0_turns ) {
+                item meal( itype_id( "tallow" ) );
+                guy.consume( meal );
+            }
+            if( turn % 40_minutes == 0_turns ) {
+                item drink( itype_id( "water_clean" ) );
+                guy.consume( drink );
+            }
+        }
+        INFO( guy.debug_weary_info() );
+        INFO( string_format( "Max kcal: %d", max_kcal ) );
+        int kcal_before = guy.get_stored_kcal();
+        guy.set_stored_kcal( max_kcal );
+        INFO( string_format( "Final weight: %.2f %s", convert_weight( guy.get_weight() ),
+                             weight_units() ) );
+        guy.set_stored_kcal( kcal_before );
+        INFO( string_format( "Day %d", day ) );
+        CHECK( guy.get_stored_kcal() > old_kcal );
+    }
+}
4 Likes

Imagine having such a prodigious girth that reality starts to implode around your form and you suddenly have negative weight, only to fly up into the air - never to be seen again.

3 Likes

Actually, without any stored calories (or negative values), you die instantaneously.
So… I guess it’s more that you’re so overfed that you just exploded :grinning: .

4 Likes

My test character would like to disagree:

11:05:00PM: You have starved to death.
11:10:00PM: You have starved to death.
11:15:00PM: You have starved to death.
11:15:01PM: You eat your tallow (fresh).
11:15:02PM: You feel quite full, and a bit sluggish.
11:20:00PM: You have starved to death.
11:25:00PM: You have starved to death.
11:30:00PM: You have starved to death.
11:30:01PM: You eat your tallow (fresh).
11:30:02PM: You feel quite full, and a bit sluggish.
11:35:00PM: You have starved to death.
11:40:00PM: You have starved to death.
11:45:00PM: You have starved to death.
11:50:00PM: You have starved to death.
11:55:00PM: You have starved to death.
12:00:00AM: You have starved to death.
1 Like

Weird. Last time I’ve had an overflow it killed me on the spot, even ignoring the invincible debug mutation.
Although that’s quite some time ago, so I guess this has changed since then. And I had to force it to overflow, because at some point the calorie intake was equal to what my character lost waiting for digestion.

This is the best thead of the month :rofl:

Hmm :thinking: so that’s why the Force didn’t work on Jabba the Hutt - its effects were broken by gravitational space-time distortions.