3813 Commits

Author SHA1 Message Date
Kawe Mazidjatari
f989061e2d Tier0: drop SDK specific code for tools
Mathlib doesn't use some of the game-specific mutex stuff, but since our tools is now also including the mutex utilities, we have to block them out for _TOOLS as well.
2024-07-06 09:33:31 +02:00
Kawe Mazidjatari
a03603b0bd Tier0: define STATIC_TIER0
This fixes a bunch of linker errors when trying to use tier0 utility code in new projects while not utilizing the rest of the library. We don't need to export the CThreadMutex stuff as everything we build is static. Only the logging functions should be exported, these are therefore using DLL_EXPORT explicitly.
2024-07-06 09:31:35 +02:00
Kawe Mazidjatari
b5afdfe2f3 Recast: add more render options 2024-07-06 09:24:39 +02:00
Kawe Mazidjatari
601d958e14 Recast: invert render toggle flags 2024-07-06 02:20:17 +02:00
Kawe Mazidjatari
33b6d9e351 Recast: add new render toggle settings
Synced from Perforce.
2024-07-06 02:12:48 +02:00
Kawe Mazidjatari
025a23991f Recast: fix editor settings bug causing a crash
Make sure Sample Distance cannot be set lower than 1, doing so will cause crash in sampling code. Clamp between 1 and 16.
2024-07-06 01:57:03 +02:00
Kawe Mazidjatari
df1dfea806 Recast: add more documentation about traversal tables
Important notes for the future.
2024-07-06 01:56:01 +02:00
Kawe Mazidjatari
0a296c5a5f Recast: fix group merging bug in static path building
Don't merge poly islands under the same group id if there's an off-mesh connection linking the 2. The off-mesh connection polygon also gets its own group id now.

