Who wants to mess with speed?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fizzix
    Prophet
    • Aug 2009
    • 3025

    #16
    Originally posted by MattB
    Okay, hands up, I'm a bit of an idiot and I don't have a clue about coding (I'm not even sure which type of pencil you use to do it), but could someone PLEASE explain the maths behind speed?!

    As I understand it, +10SPD is twice as fast, but increases beyound +30 are marginal returns. How does this work?
    It's not an outright formula. There's an array mapping between speed values and "energy costs." I believe it's in tables.h, but I haven't checked for sure.

    When you do an action you expend N energy (for speed +0 this is 100) and every game turn it decays by 1, so 100 game turns later you can go again. Each turn the game processes the player and all the monsters and the ones that have 0 energy get an action.

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9639

      #17
      Code:
      /*
      * This table allows quick conversion from "speed" to "energy"
      * The basic function WAS ((S>=110) ? (S-110) : (100 / (120-S)))
      * Note that table access is *much* quicker than computation.
      *
      * Note that the table has been changed at high speeds. From
      * "Slow (-40)" to "Fast (+30)" is pretty much unchanged, but
      * at speeds above "Fast (+30)", one approaches an asymptotic
      * effective limit of 50 energy per turn. This means that it
      * is relatively easy to reach "Fast (+30)" and get about 40
      * energy per turn, but then speed becomes very "expensive",
      * and you must get all the way to "Fast (+50)" to reach the
      * point of getting 45 energy per turn. After that point,
      * furthur increases in speed are more or less pointless,
      * except to balance out heavy inventory.
      *
      * Note that currently the fastest monster is "Fast (+30)".
      *
      * It should be possible to lower the energy threshhold from
      * 100 units to 50 units, though this may interact badly with
      * the (compiled out) small random energy boost code. It may
      * also tend to cause more "clumping" at high speeds.
      */
      const byte extract_energy[200] =
      {
      /* Slow */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* Slow */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* Slow */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* Slow */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* Slow */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* Slow */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* S-50 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      /* S-40 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      /* S-30 */ 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
      /* S-20 */ 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
      /* S-10 */ 5, 5, 5, 5, 6, 6, 7, 7, 8, 9,
      /* Norm */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
      /* F+10 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
      /* F+20 */ 30, 31, 32, 33, 34, 35, 36, 36, 37, 37,
      /* F+30 */ 38, 38, 39, 39, 40, 40, 40, 41, 41, 41,
      /* F+40 */ 42, 42, 42, 43, 43, 43, 44, 44, 44, 44,
      /* F+50 */ 45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
      /* F+60 */ 47, 47, 47, 47, 47, 48, 48, 48, 48, 48,
      /* F+70 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
      /* Fast */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
      };
      Clear?
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • Derakon
        Prophet
        • Dec 2009
        • 9022

        #18
        Put another way, every game turn, you gain energy based on your current speed. The line in Nick's post that starts with "Norm" has the gain rates for speeds of +0 through +9; note that at +0 you get 10 energy/game turn. That means it takes 10 game turns for you to get 1 player turn. If you have +1 speed, then you get 11 energy/game turn, so it takes 9.1 game turns for you to get 1 player turn. At +10 speed you get 20 energy/turn, so 5 game turns per player turn -- twice as fast. And so on for +20 speed (+30 energy/turn). But starting at +28 speed, not every speed point gives you an improvement in your energy gain rate (+27 and +28 speed are identical). That's what's meant by diminishing returns. In order to get to 40 energy/turn, you need to get up to +33 speed, and it's impossible to reach 50 energy/turn.

        Comment

        • MattB
          Veteran
          • Mar 2013
          • 1214

          #19
          Firstly, thanks to Fizzix, Nick and Derakon for taking the time to answer my question.

          And particularly in answer to Nick - yes crystal clear, thank you!

          However, for the benefit of those equally uninitiated as myself, I've done the maths...
          Obviously, if I've cocked up then I fully deserve the storm of abuse that's heading my way...

          spd times faster
          0 normal
          10 2x as fast
          20 3x as fast
          30 3.8x as fast
          40 4.2x as fast
          50 4.5x as fast
          60 4.8x as fast
          70 5.0x as fast

          Or have I got the wrong end of the stick?
          Last edited by MattB; April 16, 2013, 23:41.

          Comment

          • Patashu
            Knight
            • Jan 2008
            • 528

            #20
            Yep, that's correct.
            My Chiptune music, made in Famitracker: http://soundcloud.com/patashu

            Comment

            • ramela
              Apprentice
              • Jan 2008
              • 55

              #21
              I recently made this suggestion on the NPP forums:

              Completely eparate speeds for movement, attacks, shooting and spellcasting. It opens up a lot of design space in items, races, classes and monsters.

              A separate movement speed bonus on top of the regular speed is IMO a worse idea since stacking bonuses make balancing them harder.

              As a bonus, if a player and monsters are forced to commit up to his whole turn (100 energy) everytime he attacks, pillardancing, shoot and run and hack 'n back tactics are eliminated.

              Comment

              Working...
              😀
              😂
              🥰
              😘
              🤢
              😎
              😞
              😡
              👍
              👎