EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   NPCs Almost never miss on attack (https://www.eqemulator.org/forums/showthread.php?t=40469)

Figback65 03-17-2016 07:00 PM

NPCs Almost never miss on attack
 
Since I recompiled the latest build NPCs very very rarely miss an attack. From level 1 to 70 the npcs almost always land atleast some damage. Granted as you get higher up in level with parry dodge and ripostle you avoid a little more but the natural miss chance is tiny. I did notice the all npcs double attack got fixed for low levels but seem to be doing the same amount of damage due to high % hit rate. I tried changing some NPC accuracy but it did not effect it. I am searching through the code to find where it is handled and will post it here. Unless someone beats me to it. Sometimes its still hard to find the stuff w/o knowing the naming terminology lol

Figback65 03-17-2016 07:16 PM

Found it I think in attack.cpp

attack.cpp
Code:

// called when a mob is attacked, does the checks to see if it's a hit
// and does other mitigation checks. 'this' is the mob being attacked.
bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 chance_mod)
{
/*/
                //Reworked a lot of this code to achieve better balance at higher levels.
                //The old code basically meant that any in high level (50+) combat,
                //both parties always had 95% chance to hit the other one.
/*/

        Mob *attacker=other;
        Mob *defender=this;
        float chancetohit = RuleR(Combat, BaseHitChance);

        if(attacker->IsNPC() && !attacker->IsPet())
                chancetohit += RuleR(Combat, NPCBonusHitChance);

        Log.Out(Logs::Detail, Logs::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName());

        bool pvpmode = false;
        if(IsClient() && other->IsClient())
                pvpmode = true;

        if (chance_mod >= 10000)
                return true;

        float avoidanceBonus = 0;
        float hitBonus = 0;

and more I didn't wanna spam post with

EDIT :
Code:

        if(attacker->IsNPC())
                hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database


Uleat 03-17-2016 07:50 PM

Not doubting anything that you've said..but, there is a ton of logging code in that function.

Have you enabled that log channel to see what the actual values are for a combat session?

Figback65 03-17-2016 08:10 PM

Ummmm I actually don't know how to do the logging hahaha. Let me look into it, I know the setup changed via control in a database table. ill get back in a sec to ya.

Edit : ok I see it, just enable with 1 and #logs reload_all, enabled attack, noticed in cpp its categorized by attack.

Uleat 03-17-2016 08:30 PM

You should be able to do something like
Code:

#logs set file 4 3
in-game to turn it on temporarily. ('4' should be the 'attack' log index.)

It will remain active until you turn it off with
Code:

#logs set file 4 0
or until the zone instance shuts down.


EDIT: I do recommend using the file option or you will end up with a lot of spam in-game or in your console window :P

Figback65 03-17-2016 08:54 PM

For some reason I cant get it to post attack in console, I tried it with scripts and it shows but nothing attack based spams in console, I did however get it in the log file and as follows

level 1 noob vs level 1 mob
Code:

[03-17-2016 :: 20:50:09] [Attack] CheckHitChance(Qpiddle) attacked by a_sylvan_bat001
[03-17-2016 :: 20:50:09] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:50:09] [Attack] Chance to hit after level diff calc 95.00
[03-17-2016 :: 20:50:09] [Attack] Chance to hit after Agility calc 93.75
[03-17-2016 :: 20:50:09] [Attack] Chance to hit after weapon falloff calc (defense) 93.75
[03-17-2016 :: 20:50:09] [Attack] Chance to hit 93.75 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:50:09] [Attack] 3 FINAL calculated chance to hit is: 93.75
[03-17-2016 :: 20:50:09] [Attack] Final hit chance: 93.75%. Hit roll 37.97
[03-17-2016 :: 20:50:12] [Attack] CheckHitChance(Qpiddle) attacked by a_sylvan_bat001
[03-17-2016 :: 20:50:12] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:50:12] [Attack] Chance to hit after level diff calc 95.00
[03-17-2016 :: 20:50:12] [Attack] Chance to hit after Agility calc 93.75
[03-17-2016 :: 20:50:12] [Attack] Chance to hit after weapon falloff calc (defense) 93.75
[03-17-2016 :: 20:50:12] [Attack] Chance to hit 93.75 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:50:12] [Attack] 3 FINAL calculated chance to hit is: 93.75
[03-17-2016 :: 20:50:12] [Attack] Final hit chance: 93.75%. Hit roll 82.21
[03-17-2016 :: 20:50:15] [Attack] CheckHitChance(Qpiddle) attacked by a_sylvan_bat001
[03-17-2016 :: 20:50:15] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:50:15] [Attack] Chance to hit after level diff calc 95.00
[03-17-2016 :: 20:50:15] [Attack] Chance to hit after Agility calc 93.75
[03-17-2016 :: 20:50:15] [Attack] Chance to hit after weapon falloff calc (defense) 93.75
[03-17-2016 :: 20:50:15] [Attack] Chance to hit 93.75 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:50:15] [Attack] 3 FINAL calculated chance to hit is: 93.75
[03-17-2016 :: 20:50:15] [Attack] Final hit chance: 93.75%. Hit roll 51.40
[03-17-2016 :: 20:50:18] [Attack] CheckHitChance(Qpiddle) attacked by a_sylvan_bat001
[03-17-2016 :: 20:50:18] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:50:18] [Attack] Chance to hit after level diff calc 95.00
[03-17-2016 :: 20:50:18] [Attack] Chance to hit after Agility calc 93.75
[03-17-2016 :: 20:50:18] [Attack] Chance to hit after weapon falloff calc (defense) 93.75
[03-17-2016 :: 20:50:18] [Attack] Chance to hit 93.75 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:50:18] [Attack] 3 FINAL calculated chance to hit is: 93.75
[03-17-2016 :: 20:50:18] [Attack] Final hit chance: 93.75%. Hit roll 7.85


