1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ServUO with Courageous' True LOS

Discussion in 'General Discussion' started by m309, Nov 10, 2014.

  1. m309
    Offline

    Admin Moderator ServUO Developer

    Joined:
    Mar 3, 2013
    Messages:
    1,243
    Likes Received:
    130
    • Two Thumbs Up Two Thumbs Up x 1
  2. Joshua
    Offline

    Joshua Member

    Joined:
    Sep 13, 2014
    Messages:
    422
    Likes Received:
    18
    Not to revive old topic but, did you ever get it working? like you mentioned, i rather merge and move on but if not i will attempt it
     
  3. Samuel Packham
    Offline

    Joined:
    Feb 1, 2014
    Messages:
    50
    Likes Received:
    2
    If you are playing on a shard with a small player base there is an easier way to implement a line of sight system that functions exactly like the courageous true line of sight. Simply edit three bools in PlayerMobile.cs. This may create lag on larger shards which is probably why it isn't widely used. Look for the three bools that override the Mobile CanSee bools starting somewhere around line 4000 and add a conditional statement that checks if the item is in sight and to return false if not. For example for the first bool override "public override bool CanSee(object o)" add the following:

    if (!InLOS(o)) //LOS
    {
    return false;
    }

    Repeat for the next two bools replacing the "o" above with the correct corresponding object references that deal with Mobiles and Items. You may have to add additional conditions that don't block items that are meant to be seen such as doors (if you block all items doors wont be visible until coming into LOS and it looks really weird when you can see the building but not the doors). I am at work and don't have time to look at the complete code I implemented but I hope this helps.
     
    • Thanks! Thanks! x 1
  4. Joshua
    Offline

    Joshua Member

    Joined:
    Sep 13, 2014
    Messages:
    422
    Likes Received:
    18
    Wow that does point me the right direction, I will test this method out to see if it will be acceptable. Thank you :)
     
  5. Samuel Packham
    Offline

    Joined:
    Feb 1, 2014
    Messages:
    50
    Likes Received:
    2
    I think there was one other place I had to add methods called "UpdateScreen" "CleerScreen" as well somewhere in PlayerMobile. I think I did this in the OnMove method somewhere. I can't say, but I will look when I get home.
     
    • Thanks! Thanks! x 1
  6. Joshua
    Offline

    Joshua Member

    Joined:
    Sep 13, 2014
    Messages:
    422
    Likes Received:
    18
    Sounds good :)
     
  7. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    180
    Likes Received:
    9
    Any further info on these edits, Id love to try this out rather than do the merge with the older LOS system (used it under runuo and had crashing problems)
     
  8. sahisahi
    Offline

    sahisahi Member

    Joined:
    Jan 13, 2016
    Messages:
    497
    Likes Received:
    13
    Hi, im testing the ''simple'' LOS that Samuel told us, this is what i added;


    Code (C#):
    1.     public override bool CanSee( Mobile m )
    2.         {
    3.             if (m is CharacterStatue)
    4.                 ((CharacterStatue)m).OnRequestedAnimation(this);
    5.          
    6.  
    7.     if ( m is PlayerMobile) //LOS
    8.         {        
    9.     if (!InLOS(m))
    10. {
    11.     ClearScreen();
    12.     InvalidateProperties();
    13. SendEverything();
    14.  
    15. return false;
    16. }   //LOS
    17.  
    18.  
    19.         }
    20.      
    21.             return base.CanSee( m );
    22.         }
    When a player hides behind a wall the console spam this;


    eeee.png

    And server freeze.

    What eable is it talking about? im lost :D

    This is what i found on Map.cs


    Code (C#):
    1.         private class PooledEnumerable : IPooledEnumerable, IDisposable
    2.         {
    3.             private IPooledEnumerator m_Enumerator;
    4.  
    5.             private static Queue<PooledEnumerable> m_InstancePool = new Queue<PooledEnumerable>();
    6.             private static int m_Depth = 0;
    7.  
    8.             public static PooledEnumerable Instantiate( IPooledEnumerator etor )
    9.             {
    10.                 ++m_Depth;
    11.  
    12.                 if ( m_Depth >= 5 )
    13.                     Console.WriteLine( "Warning: Make sure to call .Free() on pooled enumerables." );
    14.  
    15.                 PooledEnumerable e;
    16.  
    17.                 if ( m_InstancePool.Count > 0 )
    18.                 {
    19.                     e = m_InstancePool.Dequeue();
    20.                     e.m_Enumerator = etor;
    21.                 }
    22.                 else
    23.                 {
    24.                     e = new PooledEnumerable( etor );
    25.                 }
    26.  
    27.                 etor.Enumerable = e;
    28.  
    29.                 return e;
    30.             }
     
    #8 sahisahi, Jan 17, 2018 at 3:25 PM
    Last edited: Jan 17, 2018 at 4:15 PM
Similar Threads: ServUO Courageous'
Forum Title Date
Bug Reports War Cleaver - 1 handed on ServUO 2 handed on Real UO Yesterday at 2:19 PM
ServUO Discussion ServUO Code Cleanup / Project cleaning Tuesday at 9:56 AM
Archived Bug Reports LatestServUO Issue Jan 14, 2018
ServUO Discussion How to upgrade servuo version Jan 12, 2018
ServUO Discussion Implementation of SHA512 for ServUO shard Passwords Jan 9, 2018
ServUO Discussion Mobiles not Recognized as Mobiles by Steam on ServUO but works on RunUO...why? Dec 29, 2017
Archived Bug Reports Latest ServUO Crash Dec 25, 2017