Pets being aggro'd with no LOS

Discussions on various DOL development features

Moderator: Support Team

Pets being aggro'd with no LOS

Postby tegstewart » Wed Mar 22, 2017 5:11 pm

I've noticed that pets draw aggro like crazy, even when there's no LOS between the pet and the mob aggroing them. This is especially problematic in places like fomor and Avalon City; you get huge clumps of mobs charging pets through walls, stairs, floors, ceilings, etc. This is actually the reason my solo content addition includes an AOE melee pet.

It would make sense for pets that are lower level than the player to draw more aggro as a result, but I'm still seeing it when the pet is the same level as the player.

I would guess that there's a LOS check that is being missed when checking for aggro on pets, and there's got to be something similar when determining aggro range.

That or there's a db setting for the LOS manager that I'm not using and should be.

Thoughts?
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Pets being aggro'd with no LOS

Postby Graveen » Wed Mar 22, 2017 5:44 pm

I'm surprised but yeah there should have also a los check between npc <--> pet. I'm not sure if you can activate this by SP or not (iirc there was an option to do so).
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Pets being aggro'd with no LOS

Postby tegstewart » Wed Mar 22, 2017 7:42 pm

Here are the options I'm using ATM. This is with Autobuild 1.9.7.3598.
Code: Select all
always_check_los TRUE always_check_pet_los TRUE check_los_during_cast True losmgr_cleanup_entries 1000 losmgr_cleanup_frequency 120000 losmgr_contamination_zfactor 0.5 losmgr_debug_level 0 losmgr_enable True losmgr_environment_vs_environment_cache_timeout 5000 losmgr_environment__vs_environment_range_threshold 350 losmgr_guard_contamination_radius 200 losmgr_max_contamination_radius 350 losmgr_npc_contamination_radius 250 losmgr_pet_contamination_radius 50 losmgr_players_contamination_radius 0 losmgr_player_check_frequency 100 losmgr_player_vs_environment_cache_timeout 1500 losmgr_player_vs_environment_range_threshold 125 losmgr_player_vs_player_cache_timeout 200 losmgr_player_vs_player_range_threshold 32 losmgr_query_timeout 300 los_player_check_frequency 5
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Pets being aggro'd with no LOS

Postby ontheDOL » Thu Mar 23, 2017 12:36 am

i did a test with cabby and pet in a dungeon, with a mob set to 1000 aggro range, and yes he would not aggro the player thru wall, but if i cast pet, then he aggro thru the wall onto pet.

