topaz-next / topaz

💎 A server emulator for Final Fantasy XI.
GNU General Public License v3.0
56 stars 80 forks source link

[canary] Unable to see #2586

Open Chronos77 opened 3 years ago

Chronos77 commented 3 years ago

Additional Information (Steps to reproduce/Expected behavior) :

Sometimes i have an unable to see when i want to range. Some friends have the same when they start fighting a mob when we after we move it's ok

https://user-images.githubusercontent.com/1618002/107145740-e3c50f80-6943-11eb-8002-abaf66e98a93.mp4

Chronos77 commented 3 years ago

I bring a little more precision on this ticket. When I reported the problem, @zach2good you thought it came from the elevation and indeed I have the impression that this is it, because sometimes to hit the mob I have to be at the same elevation otherwise it puts me unable to see

TeoTwawki commented 3 years ago

has to do with the raycast being done form each entities feet, so the tiniest of bumps results in line of sight breakage and this is all but guaranteed on most slopes.

Note that I have this problem on retail but far less often (on retail I see it in east altepa trying to engage cactaurs)

zach2good commented 3 years ago

https://docs.unrealengine.com/en-US/API/Runtime/Navmesh/Detour/dtNavMeshQuery/raycast/index.html

Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the end position. This method is meant to be used for quick, short distance checks.

The raycast ignores the y-value of the end position. (2D check.) This places significant limits on how it can be used. For example:

Consider a scene where there is a main floor with a second floor balcony that hangs over the main floor. So the first floor mesh extends below the balcony mesh. The start position is somewhere on the first floor. The end position is on the balcony.

The raycast will search toward the end position along the first floor mesh. If it reaches the end position's xz-coordinates it will indicate FLT_MAX (no wall hit), meaning it reached the end position. This is one example of why this method is meant for short distance checks.

We should probably be doing a very vague distance check between the two points, and also filtering by Y distance (Z in FFXI land).

I haven't looked very close into it, but we might be able to use dtNavMeshQuery::findStraightPath to navigate a very skinny corridor towards the target: https://docs.unrealengine.com/en-US/API/Runtime/Navmesh/Detour/dtNavMeshQuery/findStraightPath/index.html

zach2good commented 3 years ago

Also, raycast isn't even cheap, it's just as expensive as short findPath or point validation

TeoTwawki commented 3 years ago

We should probably be doing a very vague distance check between the two points, and also filtering by Y distance (Z in FFXI land).

I haven't looked very close into it, but we might be able to use dtNavMeshQuery::findStraightPath to navigate a very skinny corridor towards the target: https://docs.unrealengine.com/en-US/API/Runtime/Navmesh/Detour/dtNavMeshQuery/findStraightPath/index.html

the current check was added to stop me from casting form behind minor obstacles/around corners. So we want whatever can give is a straight line with no further moves between 2 points as cheaply as we can. :+1: