4268 Commits

Author SHA1 Message Date
Kawe Mazidjatari
7c76248b70 Recast: fix typo 2024-08-12 17:21:21 +02:00
Kawe Mazidjatari
667a6509db Recast: update variable naming
More consistency.
2024-08-12 17:18:44 +02:00
Kawe Mazidjatari
ef0f9a7770 Recast: only check edge dir if slope threshold is exceeded
Prevents the creation of traverse links that run parallel with the edge when linking to poly edges from external tiles.
2024-08-12 16:35:12 +02:00
Kawe Mazidjatari
b585c96106 Recast: variable name cleanup
Adds a bit more description than "start" and "end".
2024-08-12 14:58:42 +02:00
Kawe Mazidjatari
fe3a2e93b2 Recast: dynamically look for specific neighbor tile depending on vert side
Instead of looping over and passing in neighbor tiles, look at which side our link start point is, and look for a neighbor tile on that side. This generates very clean traverse links, and also fixes the issue where the ai walks towards the opposite direction of where the target is before initiating a jump, as previously, jump links would be generated on any edge it finds. Also changed 'Editor::createTraverseLinks' to make it generate both external and internal links; starting with external ones, and filling internal gaps on the 2nd run before moving on to the next start tile.
2024-08-12 14:55:10 +02:00
Kawe Mazidjatari
a99984b0f3 Recast: support traverse links connecting to external tiles + major performance improvement
Now connect to neighbor tiles (still work in progress). Also moved poly overlap and raycast logic to separate functions. The raycast checks are now performed as a very last step as previously we would raycast, and then determine we can't establish the link because the traverse type was NULL or the distance was too great, which both could be checked before the raycast and are also a lot cheaper to check. Changing the order of checks significantly improved the performance.