The reason we don't want to merge them is because not all ai can take the off-mesh link under on the same navmesh, and if we merge them the ai would still try and reach a goal poly it couldn't, causing it to become hard stuck on the poly island's boundary.
2024-07-05 22:24:54 +02:00
Kawe Mazidjatari
57484ee163 Server: reimplement Detour_IsGoalPolyReachable
The function is simple and everything for it has been reversed. Function has been rebuilt to make debugging easier, and confirmed to work as designed.
2024-07-05 18:02:56 +02:00
Kawe Mazidjatari
1a3f7b6bda Recast: rename reachability table to traversal table
The static pathing code is split into 2 elements, the disjoint sets (poly groups), and the traversal table (which links poly groups, visually known as poly islands) together through jump or offmesh links. Reachability covers more than just traversal in the context of this game engine, therefore it has been renamed to avoid future confusion.
2024-07-05 17:48:48 +02:00
Kawe Mazidjatari
44928a3c7c CMake: reorganize Recast & Detour projects
Move under "Thirdparty/Navigation".
2024-07-05 15:56:48 +02:00
Kawe Mazidjatari
20e0d0ee53 Client: add note for reconnect logic
Potential engine bug that needs to be fixed to allow reconnecting to listen server without killing it.
2024-07-05 15:56:07 +02:00
Kawe Mazidjatari
f2c64b390c DataCache: add note for future improvements
error.rmdl is in common.rpak but it should be in common_early.rpak.
2024-07-05 15:54:53 +02:00
Kawe Mazidjatari
cc2ed85847 Public: fix typo 2024-07-05 15:53:20 +02:00
Kawe Mazidjatari
568265a330 Server: refactor AI detour implementation
The current implementation was mixing several types with each other, making it hard to determine what a hull and what a navmesh type is. Code has been refactored to use the new types and names introduced in commit e638cc9323c7b74279f0274591264efc53c29d4d.
2024-07-05 15:52:43 +02:00
Kawe Mazidjatari
d2cf0ebac6 Server: create new hull types
Add reverse engineered hull types and globals in the SDK which will be used to debug and implement AI code in the future.
2024-07-05 15:49:57 +02:00
Kawe Mazidjatari
e638cc9323 Server: create new core NavMesh types
Create new types which will be used to refactor the current Detour implementation in the SDK.
2024-07-05 15:47:56 +02:00
Kawe Mazidjatari
089dddf2c4 Server: add note for finishing NavMesh hotswap implementation
this has to be done in the future to finalize this, for the time being, a workaround in scripts can be implemented using CodeCallback_OnNavMeshHotSwapBegin and CodeCallback_OnNavMeshHotSwapEnd (destroyingon begin, restoring on end).
2024-07-05 15:00:03 +02:00
Kawe Mazidjatari
4503543314 GameShared: render stray polygroups as red 2024-07-05 14:58:25 +02:00
Kawe Mazidjatari
ae29992284 Recast: remove packing directives from dtNavMesh
The size is 0x90 (confirmed from buf alloc at [r5apex_ds + F43425]). The packing caused it to be 0x8C in size due to missing trailing 4 bytes (which aren't used in the engine). Packing removed to pad it out to 0x90.
2024-07-05 10:40:16 +02:00
Kawe Mazidjatari
615f63d82a Recast: rename structure fields and add more documentation
A more consistent name with what has bee reversed so far. Also added documentation on what has been reversed entirely and as much information that i have about stuff that has been partially figured out.
2024-07-05 10:38:16 +02:00
Kawe Mazidjatari
2b16295d0e Recast: move implementation of alloc and assert to shared
Move the implementation as well, commit fa8d89d287752782ebdd5d9563f04fa72ef0bee9 was declaration (and some miscellaneous utility classes) only.
2024-07-04 20:36:04 +02:00
Kawe Mazidjatari
64fcdfb5f0 Recast: fix typo in documentation and improve naming again
Make parameter name more consistent with the rest of the library. No code logic was changed in this patch.
2024-07-04 20:31:31 +02:00
Kawe Mazidjatari
e8398ea60c Recast: improve naming and documentation for static path build code 2024-07-04 17:18:08 +02:00
Kawe Mazidjatari
e3bca38a0e Recast: fix static path builder bug and improve algorithm
Prior to this patch we only set poly's that are on the same group as reachable, but we never explicitly marked unlinked groups unreachable from each other, causing issues in-game where an AI is still trying to reach a goal poly that's on a completely separate island from the AI, causing the AI to become hard stuck on its current poly island's boundary.

The builder now also remaps all polygroups to a contiguous range of ID's, this optimization drops all gaps between the disjoint sets and thus results in a major drop in output file size (40mb navmesh is now a 15mb one with this optimization, while being functionally identical).
2024-07-04 16:43:10 +02:00
Kawe Mazidjatari
3c8dc10b50 Recast: improve code readability for calcStaticPathingTableSize 2024-07-04 13:32:38 +02:00
Kawe Mazidjatari
00ec2c41e2 Recast: use rdIntArray for dtDisjointSet
Recently made shared in commit fa8d89d287752782ebdd5d9563f04fa72ef0bee9
2024-07-04 13:32:04 +02:00
Kawe Mazidjatari
fa8d89d287 Recast: make assert and allocation code shared
All recast/detour allocation and assertion code were identical, with the exception of their names (rc* for recast, dt* for detour). We want to use Recast's rcVectorBase class in Detour code, as there is no Detour equivalent, but copying it in its whole isn't good practice (especially considering there is more boilerplate code we want to get rid of in the future). Moved these to Shared so Detour could use it as well under the name rdVectorBase (rd stands for Recast Detour). No changes to the logic of the code were made in this patch.
2024-07-04 11:32:56 +02:00
Kawe Mazidjatari
8b8e193348 Recast: remove extraneous field from dtDisjointSet
Just return the size of the vector.
2024-07-04 10:55:06 +02:00
Kawe Mazidjatari
1ac6f9be60 Recast: integrate static pathing generation/parsing code into editor
Instead of building the static pathing data when the NavMesh is getting saved, build it right after the NavMesh has been build. also, parse this data out from NavMesh files loaded from the disk. This patch also documented some extra features and designs. In the future, static pathing logic will also be implemented in the detour path query code.
2024-07-04 00:54:50 +02:00
Kawe Mazidjatari
1d202dc5b1 Recast: fix reachability table data truncation
Value should be multiplied by size of int.
2024-07-03 23:16:36 +02:00
Kawe Mazidjatari
f999c6ae6d Recast: split dtLink::flags into actual fields
Its split into 3 separate fields, this will be used in the future for fixing jump links between poly's.
2024-07-03 11:59:52 +02:00
Kawe Mazidjatari
d03dfe645f Recast: group all unconnected poly's (optimization & bug fix)
Reserve poly group ID 1 (defined as DT_STRAY_POLY_GROUP) for unlinked poly's. The game skips all poly's that are marked 1. Previously, before this optimization, the AI would become stuck when they walk over an island who's poly's are marked 1 as we didn't take this engine feature into account in Recast.

- Recast will now render all poly's marked 'DT_STRAY_POLY_GROUP' as red.
- This patch also reduces the number of poly group id's and therefore reduces the overall size of the NavMesh.
2024-07-03 11:55:24 +02:00
Kawe Mazidjatari
c215fcb220 Recast: fix incorrect reachability table buffer size calculation
Reachability table buffers were way larger than they should be due to an incorrect calculation of the buffer size. This bug fix reduced NavMesh sizes significantly (worlds edge '_small' was 200mb, and is now 20mb after this patch).
2024-07-03 10:45:44 +02:00
Kawe Mazidjatari
bff572659f Recast: enable reachability table building code
It was commented as it was offset with 4x4 bytes, this has been fixed and therefore reachability tables allocate properly in memory now.
2024-07-03 10:39:05 +02:00
Kawe Mazidjatari
aca1e7af96 Recast: invert button mapping for start/end pos of tester tool
Make the left mouse button set the start pos, and right mouse button (or shift + lmb) set the end pos.
2024-07-02 17:39:43 +02:00
Kawe Mazidjatari
59f6ea52dc Recast: optimize getPolyCenter
Copy the already computed poly center value (cached in dtPoly::center).
2024-07-02 17:35:20 +02:00
Kawe Mazidjatari
e3250fc53a Recast: make default cell size 16 units
Seems to result in the best NavMesh, and also seems to perform the best in-game with even better reliability than before.
2024-07-02 16:16:15 +02:00
Kawe Mazidjatari
ecedca82c7 Recast: show tile width and height as well on UI
Tile width and height is determined by m_tileSize*m_cellSize. Also removed an extraneous clamp on tileBits; value is calculated with an rcMin value of 16.
2024-07-02 16:14:58 +02:00
Kawe Mazidjatari
b7bca8e15c Recast: remove extraneous clamp for saltbits
Due to the change in 4ced95e2c111178a4127a663d95dc5c02e764d00, there are always 4 salt bits or less.
2024-07-02 16:12:56 +02:00
Kawe Mazidjatari
f8cac07da2 Recast: fix typo in UI button 2024-07-02 14:24:58 +02:00
Kawe Mazidjatari
4ced95e2c1 Recast: properly calculate tile and poly bits during build
Tile bits should be 16, and polyBits 28 - tileBits. This is also the reason why the 'm_saltBits < 10' check no longer exists in the executable.
2024-07-02 14:18:11 +02:00
Kawe Mazidjatari
97204c20dc Recast: light formatting improvements
Keep the style consistent with the rest.
2024-07-02 14:13:05 +02:00
Kawe Mazidjatari
105e48693a Recast: move DT_PI constant to DetourMath.h
DT_PI is used in many places, and each implementation defines its own with the same value. This is the start to factor that into 1 constant.
2024-07-02 14:12:11 +02:00
Kawe Mazidjatari
79e4e5b51f Recast: fix variable names
XZ -> XY renames.
2024-07-02 14:10:49 +02:00
Kawe Mazidjatari
5c6518a252 Recast: fix typo's in comments 2024-07-02 10:46:02 +02:00
Kawe Mazidjatari
2719b78708 Recast: fix typo's in comments 2024-07-02 10:45:07 +02:00
Kawe Mazidjatari
4e604ec261 Recast: fix typo's in comments 2024-07-02 10:43:39 +02:00
Kawe Mazidjatari
7c90262829 Recast: remove unused and incorrect code
Should no longer be used as tiles are now built correctly after the change in a2d5d52dc4e571388b9b86f21e40a5110a69665e
2024-07-02 01:28:58 +02:00
Kawe Mazidjatari
02aa7acd4a Recast: update dtNode parent bit counts
DT_NODE_PARENT_BITS has been changed to 19 in r2 and r5. All bit masks align 1:1 after this change. DT_NODE_STATE_BITS is confirmed to be 2 by r2's implementation of dtNavMeshQuery::isInClosedList. dtNode::flags is 3 bits as the bitmask constants compiled in after changing DT_NODE_PARENT_BITS, are identical for all enumerants of dtNodeFlags.
2024-07-02 01:24:46 +02:00