TrinityCore / TrinityCore

TrinityCore Open Source MMO Framework (master = 10.2.7.55664, 3.3.5 = 3.3.5a.12340, wotlk_classic = 3.4.3.54261, cata classic = 4.4.0.55262)
http://www.trinitycore.org
GNU General Public License v2.0
9.31k stars 6.01k forks source link

Core: Visibility distance calculation #22986

Open Killyana opened 5 years ago

Killyana commented 5 years ago

Description: The visibility distance calculation is wrong for gobs and creatures.

For this reason we get some weird result like this: https://imgur.com/a/88vi0XA and visibility distance is different from retail.

Visibility range: 100 - (Visibility.Distance.Continents) 170 - (Visibility.Distance.Instances) 533 - (Visibility.Distance.BGArenas)

visibilityDistanceType:

define VISIBILITY_DISTANCE_GIGANTIC 400.0f

define VISIBILITY_DISTANCE_LARGE 200.0f

define VISIBILITY_DISTANCE_NORMAL 100.0f

define VISIBILITY_DISTANCE_SMALL 50.0f

define VISIBILITY_DISTANCE_TINY 25.0f

The visibility distance must be calculated like this for gobs: Final Visibility range = Visibility range + radius of the gob + visibilityDistanceType

*visibilityDistanceType=0 the gob doesn't have any related data

Example: https://woehead.way-of-elendil.fr/?object=194484

This gob has: radius =200 visibility=200 and it' spawned into an instance so default view distance=170

This means final visibility distance= 200+200+170 =570m ( this is confirmed on retail)

For creature the radius could probably be ignored and just use this formula: visibility= visibilityDistanceType + default distance

This also explains the Tiny and small visibility distance used by some gobs.

Branch(es): both

TC rev. hash/commit: rev. 717e050edb73

xvwyh commented 5 years ago

For instances and battlegrounds these visibility distances are most definitely different. In SotA sniffs, when you arrive on boats, I saw objects with Gigantic AOI property (sigils, e.g. 192685) appearing as far away as 1450 yards, maybe even further. NPCs with Large AOI flag (23472, verifiable through CreatureDifficulty dumps Kinzcool posted recently) became visible as far as 1080 yards. One could make some sort of sniff analyzer that would read parsed packets sequentially, keep track of player's position, and record which objects became visible at what distance, which should allow us to reliably figure out the distances for all these different areas of interest.

Kittnz commented 5 years ago

Yeah, it's not really clear at this point. Who said there may not be a specific distance difference for a specific bg or instances?

Faq commented 4 years ago

Anything here left after https://github.com/TrinityCore/TrinityCore/commit/b0db728c49f0b70d2c4f18270c389e4445161b7f ?

Killyana commented 4 years ago

I still don't know how the visibility distance is calculated in instances, maybe unit visibility+200, without being able to test in retail, it's hard to say.

w5860363 commented 4 years ago

https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Object/Object.cpp#L1493

float WorldObject::GetVisibilityRange() const
{
    if (IsVisibilityOverridden() && !ToPlayer())
        return *m_visibilityDistanceOverride;
    else if (IsFarVisible() && !ToPlayer())
        return MAX_VISIBILITY_DISTANCE;
    else if (GetMap())
            return GetMap()->GetVisibilityRange();

    return MAX_VISIBILITY_DISTANCE;
}

Return after judgment? Please forgive my english

Kittnz commented 4 years ago

What do you mean @w5860363

w5860363 commented 4 years ago

@Kittnz Trying to find out why, because that's what happened last yea https://github.com/TrinityCore/TrinityCore/issues/21351

offl commented 3 years ago

Checking MoP+ sniffs and videos for visibility stuff is useless, they changed all values and they are no longer valid for 3.3.5 or even Cata. All we need is check distance from instance start to farthest created creature \ object from packets when player entered instance. And ignore creatures \ objects with not default visibility type. This way I checked Sethekk Halls and got 100 yards. Nothing like 170.

offl commented 3 years ago

SWP - 100 (434), both objects and creatures