4268 Commits

Author SHA1 Message Date
Kawe Mazidjatari
62e5d28892 Recast: don't generate poly mesh cells without detail meshes
Must have detail meshes in order to generate these. Also removed unused local variable.
2024-08-21 14:55:01 +02:00
Kawe Mazidjatari
c8fc3f58d8 Recast: subdivision const correctness 2024-08-21 14:48:36 +02:00
Kawe Mazidjatari
8fce111502 Recast: fix BVTree calculations and rendering (XZY -> XYZ)
Should've been converted to the source engine coordinate system as well, but we missed this as then rendering thereof was 'fixed' incorrectly causing incorrect bounding volumes to appear correctly. Fixed the renderer and the calculation; the AI now never gets stuck in-game regardless whether 256 or 512 sized tiles are used.
2024-08-21 14:40:33 +02:00
Kawe Mazidjatari
5aff50f8cf Recast: add option to disable BVTree creation 2024-08-21 11:11:32 +02:00
Kawe Mazidjatari
dd9493d651 Recast: find the best traverse type rather than returning the first valid
Better results + slightly updated table to allow coverage on all traverse types again.
2024-08-21 02:45:32 +02:00
Kawe Mazidjatari
291ce4488a Client: fix push/pop style var mismatch
Since the table was taken out of the child instance in commit 245ff565042870e0cded7a2ec3dcc868a00414af, we should no longer handle the window and frame separately. Car count must now be counted together.
2024-08-21 02:26:48 +02:00
Kawe Mazidjatari
3a17d60182 Recast: don't add tiles tagged as userId=1
Engine behavior.
2024-08-21 02:24:59 +02:00
Kawe Mazidjatari
0b688c6807 Recast: implement neighbor extending logic in traverse link algorithm
Allow the user to specify how far to extend from the current tile towards the direction of the traverse link, this is useful when navmeshes with smaller tiles are generated as the neighbor lookup boundary for these are essentially bound to the tile size, thus smaller tiles will result in smaller links unless we extend to further neighbors.
2024-08-20 23:48:39 +02:00
Kawe Mazidjatari
1024f50c0c Recast: only link 2 polygons with the same traverse type once
Major improvement to generated navmesh, avoids duplicated links.
2024-08-20 22:22:43 +02:00
Kawe Mazidjatari
afbcd4d91b Recast: improve link offsetting code and add debug mode to tile tool
Add extra offset to dynamic calculation rather than after. And add debug option in the Tile Tool to debug tile LUT.
2024-08-20 19:14:40 +02:00
Kawe Mazidjatari
0b0a257ff1 Recast: fix compile error for MSET 5
Syntax error.
2024-08-20 10:56:49 +02:00
Kawe Mazidjatari
d2c287bef7 Recast: add options for traverse ray offsets 2024-08-20 10:56:21 +02:00
Kawe Mazidjatari
513f4a5297 Recast: many fixes regarding tile numbering
Reducing the tile size to 16 for all types completely eliminated the issue where an NPC in-game fails to find a steer poly after traversal (call to dtNavMeshQuery::findNearestPoly fails). Tile size of 16 causes correct tile numbering for world bmins and bmaxs. Also added 2 new sliders allowing the change of min and max tile bits + some additional cleanup.
2024-08-20 02:27:29 +02:00
Kawe Mazidjatari
34f81f035e Recast: add ability to fine tune and toggle traverse types
Added table that allows you to fine tune and toggle traverse types for all anim types and navmeshes. Also tweaked default values with newer fine tuned ones to improve link generation more. There's still a ton of fine tuning work left to be done.
2024-08-19 01:55:58 +02:00
Kawe Mazidjatari
245ff56504 Client: freeze server list detail columns
Keep the details column in display when scrolling.
2024-08-18 23:32:16 +02:00
Kawe Mazidjatari
016191878a Recast: add reverse engineered poly area and flags
Add new reversed flags, and properly handle poly flags per navmesh set version.
2024-08-17 23:56:52 +02:00
Kawe Mazidjatari
9c190cc7ca Recast: initialize tile cell occupy state
Initialize it in the file.
2024-08-17 22:58:59 +02:00
Kawe Mazidjatari
8977b6ce04 Recast: add more render options for tile overlay 2024-08-17 11:43:00 +02:00
Kawe Mazidjatari
00b8092d11
Merge pull request #123 from ttvmkos/patch-1
Add script convar for motd setting
2024-08-17 11:32:14 +02:00
R5 Mkos
5705aba459
Update vscript_client.cpp 2024-08-16 23:07:13 -04:00
Kawe Mazidjatari
4eb6965a84 Recast: only establish traverse link if navmesh supports it
Results in better and more correct navmeshes as super_spectre doesn't support all the types frag_drone has for example, use the mask table to determine whether to establish or not. Also added proper directives now to map the 19 and 20 types properly between MSET 5 and MSET 8.
2024-08-17 01:47:19 +02:00
Kawe Mazidjatari
5e7fd690c1 Recast: implement proper height fallback for mesh cell generator
Low res version of the firing range had 1 failure case, kings canyon had 10+. This typically happens if the cell is right on a poly edge. If getting the height from triangle fails, get it from detail edges instead. This fixes pretty much all failure cases with high accuracy (not as high as getting it from the triangle, but with only 10 failures on a map the size of kings canyon is more than good enough).
2024-08-17 01:43:19 +02:00
Kawe Mazidjatari
d4c3eb8dcc Recast: fix crash caused by traverse link table render selector
Out of bounds access caused when a navmesh is loaded with a smaller amount of tables than currently selected. Always reset the selector when loading/building.
2024-08-16 20:45:17 +02:00
Kawe Mazidjatari
a3e4191cae Recast: properly implement tile bounds renderer
Now properly calculates the heights
2024-08-16 20:38:40 +02:00
Kawe Mazidjatari
7ec6ab5b3f Recast: create method for getting actual tile bounds
Properly calculate the height of the tile bounding.
2024-08-16 20:38:09 +02:00
Kawe Mazidjatari
12e370e630 Recast: properly set land tile side in traverse linking algorithm 2024-08-16 20:33:56 +02:00
Kawe Mazidjatari
569598eae1 Recast: cache tile mesh header 2024-08-16 19:06:34 +02:00
Kawe Mazidjatari
14835d1e8b Recast: improve neighbor selection in traverse link algorithm
Instead of getting the opposite tile of where our vert is to create the largest links possible, get the nearest one instead. This gets rid of almost all unwanted noise.
2024-08-16 15:21:47 +02:00
Kawe Mazidjatari
c5f73f5af7 Recast: fix signed/unsigned mismatch 2024-08-16 14:13:38 +02:00
Kawe Mazidjatari
01507c0bd7 Recast: improvements to traverse type selection algorithm
Changed algorithm to use elevation instead of slopes and updated values to newer values which are still somewhat incorrect, but at least now we have full coverage on all types. Will need to be polished further. Also made the selector loop in reverse which causes way better and more coverage than starting from the start of the table.
2024-08-16 12:07:31 +02:00
Kawe Mazidjatari
ac0afa6aaa Recast: fix typo 2024-08-16 10:24:03 +02:00
Kawe Mazidjatari
763ea8fc93 Recast: also log the traverse link's elevation 2024-08-16 10:23:50 +02:00
Kawe Mazidjatari
e307d64048 Recast: always check edge direction
Should always be checked, linking edges that face the same direction causes the ai to perform unnecessary jumps and sometimes even causes it to clip into geometry.
2024-08-16 02:02:16 +02:00
Kawe Mazidjatari
ec1f72bf04 Recast: major optimization on Editor::connectTileTraverseLinks
Check if we have enough space for num new links before starting the complex calculations. This optimization saved 10+ seconds on the firing range and had no effect on the output results; the navmesh still hashed to the same value as the one build before this patch.
2024-08-16 01:21:49 +02:00
Kawe Mazidjatari
965647ae40 Recast: move on to next tile if all links are utilized.
Major performance optimization.
2024-08-15 23:57:57 +02:00
Kawe Mazidjatari
b1033b2367 Recast: traverse table and link generation improvements
Move internal edge link generation to separate loop, this results in way better jump link coverage on the navmesh, else we eat up all available links by the time a neighbor uses the tile again. Also did some improvements to the masks in s_traverseAnimTraverseFlags to better reflect coverage for each traverse anim type, this most likely could still use some work however.
2024-08-15 23:48:35 +02:00
Kawe Mazidjatari
1371c8db48 Recast: avoid division if not needed to optimize geometry raycaster
Slight performance boost as this function is very hot after the implementation of the traverse link algorithm.
2024-08-15 15:07:06 +02:00
Kawe Mazidjatari
c0ff0e6be9 Recast: implement per-traverse anim type disjoint set linking
Previously we handles each table the same. The updated algorithm now has a disjoint set for each traverse anim type, and selectively determines which poly's are reachable based on the link's traverse type connecting them. All left to be done here is making a correct lookup table, which is currently defined as s_traverseAnimTraverseFlags.
2024-08-15 14:47:05 +02:00
Kawe Mazidjatari
91d36cf007 Recast: properly tag unlinked poly's to disable them
In the future we actually want to get rid of unlinked polygons, see https://groups.google.com/g/recastnavigation/c/WLMRcDjsxFc for reference.
2024-08-14 11:59:19 +02:00
Kawe Mazidjatari
06b673dc84 Recast: rename constant
A more descriptive and correct name.
2024-08-14 11:34:07 +02:00
Kawe Mazidjatari
97ceae59e6 Recast: traverse linking code cleanup and improvements
Split traverse link creation and updating code from the editor, only alloc traverse table when we are creating them or when we load navmeshes that have them, don't alloc them before the navmesh is built. Also moved the disjoint set data to the editor class so we can cache the results and reuse them later after editing the navmesh post build. Traverse link algorithm now also ignores polys marked unlinked.
2024-08-14 11:30:43 +02:00
Kawe Mazidjatari
16fe32d8e5 Recast: rename rdPerpDirEdge2D and cleanup variable names
Enforce naming consistency.
2024-08-14 01:35:05 +02:00
Kawe Mazidjatari
d6ae135fd6 Recast: draw height point offset in traverse links
Show the actual kink from raycast point to actual link point.
2024-08-14 01:28:16 +02:00
Kawe Mazidjatari
1ae54c6b5b Recast: add method for obtaining edge normals in dtNavMeshQuery
2 new methods + some cleanup in existing getEdgeMidPoint methods.
2024-08-14 01:22:50 +02:00
Kawe Mazidjatari
41f830d6bb Recast: rename render option
Renamed to "Ledge Spans" as this is actually what it is.
2024-08-14 00:04:17 +02:00
Kawe Mazidjatari
3aaa3827c2 Recast: major improvements to traverse linking algorithm
* Properly calculate how much we need to offset from the navmesh's edge to account for the ledge span
* Properly check if the edge we are connecting to overhangs our lower link position.
* Check if our ledge span offset causes the link to clip into geometry, and skip linking if so.
* Removed an improper intersection test in 'Editor::connectTileTraverseLinks', which caused many false positives (all issues this fixes, have been fixed with the improved 'traverseLinkInLOS'.
* Removed extraneous 'CanOverlapPoly' check; all links can now overlap poly's without issues if they pass through the 'traverseLinkInLOS' test.
* Only perform offsetting calculation if we have an amount to offset.
* Split 'dtCalcLinkDistance' into 2 functions, one that calculates it and 'dtQuantLinkDistance' that performs the quantization.
* Removed incorrect and experimental code from 'dtNavMesh::connectExtOffMeshLinks', this was to test off-mesh links for MSET 5, but this wasn't the correct approach.
2024-08-13 23:47:33 +02:00
Kawe Mazidjatari
47bb578c03 Recast: add helper functions for ledge spans
rdCalcMaxLOSAngle: calculate max angle before LOS gets blocked.
rdCalcLedgeSpanOffsetAmount: calculate offset towards ledge to keep object in LOS.
2024-08-13 23:26:31 +02:00
Kawe Mazidjatari
3e7ca699e0 Recast: properly implement edge raycast offsets
The upper pos needs to be offset forward with at least the agent's radius since for jumps, we don't take the gap between the ledge and navmesh into account.
2024-08-13 01:30:22 +02:00
Kawe Mazidjatari
ee92ce8fe2 Recast: make InputGeom::raycastMesh const
Its parameters and the method itself can be const.
2024-08-13 00:51:51 +02:00
Kawe Mazidjatari
552dc98560 Recast: add functions for getting perpendicular edge directions
Will be used for the traverse link creation algorithm.
2024-08-13 00:49:57 +02:00