Monster regen: Angband vs MAngband/TomeNET

Bug reports and discussion about bugs.
Post Reply
User avatar
PowerWyrm
Posts: 241
Joined: Sat Jan 09, 2010 4:28 pm

Monster regen: Angband vs MAngband/TomeNET

Post by PowerWyrm »

I've discovered this issue while porting stuff for my own variant. I'll post this in the Bugs subforum, although this could be considered as a feature and not as a bug, since:
- it has been in the code since day 1 (and you need to know what to look for when checking the code)
- players didn't ever complain about it (probably because nobody thought that was not normal)

Here it goes: the game is using two "turn" counts for its actions, the "normal" game turn count and the "scaled" game turn count. A "turn" is the amount of time that elapses between two calls to the main game loop. In Angband, this has no real meaning, since the game is turn based. In MAngband/TomeNET, it is a fixed value depending on the FPS parameter (number of game turns per second). The "normal" game turn count is simply the count of game turns: it is incremented by one each time the main loop is called and is used to execute actions that are independent from game actors (players, monsters) like changing the weather, sunset/surise, playing music, animating things... The "scaled" game turn count is the count of turns that pass for game actors: during each "normal" game turn, a monster or player is given an amount of energy, and that actor can act once a certain amount of energy has been reached. Every action related to game actors should use this turn count to maintainv some kind of consistency. However, this is not the case for monster regeneration, which still uses the "normal" turn count.

Here's an explicit example: monster regeneration for monsters moving at regular (+0) speed. In the code, monsters regenerate every 100 "normal" game turns.

Angband case:

The code uses the extract_energy array to determine how many energy a monster gets per game turn. A normal monster gets 10 energy per game turn. The code uses a fixed value of 100 to determine how much energy needs to be accumulated before an action can be taken, which mean that a normal monster acts every 10 game turns. Consequently, a monster will regenerate every 10 actions.

MAngband/TomeNET case:

The code also uses the extract_energy array to determine how many energy a monster gets per game turn. A normal monster gets 100 energy per game turn. The code uses a variable value (five times the value stored in the level_speeds array) to determine how much energy needs to be accumulated before an action can be taken. This value depends on the depth of the monster. In town, the value is equal to 3750 (note the convenient value of 37.5 game turns per monster turn -- with a default value of 75 for the FPS parameter, this means that a monster can act exactly every half second, which is a decent value for human reflexes). At 550ft, the value increases to 5000. At 4250ft, it increases to 10000 (this is the maximum). The choice of a variable energy threshold has been made so that deeper in the dungeon, where both players and monsters have a high base speed, the value of half a second per player/monster action stays roughly accurate. Let's consider a monster at 4250ft: with 100 energy per game turn and 10000 energy to reach, it will be able to act every 100 game turns (instead of 10 in Angband). With regeneration also occuring every 100 game turns, that monster will regenerate each time it will act.

Here's a more explicit example (monsters regenerate 1/100th or their max hp every 100 game turns, twice that amount if they REGENERATE):
- in Angband, Morgoth has 20k hps, moves at +30 speed, acts every 100/38 game turns, regenerates 400 hps every 38 actions
- in MAngband/TomeNET, Morgoth has 30k hps, moves at +30 speed, acts every 10000/400 game turns, regenerates 600 hps every 4 actions

Also note that with this system, slower monsters regenerate... faster.
mikaelh
Developer
Posts: 216
Joined: Sun Dec 13, 2009 3:18 pm

Re: Monster regen: Angband vs MAngband/TomeNET

Post by mikaelh »

This is a known issue. We consider it a feature.
User avatar
PowerWyrm
Posts: 241
Joined: Sat Jan 09, 2010 4:28 pm

Re: Monster regen: Angband vs MAngband/TomeNET

Post by PowerWyrm »

mikaelh wrote:This is a known issue. We consider it a feature.
That was my guess.
Post Reply