]> granicus.if.org Git - nethack/commitdiff
Candle light radius is now square root, not logarithmic
authorcopperwater <aosdict@gmail.com>
Mon, 6 Nov 2017 16:01:15 +0000 (11:01 -0500)
committerPasi Kallinen <paxed@alt.org>
Sat, 25 Apr 2020 16:17:21 +0000 (19:17 +0300)
After some discussion with Alex Smith, it seems like a good change for
both gameplay and realism that candles' light radius should decay
quadratically instead of exponentially. Now a light radius of 4 from
candles can be accomplished by burning 9 candles, and players who find a
lot of candles might even be able to get up to 5 (16 candles) or 6 (25
candles).

The main impetus for this change is that with the existing formula, the
more candles -> more light mechanic was more or less useless outside of
wizard mode, because you needed 49 candles to do better than a lamp.

src/light.c

index 243282bfe08389360035546e7a6878fc7cfd491f..c34acfcdc580e7db063ccd0dcc4f4fe3a5498e30 100644 (file)
@@ -712,20 +712,19 @@ struct obj *obj;
         radius = (obj->spe < 4) ? 2 : (obj->spe < 7) ? 3 : 4;
     } else if (Is_candle(obj)) {
         /*
-         *      Range is incremented by powers of 7 so that it will take
-         *      wizard mode quantities of candles to get more light than
-         *      from a lamp, without imposing an arbitrary limit.
-         *       1..  candles, range 2;
-         *       7..48  candles, range 3;
-         *      49..342 candles, range 4; &c.
+         *      Range is incremented quadratically. You can get the same
+         *      amount of light as from a lamp with 4 candles, and
+         *      even better light with 9 candles, and so on.
+         *       1..3  candles, range 2;
+         *       4..8  candles, range 3;
+         *       9..15 candles, range 4; &c.
          */
         long n = obj->quan;
 
         radius = 1; /* always incremented at least once */
-        do {
+        while(radius*radius <= n) {
             radius++;
-            n /= 7L;
-        } while (n > 0L);
+        }
     } else {
         /* we're only called for lit candelabrum or candles */
         /* impossible("candlelight for %d?", obj->otyp); */