Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bug Reports

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2009, 09:26 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default Issue with maxlevel

Figure I post this here so it doesn't get lost. Maxlevel scaling isn't working for certain NPCs. I can't find a pattern to it, and it's not related to the lower level stuff. I tried to use level scaling stuff on NPCs and some NPCs end up with -133% health when others scale perfectly fine. I tried this in a zone where the maxlevel was 20 and the level field was 1. (1-20)

I'm guessing it's another rounding issue like we were having before on IRC but I would have no idea where

Any advice?
Reply With Quote
  #2  
Old 08-10-2009, 09:26 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default

Also, the scalerate field doesn't seem to affect this. It scales the NPCs properly, it just doesn't work half the time. It may be class related, but again, I don't know.
Reply With Quote
  #3  
Old 08-10-2009, 10:15 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Do you have any specific examples of it not working? Giving the level, maxlevel, maxhp, actual hps (as seen in #showstats or #npcstats), and scalerate as examples?

Note that I added some extra code for NPCs that are level 25 or lower for their base level setting. This was added to help prevent stats (other than HPs) from scaling at insane rates, and can be adjusted with the scalerate setting still if needed.

Here is the full method for LevelScale as it is set now. Note the section in green for the part where I adjusted for lower levels to scale their stats a bit better:

Code:
void NPC::LevelScale() {

        int8 random_level = (MakeRandomInt(level, maxlevel));

        float scaling = (((random_level / (float)level) - 1) * (scalerate / 100.0f));
        
        // Compensate for scale rates at low levels so they don't add too much
        int8 scale_adjust = 1;
        if(level > 0 && level <= 5)
                scale_adjust = 10;
        if(level > 5 && level <= 10)
                scale_adjust = 5;
        if(level > 10 && level <= 15)
                scale_adjust = 3;
        if(level > 15 && level <= 25)
                scale_adjust = 2;

        max_hp += (max_hp * scaling);
        cur_hp = max_hp;
        STR += (int)(STR * scaling / scale_adjust);
        STA += (int)(STA * scaling / scale_adjust);
        AGI += (int)(AGI * scaling / scale_adjust);
        DEX += (int)(DEX * scaling / scale_adjust);
        INT += (int)(INT * scaling / scale_adjust);
        WIS += (int)(WIS * scaling / scale_adjust);
        CHA += (int)(CHA * scaling / scale_adjust);
        if (MR)
                MR += (int)(MR * scaling / scale_adjust); 
        if (CR)
                CR += (int)(CR * scaling / scale_adjust);
        if (DR)
                DR += (int)(DR * scaling / scale_adjust);
        if (FR)
                FR += (int)(FR * scaling / scale_adjust);
        if (PR)
                PR += (int)(PR * scaling / scale_adjust);

        if (max_dmg)
        {
                max_dmg += (int)(max_dmg * scaling / scale_adjust);
                min_dmg += (int)(min_dmg * scaling / scale_adjust);
        }

        level = random_level;

        return;
}
If there is an issue, it may just be that the scale_adjust needs to be set to (float)scale_adjust for the parts that are being divided by it. You can give that a try if you want and see if that corrects any issues you are seeing. Here is an example of how that might need to be set:

Code:
STR += (int)(STR * scaling / (float)scale_adjust);
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 08-11-2009 at 06:18 AM..
Reply With Quote
  #4  
Old 08-10-2009, 10:18 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default

Quote:
Originally Posted by trevius View Post
Do you have any specific examples of it not working? Giving the level, maxlevel, maxhp, actual hps (as seen in #showstats or #npcstats), and scalerate as examples?

Note that I added some extra code for NPCs that are level 25 or lower for their base level setting. This was added to help prevent stats (other than HPs) from scaling at insane rates, and can be adjusted with the scalerate setting still if needed.

Here is the full method for LevelScale as it is set now. Note the section in green for the part where I adjusted for lower levels to scale their stats a bit better:

Code:
void NPC::LevelScale() {

        int8 random_level = (MakeRandomInt(level, maxlevel));

        float scaling = (((random_level / (float)level) - 1) * (scalerate / 100.0f));
        
        // Compensate for scale rates at low levels so they don't add too much
        int8 scale_adjust = 1;
        if(level > 0 && level <= 5)
                scale_adjust = 10;
        if(level > 5 && level <= 10)
                scale_adjust = 5;
        if(level > 10 && level <= 15)
                scale_adjust = 3;
        if(level > 15 && level <= 25)
                scale_adjust = 2;

        max_hp += (max_hp * scaling);
        cur_hp = max_hp;
        STR += (int)(STR * scaling / scale_adjust);
        STA += (int)(STA * scaling / scale_adjust);
        AGI += (int)(AGI * scaling / scale_adjust);
        DEX += (int)(DEX * scaling / scale_adjust);
        INT += (int)(INT * scaling / scale_adjust);
        WIS += (int)(WIS * scaling / scale_adjust);
        CHA += (int)(CHA * scaling / scale_adjust);
        if (MR)
                MR += (int)(MR * scaling / scale_adjust); 
        if (CR)
                CR += (int)(CR * scaling / scale_adjust);
        if (DR)
                DR += (int)(DR * scaling / scale_adjust);
        if (FR)
                FR += (int)(FR * scaling / scale_adjust);
        if (PR)
                PR += (int)(PR * scaling / scale_adjust);

        if (max_dmg)
        {
                max_dmg += (int)(max_dmg * scaling / scale_adjust);
                min_dmg += (int)(min_dmg * scaling / scale_adjust);
        }

        level = random_level;

        return;
}
Yeah, I am looking at a level 16 NPC with base HP (which is 100) from the database (the hp field) and 187 stats (all stats are 75 in the database and scalerate is set to 100%.)

Something also to note is the NPC is wielding a statless 2Hander. It is also a warrior. It also happens to the same NPCs each time.
Reply With Quote
  #5  
Old 08-10-2009, 10:21 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default

Also, to narrow it down a bit, even with int placed in front of maxhp like the other ones, it still happens. So it's definately not related to a lack of int in front of the hp. The other stats still work fine, which makes me worried that it's some HP thingy.
Reply With Quote
  #6  
Old 08-10-2009, 10:26 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Quote:
Originally Posted by Secrets View Post
Yeah, I am looking at a level 16 NPC with base HP (which is 100) from the database (the hp field) and 187 stats (all stats are 75 in the database and scalerate is set to 100%.)

Something also to note is the NPC is wielding a statless 2Hander. It is also a warrior. It also happens to the same NPCs each time.
The NPC is level 16, but is that the level or the random level generated from maxlevel? Are you using an NPC that can scale from level 1 up to 16 or so? This scaling system is specifically meant for very small level ranges at the low level range. It can be used for more variance in level range the higher level you go, but at the low level range it would be really hard to control how stats scale to give good enough results if you are using a very wide range like 1 to 20 or so. For lower than level 25 or so, I would recommend keeping the level and maxlevel settings within 5 levels or less most of the time. If you were doing level 40 to maxlevel 50 ranges (or higher level ranges), that wouldn't be as bad because the scaling would be quite a bit more leveled in that range.

Quote:
Originally Posted by Secrets View Post
Also, to narrow it down a bit, even with int placed in front of maxhp like the other ones, it still happens. So it's definately not related to a lack of int in front of the hp. The other stats still work fine, which makes me worried that it's some HP thingy.
If you notice this only on NPC that actually wear equipment (visible), then it could possibly be something related to the hp calculating functions that get used when calculating bonuses for NPCs for the gear they are wearing. If it is doing those calculations before the level scaling portion is run, it could probably effect the total outcome. Though, I don't think that would be the case. Everything for checking level should be using GetLevel, which gets the actual variable "level", which is what the scaling is setting. I think HPs may do the same, but maybe I need to check out the GetHP() method to make sure nothing is actually pulling that info from the database value.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 08-11-2009 at 06:30 AM..
Reply With Quote
  #7  
Old 08-10-2009, 10:29 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default

Quote:
Originally Posted by trevius View Post
The NPC is level 16, but is that the level or the random level generated from maxlevel? Are you using an NPC that can scale from level 1 up to 16 or so? This scaling system is specifically meant for very small level ranges at the low level range. It can be used for more variance in level range the higher level you go, but at the low level range it would be really hard to control how stats scale to give good enough results if you are using a very wide range like 1 to 20 or so. For lower than level 25 or so, I would recommend keeping the level and maxlevel settings within 5 levels or less most of the time. If you were doing level 40 to maxlevel 50 ranges (or higher level ranges), that wouldn't be as bad because the scaling would be quite a bit more leveled in that range.
Random generated from maxlevel. I'll try to keep it 1-10 and see how that goes. Due to the gear on my server, those mobs would not be hard that were generated. But the issue might still stand. We'll see. Tweaking it now, will post results.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:22 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3