Also fixed a bug in dtCalcLinkDistance, if the number exceeds 2550.f, it would overflow and cause links to be a lot larger. If the value exceeds the number now, it would return 0 and no link will be established.
2024-08-12 11:09:48 +02:00
Kawe Mazidjatari
4d2210d5e9 Recast: properly set tile and poly bits for MSET 5
MSET 5 uses the default Recast & Detour tile and poly bit configuration. MSET 7 or higher uses a different configuration to allow building navmeshes for the size's of Apex Legends maps.
2024-08-12 00:04:18 +02:00
Kawe Mazidjatari
a3fd5ba2f9 Recast: fix navmesh corruption when writing for MSET 5
MSET 5 must have this data before the traverse tables, this was forgotten during the refactor.
2024-08-11 23:14:08 +02:00
Kawe Mazidjatari
ba43a1ab72 Recast: several fixes for traverse link renderer
-1 is used by the game, and means only traverse links on the same polygon island. This has now been properly implemented. Also fixed a crash when enabling the "Traverse Links" Detour render option with no navmesh loaded.
2024-08-11 23:13:04 +02:00
Kawe Mazidjatari
40d07f09a4 Recast: set tile cell default height to tile's bmax
A more sane fallback value vs setting it to 0.
2024-08-11 22:11:52 +02:00
Kawe Mazidjatari
4e9cde3d22 Recast: fix off-mesh links not marking separate poly groups as reachable
Needs to happen after the remap!
2024-08-11 18:27:57 +02:00
Kawe Mazidjatari
8e69e6f400 Recast: mark poly islands connected through traverse links as reachable 2024-08-11 18:20:31 +02:00
Kawe Mazidjatari
ea38d4764a Recast: add traverse link filter for anim types
Add new filter + light cleanup.
2024-08-11 16:23:33 +02:00
Kawe Mazidjatari
6342266091 Recast: add option to dump all traverse link details at once 2024-08-11 13:38:10 +02:00
Kawe Mazidjatari
0a88d801a0 Recast: separate disjoint set remap code from creation code
We need to create the disjoint sets first, then build all traverse links, and finally from there determine all unlinked poly's and remap disjoint sets. Doing this prior to traverse link generation causes polygons that are only linked through traverse links to remain tagged as unlinked.
2024-08-11 12:54:48 +02:00
Kawe Mazidjatari
2bc4dc9c3f Recast: use the correct epsilon value
Seems to generate slightly better results with next to no extra performance cost.
2024-08-11 11:41:36 +02:00
Kawe Mazidjatari
50b982e733 Recast: fix more missed XZY -> XYZ comments 2024-08-11 11:32:25 +02:00
Kawe Mazidjatari
c4860cd1f1 Recast: more renderer cleanup 2024-08-11 11:32:10 +02:00
Kawe Mazidjatari
07f495e153 Recast: improve Detour rendering enumerant naming 2024-08-11 11:15:37 +02:00
Kawe Mazidjatari
fd587978b5 Recast: cleanup tile renderer 2024-08-11 11:09:39 +02:00
Kawe Mazidjatari
4c2f4e39a0 Recast: optimize and improve traverse link renderer
Only render the cross at the start as the reverse link will render the 2nd one. Else we render 4 crosses. Also made the alpha of the line around 50%, since we render the forward and reverse link, it will render with 100% opacity, if the reverse link is missing, the crosses will disappear and the line will only render at 50% opacity to make it more clear something is wrong.
2024-08-11 02:48:28 +02:00
Kawe Mazidjatari
cf2d873db3 Recast: set edge spans to maximum
Technically the bmin, bmax and side need to be calculated properly, but at the same time, we currently only do internal links, so it shouldn't matter a lot if at all.
2024-08-11 02:43:46 +02:00
Kawe Mazidjatari
3fade09920 Recast: add option to draw tile bounds 2024-08-11 02:42:35 +02:00
Kawe Mazidjatari
eac27efd22 Recast: add note regarding potential bug
Should most likely be RD_EPS.
2024-08-10 23:16:04 +02:00
Kawe Mazidjatari
279a86a2b1 Recast: implement rdClassifyPointInsideBounds
Classify a point within a navmesh tile. Will be used for internal traverse links.
2024-08-10 23:15:31 +02:00
Kawe Mazidjatari
929591d567 Recast: make classifyOffMeshPoint common
Will be used once jump links are generated between neighbor tiles.
2024-08-10 22:45:23 +02:00
Kawe Mazidjatari
5b375d0924 Recast: perform raycast tests before establishing traverse link
This results in very clean generation of jump links. Results are very close to Titanfall 2 single player navmeshes.
2024-08-10 01:45:48 +02:00
Kawe Mazidjatari
cad8f043e5 Recast: move traverse link generation logic to the Editor class
We need access to the input geometry and other intermediate data to properly generate them.
2024-08-10 01:37:49 +02:00
Kawe Mazidjatari
3090634cbd Recast: skip overlapping traverse links
If a traverse type can't overlap, but does overlap with a polygon, then don't add it. This fixes the issue where the jump links run flat over the navmesh surface.
2024-08-10 00:50:46 +02:00
Kawe Mazidjatari
66b493b6b7 Recast: fix bug in connectTileTraverseLinks
Use rdVsad instead of rdVmad. Need to add the vectors first before scaling it instead of scaling the second fector.
2024-08-10 00:49:40 +02:00
Kawe Mazidjatari
c36de0f02e Recast: add math function to perform scale after vectors are added
This is not the same as rdVmad.
2024-08-10 00:48:32 +02:00
Kawe Mazidjatari
66b5ae4084 Recast: initial implementation of traverse type lookup
Still heavy works in progress.
2024-08-09 20:49:30 +02:00
Kawe Mazidjatari
9462564761 Recast: check for poly intersection before creating traverse link
Don't generate if it intersects its own poly. Make sure it only links gaps.
2024-08-09 17:34:34 +02:00
Kawe Mazidjatari
52403f5161 Recast: fix typo (XZY -> XYZ)
Height axis = Z.
2024-08-09 17:32:55 +02:00
Kawe Mazidjatari
be69a8b533 Recast: make sure we always have 2 links before creating a traverse link
Need at least 2 links, one for the reverse link. Not adhering to this results in NULL reverse links which causes incorrect behavior in the renderer and in-game.
2024-08-09 16:11:26 +02:00
Kawe Mazidjatari
3ff36addbd Recast: clean up traverse link builder
Use existing math wrappers.
2024-08-09 14:41:16 +02:00
Kawe Mazidjatari
b63cb1d52c Recast: improve naming consistency for the traverse system
Traversal and traverse were mixed in variable/function naming. Forced consistency. No logic was changed this patch.
2024-08-09 14:35:47 +02:00
Kawe Mazidjatari
7cacc8ee03 Recast: fix static pathing build order
Traverse links should be build after the disjoint poly groups are created, but before the traverse tables are created. Previously, we created traverse links before disjoint poly groups causing isolated poly islands to be grouped under the same id.
2024-08-09 14:22:07 +02:00
Kawe Mazidjatari
d5ddaf3313 Recast: hook up traverse link dumper 2024-08-09 14:20:04 +02:00
Kawe Mazidjatari
c63061419a Recast: add ability to dump traverse link details
Detour dump utilities.
2024-08-09 14:18:33 +02:00
Kawe Mazidjatari
35b465d6c6 Recast: don't link poly edges facing the same direction
Only link them if they are perpendicular or facing the opposite direction.
2024-08-09 14:07:50 +02:00
Kawe Mazidjatari
1a393e6330 Recast: add helper function to calculate slope angle from 2 points 2024-08-09 12:49:11 +02:00
Kawe Mazidjatari
24e09b4b6c Recast: use edge mid point for distance calculation
Use the mid point which is the correct approach.
2024-08-09 12:48:05 +02:00
Kawe Mazidjatari
51eac9c91c Recast: add option to filter traverse links by distance 2024-08-08 19:52:28 +02:00
Kawe Mazidjatari
acaf4cf32b Recast: initial working implementation of traverse link generation algorithm
Traversing now works in-game, but there's still work needed to polish the algorithm and creating a proper lookup for jump types as currently only 1 jump type is supported.
2024-08-08 17:44:27 +02:00
Kawe Mazidjatari
c12690b33c Recast: use the constants 2024-08-08 16:02:16 +02:00
Kawe Mazidjatari
55c98902f3 Recast: optimize traverse link debug draw
Should be checked in the outer loop.
2024-08-08 15:46:24 +02:00
Kawe Mazidjatari
c4ac63ed69 Server: disable view punch by default
View punch on player in Hip is also disabled in retail apparently. Reflect behavior in SDK.
2024-08-08 14:32:21 +02:00
Kawe Mazidjatari
55c230aab8 Recast: remove jumpType from off-mesh links
Probably incorrect for MSET 5, null it.
2024-08-08 11:59:24 +02:00
Kawe Mazidjatari
848fbabc79 Recast: simplify quantization 2024-08-08 01:33:27 +02:00