[SVN:r3254] LoS Check Manager

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Re: LoS Check Manager

Postby Leodagan » Thu Sep 19, 2013 8:43 am

Here are the ServerProperties I'm gonna use :

There is nothing about enabling or disabling this Manager, if it isn't used it won't be a lot heavier on the server (some empty cleanup loop at max)
Code: Select all
/// <summary> /// Line of Sight Manager Debug Level /// </summary> [ServerProperty("world", "losmgr_debug_level", "Set the Level of Debug for the Line of Sight (LoS) Manager (do not set level 3 in production), 0 = no debug, 1 = info, 2 = warn, 3 = debug.", 0)] public static int LOSMGR_DEBUG_LEVEL; /// <summary> /// Line of Sight Manager Cleanup Frequency /// </summary> [ServerProperty("world", "losmgr_cleanup_frequency", "How fast should the Line of Sight (LoS) Manager clean up its data (in milliseconds), don't get under 30000 ms, raise cleanup count if you put high number here.", 120000)] public static int LOSMGR_CLEANUP_FREQUENCY; /// <summary> /// Line of Sight Manager number of entries to Cleanup /// </summary> [ServerProperty("world", "losmgr_cleanup_entries", "Number of Entries cleaned from Line of Sight (LoS) Manager each Cleanup ticks, if you need to go above 10 000 entries consider using a shorter cleanup frequency.", 1000)] public static int LOSMGR_CLEANUP_ENTRIES; /// <summary> /// Line of Sight Manager Query Timeout /// </summary> [ServerProperty("world", "losmgr_query_timeout", "Timeout (in milliseconds) until Line of Sight (LoS) Manager tries to resend a LoS check, -1 to disable (don't get under 100ms except for Local Network).", 300)] public static int LOSMGR_QUERY_TIMEOUT; /// <summary> /// Line of Sight Manager PvP Cache Timeout /// </summary> [ServerProperty("world", "losmgr_player_vs_player_cache_timeout", "Set Timeout (in milliseconds) for PvP Line of Sight (LoS) Manager cache data, 0 to disable.", 200)] public static int LOSMGR_PLAYER_VS_PLAYER_CACHE_TIMEOUT; /// <summary> /// Line of Sight Manager PvE Cache Timeout /// </summary> [ServerProperty("world", "losmgr_player_vs_environment_cache_timeout", "Set Timeout (in milliseconds) for PvE Line of Sight (LoS) Manager cache data, 0 to disable. (Should be slightly above Brain Think timer to have any effect)", 1500)] public static int LOSMGR_PLAYER_VS_ENVIRONMENT_CACHE_TIMEOUT; /// <summary> /// Line of Sight Manager EvE Cache Timeout /// </summary> [ServerProperty("world", "losmgr_environment_vs_environment_cache_timeout", "Set Timeout (in milliseconds) for EvE Line of Sight (LoS) Manager cache data, 0 to disable. (Should be at least 2 times PvE cache to lower LoS Queries)", 5000)] public static int LOSMGR_ENVIRONMENT_VS_ENVIRONMENT_CACHE_TIMEOUT; /// <summary> /// Line of Sight Manager Player Check Frequency /// </summary> [ServerProperty("world", "losmgr_player_check_frequency", "Line of Sight (LoS) Manager will try to reduce player queries to this frequency (in millisecond), raise this if player are experiencing lags.", 100)] public static int LOSMGR_PLAYER_CHECK_FREQUENCY; /// <summary> /// Line of Sight Manager PvP threshold /// </summary> [ServerProperty("world", "losmgr_player_vs_player_range_threshold", "Line of Sight (LoS) Manager won't check LoS for players within this range. (Should be low to prevent abuses)", 32)] public static int LOSMGR_PLAYER_VS_PLAYER_RANGE_THRESHOLD; /// <summary> /// Line of Sight Manager PvE threshold /// </summary> [ServerProperty("world", "losmgr_player_vs_environment_range_threshold", "Line of Sight (LoS) Manager won't check LoS for mobs and NPC within this range. (Shouldn't be under default to prevent LoS flood)", 125)] public static int LOSMGR_PLAYER_VS_ENVIRONMENT_RANGE_THRESHOLD; /// <summary> /// Line of Sight Manager EvE threshold /// </summary> [ServerProperty("world", "losmgr_environment__vs_environment_range_threshold", "Line of Sight (LoS) Manager won't check LoS for Mobs vs Mobs within this range. (Shouldn't be under PvE Threshold)", 350)] public static int LOSMGR_ENVIRONMENT_VS_ENVIRONMENT_RANGE_THRESHOLD; /// <summary> /// Line of Sight Manager EvE Contamination /// </summary> [ServerProperty("world", "losmgr_max_contamination_radius", "Line of Sight (LoS) Manager will update LoS of Mobs/NPCs in this range of the checker if target is a Mob, and highest value used for contamination LoS updates.", 350)] public static int LOSMGR_MAX_CONTAMINATION_RADIUS; /// <summary> /// Line of Sight Manager PvE Contamination /// </summary> [ServerProperty("world", "losmgr_npc_contamination_radius", "Line of Sight (LoS) Manager will update LoS of Mobs/NPCs in this range of the checker, and highest value used for Player contamination LoS updates.", 250)] public static int LOSMGR_NPC_CONTAMINATION_RADIUS; /// <summary> /// Line of Sight Manager Pets Contamination /// </summary> [ServerProperty("world", "losmgr_pet_contamination_radius", "Line of Sight (LoS) Manager will update LoS of Player's Pet in this range of the checker, keep value low to prevent abuses.", 50)] public static int LOSMGR_PET_CONTAMINATION_RADIUS; /// <summary> /// Line of Sight Manager Player Contamination /// </summary> [ServerProperty("world", "losmgr_players_contamination_radius", "Line of Sight (LoS) Manager will update LoS of Players in this range of the checker, should be disabled to prevent PvP abuses.", 0)] public static int LOSMGR_PLAYER_CONTAMINATION_RADIUS; /// <summary> /// Line of Sight Manager Guards Contamination /// </summary> [ServerProperty("world", "losmgr_guard_contamination_radius", "Line of Sight (LoS) Manager will update LoS of Keep Guards in this range of the checker, raising this value will pack more Guards when Aggroing.", 200)] public static int LOSMGR_GUARD_CONTAMINATION_RADIUS; /// <summary> /// Line of Sight Manager Contamination Z-Factor in range checks /// </summary> [ServerProperty("world", "losmgr_contamination_zfactor", "Line of Sight (LoS) Manager Contamination will use this to lower or raise the Z checks when updating LoS checks. 0 = Z must be exact, 1 = Z range is radius.", 0.5)] public static double LOSMGR_CONTAMINATION_ZFACTOR;
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: LoS Check Manager

Postby Tolakram » Thu Sep 19, 2013 11:58 am

It's the client doing the "Third-Party" LoS check :p

I sent to Player.out.sendchecklos(Mob1.objectID, Mob2.objectID) and the client cast the ray for me then return the result...

I use client as cloud LoS computing :D

And Mob Brain are all subclass of Vincinity Brain which means they don't work without a client near them... and I need that client to make them work :)

Honestly it's been some day I'm thinking if a modified client couldn't load all regions in Wireframe and just cast Rays for my shard :D
That is damn cool, and either new information or the knowledge that this worked got lost somewhere. Very very cool.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: LoS Check Manager

Postby Leodagan » Thu Sep 19, 2013 12:48 pm

I did get the idea seeing StandardMobBrain...
Code: Select all
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) { //TODO change los check thisLiving.Out.SendCheckLOS (Body, living, new CheckLOSResponse(CheckAggroLOS)); if (!AggroLOS) return; } }
this Code use a Pet Player Owner to check LoS between his pet and the target ! Pet isn't a player, Target isn't a player, I thought this was natural to do third-party los checks ;)

Most other checks like Spellhandler use target or caster (either of one being GamePlayer), but after searching for this code example, I found KeepGuard code being much more like what I'm doing :
Code: Select all
if (target is GamePlayer) LOSChecker = target as GamePlayer; else { foreach (GamePlayer player in guard.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { LOSChecker = player; break; } } if (LOSChecker == null) return; LOSChecker.Out.SendCheckLOS(guard, target, new CheckLOSResponse(guard.GuardStartSpellNukeCheckLOS));
This code is old, and someone added a "try" to get a player in the Vincinity to do a third-party LoS check for guards ;)