Level 24 Velious era twink vs level 20 Unrest Mummy
Code:

[03-17-2016 :: 20:43:06] [Attack] CheckHitChance(Dangah) attacked by a_lurking_mummy000
[03-17-2016 :: 20:43:06] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after level diff calc 92.22
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after Agility calc 90.87
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after weapon falloff calc (defense) 91.53
[03-17-2016 :: 20:43:06] [Attack] Chance to hit 91.53 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:43:06] [Attack] 3 FINAL calculated chance to hit is: 91.53
[03-17-2016 :: 20:43:06] [Attack] Final hit chance: 91.53%. Hit roll 0.45
[03-17-2016 :: 20:43:06] [Attack] CheckHitChance(Dangah) attacked by a_lurking_mummy000
[03-17-2016 :: 20:43:06] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after level diff calc 92.22
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after Agility calc 90.87
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after weapon falloff calc (defense) 91.53
[03-17-2016 :: 20:43:06] [Attack] Chance to hit 91.53 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:43:06] [Attack] 3 FINAL calculated chance to hit is: 91.53
[03-17-2016 :: 20:43:06] [Attack] Final hit chance: 91.53%. Hit roll 78.36
[03-17-2016 :: 20:43:06] [Attack] CheckHitChance(Dangah) attacked by a_lurking_mummy000
[03-17-2016 :: 20:43:06] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after level diff calc 92.22
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after Agility calc 90.87
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after weapon falloff calc (defense) 91.53
[03-17-2016 :: 20:43:06] [Attack] Chance to hit 91.53 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:43:06] [Attack] 3 FINAL calculated chance to hit is: 91.53
[03-17-2016 :: 20:43:06] [Attack] Final hit chance: 91.53%. Hit roll 30.88
[03-17-2016 :: 20:43:06] [Attack] CheckHitChance(Dangah) attacked by a_lurking_mummy000
[03-17-2016 :: 20:43:06] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after level diff calc 92.22
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after Agility calc 90.87
[03-17-2016 :: 20:43:06] [Attack] Chance to hit after weapon falloff calc (defense) 91.53
[03-17-2016 :: 20:43:06] [Attack] Chance to hit 91.53 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:43:06] [Attack] 3 FINAL calculated chance to hit is: 91.53
[03-17-2016 :: 20:43:06] [Attack] Final hit chance: 91.53%. Hit roll 57.74
[03-17-2016 :: 20:43:09] [Attack] CheckHitChance(Dangah) attacked by a_lurking_mummy000
[03-17-2016 :: 20:43:09] [Attack] Chance to hit before level diff calc 95.00
[03-17-2016 :: 20:43:09] [Attack] Chance to hit after level diff calc 92.22
[03-17-2016 :: 20:43:09] [Attack] Chance to hit after Agility calc 90.87
[03-17-2016 :: 20:43:09] [Attack] Chance to hit after weapon falloff calc (defense) 91.53
[03-17-2016 :: 20:43:09] [Attack] Chance to hit 91.53 after accuracy calc 0.00 and avoidance calc 0.00
[03-17-2016 :: 20:43:09] [Attack] 3 FINAL calculated chance to hit is: 91.53
[03-17-2016 :: 20:43:09] [Attack] Final hit chance: 91.53%. Hit roll 26.30

