droozynuu / andors-trail

Automatically exported from code.google.com/p/andors-trail
0 stars 0 forks source link

Better way to determine amount of experience given from monsters #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We should look into changing how to determine the amount of experience given 
from monsters. Currently, the amount of experience if purely determined from 
the monster type. Each monster type has a fixed amount of experience determined 
in the monster editor (more info on that editor soon).

One suggestion is to introduce an automatic function that determines the amount 
of experience given based on how tough the monster is. That way, killing 
tougher monster would automatically yield more experience without any need for 
manual adjustment in the monster editor.

I still want to keep the option of manually specifying the experience per 
monster type though. Bosses should give more experience than normal monsters, 
and "annoyance"-monsters should give less.

Original issue reported on code.google.com by oskar.wi...@gmail.com on 23 Nov 2010 at 10:10

GoogleCodeExporter commented 8 years ago

Original comment by oskar.wi...@gmail.com on 23 Nov 2010 at 10:19

GoogleCodeExporter commented 8 years ago
I like the formula approach. Surely Bosses should give more experience, but 
they are also tougher than other monsters.

The problem would be that this formula would be very complex.
To start with an easy thing: IMO the XP should vary, like the dropped gold and 
the dropped item. If a monster gives 10 XP normally its given XP should vary 
between 7 and 13 XP. (equally distributed to keep it easy)

For the following formulas I assume that a monster is "worth" its average 
attack and defense HP. Assuming an average attack longs 3 turns the attack HP 
should be multiplied by 3. An scale factor SF could be used to scale the XP. 
(if it raises too fast a scale function could be used)

avgAttackHP  = (10 / AP) * AC * ((AD_min + AD max) / 2)
avgDefenseHP = HP * (1 + BC)
XP = (avgAttackHP * 3 + avgDefenseHP) * SF

AP - attack points needed for an attack
AC - attack chance
AD_min - minimum attack damage
AD_max - maximum attack damage
HP - hitpoints
BC - block chance

I tried a SF = 0,5 and came to the following results:
1 * 0,7 * 1,5 = 1,05 | 6 * 1    = 6    = 6 + 3,15  = 9,15 > Forest Wasp      5 
XP (11 XP before)
1 * 0,9 * 2   = 1,8  | 6 * 1    = 6    = 6 + 5,4   = 11,4 > Small rabid dog  6 
XP (11 XP before)
2 * 1,1 * 3   = 6,6  | 20 * 1,3 = 26   = 26 + 19,8 = 45,8 > Rabid Boar      23 
XP (25 XP before)
2 * 1,0 * 3   = 6,0  | 25 * 1,5 = 37,5 = 37,5 + 18 = 55,5 > Rabid Fox       28 
XP (15 XP before) was too weak before

Original comment by SamuelPl...@gmail.com on 25 Nov 2010 at 12:56

GoogleCodeExporter commented 8 years ago
update:
XP = ((avgAttackHP * 3 + avgDefenseHP) * SF) * (1 + random(-30, 30) / 10)

Original comment by SamuelPl...@gmail.com on 25 Nov 2010 at 1:05

GoogleCodeExporter commented 8 years ago
Samuel, you are full of bright ideas! That's a very good formula I think, it 
would make it much more rewarding to fight tougher monsters, and lessen the 
risk of some monster being over- or underpowered in experience.

There are some things I would like to add to it though that we have to account 
for:

Damage resistance (DR). I would suggest raising avgDefenseHP by 9*DR. Assuming 
3 turns combat and 3 player attacks per turn, the effect this would have on the 
defense hp would be 3*3*DR.

Critical hit chance. I suggest adjusting avgAttackHP by multiplying it by 
(1+CC*CM).
CC - Critical hit chance
CM - Critical hit multiplier

In total, the base experience would be calculated based on your formula:
avgAttackHP  = (10 / AP) * AC * ((AD_min + AD max) / 2) * (1+CC*CM)
avgDefenseHP = HP * (1 + BC) + 9 * DR
XP = (avgAttackHP * 3 + avgDefenseHP) * SF

I made a quick spreadsheet of the calculations here:
https://spreadsheets.google.com/ccc?key=0AlzojXWckOcAdGhBWDBBWkhfZGs5M0k3Y3dWTkZ
rb3c&hl=en&authkey=CLWy26sE

Do you think this will work sufficiently? Is the factor 9 on damage resistance 
enough? If the player cannot inflict more damage than the monster's damage 
resistance, the monster is virtually invulnerable, so I would like damage 
resistance to really boost the amount of experience given.

I still want to keep the option of manually specifying experience for certain 
monster types, eventhough we have this formula. The way I'm thinking we 
implement this is therefore that we precalculate the base experience for all 
monsters by using the formula above. The base experience would then still be a 
property of the monster type (just like it is now), and if we want to change 
the experience we will still have the option of doing so by overriding the 
value on the monster type. In effect, the experience would not be dynamically 
calculated by the game, but rather precalculated as a part of the monster 
definition.

Good ideas Samuel! I'll start implementing this soon.

Original comment by oskar.wi...@gmail.com on 25 Nov 2010 at 12:07

GoogleCodeExporter commented 8 years ago
Your extensions seem to be "right". I just didn't knew of them because I had no 
examples for critical hits and damage resistance. (good ideas by the way)

I think the factor 9 for DR is a good choice.
Perhaps you could specify an "extra XP"-value instead of an "override XP"-value.
Bosses could give something around 3-5 times the normal xp.

Original comment by SamuelPl...@gmail.com on 25 Nov 2010 at 7:14

GoogleCodeExporter commented 8 years ago
If I understand you right, then this one is implemented too?

Original comment by SamuelPl...@gmail.com on 26 Nov 2010 at 10:27

GoogleCodeExporter commented 8 years ago
Yes, this is now implemented. For 0.6.6 however I feel that we should raise the 
amount of exp given from monsters slightly, since it takes quite a while to 
level up now.

I'm changing SF from 0.5 to 0.8 , in effect giving out 60% more exp than 
before. We might tweak this again in the future.

Original comment by oskar.wi...@gmail.com on 27 Nov 2010 at 10:14

GoogleCodeExporter commented 8 years ago
This is now implemented. Closing this issue. Thanks again for all the good 
suggestions!

Original comment by oskar.wi...@gmail.com on 29 Nov 2010 at 9:41