So i checked StandardMobBrain.cs
Code: Select all
public virtual void AddToAggroList(GameLiving living, int aggroamount, bool NaturalAggro) { if (m_body.IsConfused) return; // tolakram - duration spell effects will attempt to add to aggro after npc is dead if (!m_body.IsAlive) return; if (living == null) return; if (aggroamount > 0 && NaturalAggro) { LastNaturalAggro = Body.CurrentRegion.Time; } //Handle trigger to say sentance on first aggro. if (m_aggroTable.Count < 1) Body.FireAmbientSentence(GameNPC.eAmbientTrigger.aggroing, living); // Check LOS (walls, pits, etc...) before attacking, player + pet // Be sure the aggrocheck is triggered by the brain on Think() method if (DOL.GS.ServerProperties.Properties.ALWAYS_CHECK_LOS && NaturalAggro) { GamePlayer thisLiving = null; if (living is GamePlayer) thisLiving = (GamePlayer)living; if (living is GamePet) { IControlledBrain brain = ((GamePet)living).Brain as IControlledBrain; thisLiving = brain.GetPlayerOwner(); } if (thisLiving != null) { thisLiving.Out.SendCheckLOS (Body, living, new CheckLOSResponse(CheckAggroLOS)); if (!AggroLOS) return; } }
It would appear that the LOS check is performed here against player and pet..... but it doesn't work. So we look here
if (DOL.GS.ServerProperties.Properties.ALWAYS_CHECK_LOS && NaturalAggro) .... what is naturalaggro? some boolean in this method that is never set to true as far as i can see... i removed this, logged in same dungeon and mob doesnt aggro thru wall onto pet.

i guess the problem is here... but i gotta test more ( method is overridden quite alot)
- Unty -
Model Showroom and DOL guides
http://losojos-001-site1.btempurl.com
User avatar
ontheDOL
Developer
 
Posts: 311
Joined: Fri May 20, 2016 4:21 am
Location: Australian abroad

Re: Pets being aggro'd with no LOS

Postby Leodagan » Thu Mar 23, 2017 8:48 am

NaturalAggro is set to true in the "CheckPlayerAggro" Method which is not much overridden in other GameNPC subclasses (only for some Turret Brain and Guard Brain...)

The problem here is clearly a race condition in SendCheckLOS callback...

The CheckAggroLOS method is triggered when we receive a reply from the Line of Sight Check that was sent to pet's "GamePlayer" Owner, this callback only change the status of "AggroLOS" Flag which is a class member...

So when this line is evaluated...
Code: Select all
thisLiving.Out.SendCheckLOS (Body, living, new CheckLOSResponse(CheckAggroLOS));
...a packet is sent to the Player's Client, and the response isn't expected to be received in any less than hundred of milliseconds !

But the following line is evaluated within micro seconds...
Code: Select all
if (!AggroLOS) return;
...and will probably use any AggroLOS status from a previous check !


In fact nothing around this code make sure that LOS Check and Aggro LOS Status are evaluated sequentially ! Brain even iterate a whole Collection of targets before feeding them to this method so the Aggro LOS Status could be set to true any time and it will trigger attack on a random target being evaluated in the iterating Loop... (or you could completely stop a mob from attacking by "hiding" one of the characters in a group and hoping it will be evaluated as false LOS check protecting all other nearby targets...)

This is probably a reason why the Aggressive mobs are so "passive" on DOL, any solo player will need to trigger a lot of "Think" rounds before he's "catched" in correct range and with valid LOS !


-----------


There is even an other problem that I only found during my previous analysis :
Code: Select all
/// <summary> /// Check for aggro against close NPCs /// </summary> protected virtual void CheckNPCAggro() { if (Body.AttackState) return; foreach (GameNPC npc in Body.GetNPCsInRadius((ushort)AggroRange, Body.CurrentRegion.IsDungeon ? false : true)) { if (!GameServer.ServerRules.IsAllowedToAttack(Body, npc, true)) continue; if (m_aggroTable.ContainsKey(npc)) continue; // add only new NPCs if (!npc.IsAlive || npc.ObjectState != GameObject.eObjectState.Active) continue; if (npc is GameTaxi) continue; //do not attack horses if (CalculateAggroLevelToTarget(npc) > 0) { AddToAggroList(npc, (npc.Level + 1) << 1); } } }
Aggro to NPC is evaluated in another method than aggro to player... and in this method the Natural Aggro Flag isn't set !

So you were right about this Flag being always false for NPC vs NPC checks :s
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Pets being aggro'd with no LOS

Postby PlanarChaosRvrtwo » Thu Mar 23, 2017 8:58 am

Just an guess that could help why the mob cant use the sent pet to mob los check if it fails the mob shouldnt be able to add also?

Or in other words if mob aggro to something it trigger an script if the target would be able to come also and if los check of pet also fails it counter the aggro gain?

I know its not best thing but even if it give a an idea my guess did its job.
DOL dint only gaved me the data to start my server,
it also gaved me 16 amazing years with nice peeps,
and now its on me to return the favor.
User avatar
PlanarChaosRvrtwo
Database Team
 
Posts: 517
Joined: Thu Jul 07, 2016 6:21 am

Re: Pets being aggro'd with no LOS

Postby ontheDOL » Thu Mar 23, 2017 4:29 pm

ahh yes i see it there now... and yes after i added the "true" to "AddToAggroList(npc, (npc.Level + 1) << 1, true); " to npc check sends the check thru and pet doesn't aggro through wall
- Unty -
Model Showroom and DOL guides
http://losojos-001-site1.btempurl.com
User avatar
ontheDOL
Developer
 
Posts: 311
Joined: Fri May 20, 2016 4:21 am
Location: Australian abroad

Re: Pets being aggro'd with no LOS

Postby tegstewart » Thu Mar 23, 2017 5:18 pm

I'm glad I brought this up, then. I know it's been a problem for a long time now.
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm


Return to “%s” DOL Development Discussion

Who is online

Users browsing this forum: No registered users and 1 guest