Both situations have super high hit rates. With level 1s starting out and getting pegged every single swing, it makes it extremely difficult. And if the 24 didn't have a fungi tunic regen they would barely survive. 90% hit rate sounds like it would be correct but the way it portrays in game vs world item/stat balance it hurts very bad.

EDIT : So the question being, if I wanted to decrease the Hit chance for mobs, would I change the 10.0f float to a higher value?
Code:

if(attacker->IsNPC())
                hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database


Uleat 03-17-2016 09:20 PM

I would probably start here first:
https://github.com/EQEmu/Server/blob...ttack.cpp#L188

Which defaults to this - if no database rules are found:
https://github.com/EQEmu/Server/blob...letypes.h#L392

(My database rule value is set to '69.0' as well...)


How did you get 95.0?


EDIT: Duh!

https://github.com/EQEmu/Server/blob...letypes.h#L393

Try lowering the NPCBonusHitChance to see if that helps.

Figback65 03-17-2016 09:34 PM

Mine is set the same
Code:

RULE_REAL(Combat, BaseHitChance, 69.0)
A lot of declarations broke in ruletypes.h and maxskill.h ive noticed. Ill check that NPCBonusHitChance modifier, if adjusting that drops the higher level stuff like level 20/30+ too much I think ill have to code in a level < 21 sumwhere to only drop the low lvl stuff. I'm mostly worried about beginning population being happy and having a chance.
EDIT : level 20-30+ it seems to start leveling off as classes get dodge, parry, ripostle skills and up in skill value.

EDIT : Should this be saying 69 and not 95?
Code:

[03-17-2016 :: 20:43:06] [Attack] Chance to hit before level diff calc 95.00
DOULBE EDIT : DUH!!!! Combat:NPCBonusHitChance = 26, 26+69 = 95 hahahaha I got what ur saying now ;)

Uleat 03-18-2016 05:04 PM

Have you had any luck with this yet?

Figback65 03-18-2016 06:04 PM

I'm about to get back into it, been stuck worken on nexus ports. the scripts don't cast the port spells anymore with current build the spell interrupts. Having to change the cast method, I guess $npc->CastSpell(13022,2935); #flavor got broke or something else changed, eitherway people cant get in or out of nexus.

provocating 03-18-2016 08:01 PM

Yes, they are broken. If you have not gotten it then PM me, I already redid the ports two weeks ago.

Figback65 03-18-2016 09:15 PM

Ok, I changed it to

attack.cpp
Code:

        if (attacker->IsNPC()) {
                if (GetLevel() <= 29) {
                        hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 15.0f); //Modifier from database
                }
                if (GetLevel() >= 30) {
                        hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database
                }
        }

Seems to be working a little better, I am going to do some more extensive tweaking on it tonight after players log. My test box is busted lol.

At 1st I thought I broke it but then realized some information doesn't show up in gmsay vs logs. On debug 3, Hit roll ##.## shows up in logs but no gmsay. After realizing that it seems to be doing pretty good. More info to follow.

Figback65 03-19-2016 02:13 PM

Ok that definitely didn't work. The code went through so that's good with no errors but the floating value I think is for a modifier accuracy calculation and according to the debug I don't have any to calculate. Maybe from AA or something. So I will dig some more

Coenxai 03-19-2016 03:00 PM

That's because accuracy has to do with the database values in npc_types when mobs are spawned. I don't even think they're coded to benefit from item(s) / spell(s) accuracy either. Wrong thing :P

(The most edited post in the history of posting.)

Check your rule_values table for WeaponSkillFalloff value. Is it set to 0.33?

Figback65 03-19-2016 03:43 PM

yea weaponskillfalloff is set to 0.33. I tried adjusting accuracy on npc_types on a test level 1 npc and the npc still landed too many times. I am just tryen to tweak them down a tiny bit lol

EDIT: I have noticed when the NPC does miss, the high majority are kicks and bashes, not melee swings.

Coenxai 03-19-2016 04:07 PM

Using the default code and values I noticed the hit chance was extremely high until weapon falloff. I only tested a few levels, but the hit chance was generally around 62% afterwards (down from 93-96%~). You had to have modified something in the code or database that screwed something up. I'd revert all of your changes.

Code:

[03-17-2016 :: 20:50:12] [Attack] Chance to hit after weapon falloff calc (defense) 93.75
This right here is the issue.

Figback65 04-02-2016 10:17 PM

Quote:

Originally Posted by Coenxai (Post 247756)
Using the default code and values I noticed the hit chance was extremely high until weapon falloff. I only tested a few levels, but the hit chance was generally around 62% afterwards (down from 93-96%~). You had to have modified something in the code or database that screwed something up. I'd revert all of your changes.

Code:

[03-17-2016 :: 20:50:12] [Attack] Chance to hit after weapon falloff calc (defense) 93.75
This right here is the issue.

I reverted all my code changes which was only the stuff I posted previously. I didn't change anything in the database, I didn't modify anything related to hit or accuracy on NPCs tables. I started with a fresh new compile which previously stated and the newest PEQ. I did however source in my old NPC_types that had entries I have manually added. I guess I can start with a clean PEQ 100%. I prefer not to, but if some entries in an old PEQ version that I may be using conflict with some new changes, then that could be it and I will have no choice.

EDIT : I don't know how you guys keep updating sources and using older peq and keep things working, because everytime I update, I end up having to start back over from fresh and lose everything I change.

EDIT : I am sourcing in a new database peq from 8/12/15, last one I could find. I will see if anything changes. If its fixed then I guess I'm redoing it all again lol

EDIT : I sourced peq 8/12/15 and did a fresh git of the source, rebuilt, and still same issue. This is with 0 changes. I also accidently overwrote my edited build with cmake, so I lost everything :/

Digitala 04-20-2016 02:37 PM

Yeah i also noticed that the mobs don't really miss that often.

I recently installed the latest windows install from Akke and i found something that could also be connected to this, that some of the mobs that are around 50+ hit really really hard. Plane of Fear trash mobs hit for 400+

They should be hitting for max around 200?

Freeport Guard hit me for 180.
Cazic Thule entrance mob hit me for 400.

What is going on here?

jaspen 05-24-2016 09:35 AM

I recently built a new server from scratch using all new code and the weekly database, 5-15-2016. Prior to this I had played with a group of bots. This time around, with the new build, a friend and I decided let us duo only for the challenge. The challenge is real!

I agree the hit rate and overall DPS of lower level mobs is very high. We are in the low 20s and still seeing this. Even if you out level a mob to where they are green, light blue and even high grey, they can wreck you. I did a search and found this thread and it seemed recent enough to still be valid.

Has anyone found an elegant solution to this in order to bring a bit better balance at the lower levels? For the previous posters, are you still see this in the later levels as well? Playing with bots kept me from first noticing it.


All times are GMT -4. The time now is 05:27 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.