There isn't any comments or explanations around Los Checks, so I understand this isn't "implicit"...
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: LoS Check Manager

Postby Leodagan » Thu Sep 19, 2013 7:10 pm

After some testing with the latest version with all feature implemented on live shard with 80+ players

My server load looks ok without debug (but still debug symbols) I don't want to turn debug when there is too much action ;)

The Load is even lighter sometimes, Threshold LoS check is a life savier on this, and for animist pet spam contamination is marvelous !

I need to change Keep Guard code to use this new class...

Memory usage seems a bit higher, but this was expected (Memory is cheap today we have to take advantage of this)

Maybe I'll have some ratio to adjust but i can begin to gather .patch file to request comments ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: LoS Check Manager

Postby Leodagan » Fri Sep 20, 2013 8:41 am

I'll begin to commit the "dependencies" of this piece of Code, I'm starting other updates I really need to know how far I am from core ;)

I'll start to add only piece of code that can't break anything...
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: LoS Check Manager

Postby Leodagan » Fri Sep 20, 2013 10:16 am

revision 3252 : Added all needed Code to make use of the Los Check Manager.

I didn't put the [Obsolete] handler on the previous LosCheck, if I migrate all "Core" los check to use the new property switch I will Obsolete this ;)

Will still need an update to ServerProperty to prevent this from failing compilation !

Expect revision 3253 soon...

Update : 3253 is committed with ServerProperties.
Update : 3254, I had forgot to send the update in ConsolePacketLib that implement an empty version of the new LosCheck.

This time I downloaded the SVN to another directory and tried a compile test !

Nothing will work around the LosCheckMgr as long as it's not instanced somewhere (for my tests I added it to Region.cs in a member) and the code areas where LosCheck are handled aren't updated with the serverproperty switch to handle both ways...
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: [SVN:r3254] LoS Check Manager

Postby Leodagan » Sat Sep 21, 2013 6:49 am

Known Bug :

When you make a LoS check that hits Cache or Threshold, the LoS Check Method will inline the "Notification" (it's called right inside this method)

So LoS check with cache or threshold can be considered "Blocking" as they won't exit until they have a record and they played the Callback you give them !

Need to find a way to defer the callback or "Thread" him (but that could be overpower...)

Any Idea how to do that ?

UPDATE : All los check in dol core made switchable (Server properties LOSMGR_ENABLE), I'll need to read that well before comit it, but in someplace I rewrited some checks so LOSMGR_ENABLE could not only modify the LoS checks but other behavior...

At least there is a switch ! (and some debug)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: [SVN:r3254] LoS Check Manager

Postby Graveen » Mon Sep 23, 2013 9:16 pm

A simple Timeout of 1s ? If timeout, LosCheck = no Los.
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: [SVN:r3254] LoS Check Manager

Postby Leodagan » Tue Sep 24, 2013 6:07 am

That's not what I meant, I mean that when there is a cache or treshold hit, the method checking for LoS will call directly the callback given for the check, so it won't "Notify" then do something else...

It will enter the callback for the LoS check and finish the execution until returning, I need some kind of forking, the method call the Notify in another thread and return before the execution of the callback...

For example when there is a cache hit on a NPC attack it will call the method "ContinueStartAttack()" before returning from the LoS check in "StartAttack()", I need something to return and let Callback run in background...
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: [SVN:r3254] LoS Check Manager

Postby Leodagan » Thu Sep 26, 2013 9:24 am

I used a RegionAction to Notify Objects without using the same thread as the one that asked for LoS check.

When going down into RegionAction code it looked like it use another thread to handle the Actions.

I hope this is a good way to do what I needed ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest