3847 Commits

Author SHA1 Message Date
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
Kawe Mazidjatari
3511998837 Recast: fix sliced path finder bug
See https://github.com/recastnavigation/recastnavigation/issues/438
2024-07-02 01:20:55 +02:00
Kawe Mazidjatari
5a4a7d1181 Recast: fix stack buffer overflow in canRemoveVertex
See https://github.com/recastnavigation/recastnavigation/issues/508
2024-07-02 01:20:10 +02:00
Kawe Mazidjatari
b0c512151d Recast: fix XZ -> XY bug in NavMeshTesterTool
Height was set on the Y plane; changed to Z. Also adjusted a comment in dtPathCorridor::moveTargetPosition to reflect the same changes.
2024-07-02 01:19:13 +02:00
Kawe Mazidjatari
4373d32a3e Recast: remove cached dtQueryFilter pointer from dtNavMeshQuery
In the game engine, dtNavMeshQuery::m_queryFilter doesn't exist (the class is exactly 0x60 in size, and all members are confirmed and used. In CAI_Pathfinder, the next member next to m_navQuery is a static m_navFilter, which aligned perfectly against dtNavMeshQuery). Passing the filter in manually is also a better approach anyways.
2024-07-02 01:17:15 +02:00
Kawe Mazidjatari
ad44b3f010 Recast: variable name cleanup and improve documentation
Renamed variables to accommodate the XZ -> XY change. Also fixed a dead URL to point to an archived version to maintain documentation.
2024-07-02 00:59:17 +02:00
Kawe Mazidjatari
a99b9cc850 Recast: fix unflipped edge verts in mesh detail
Edge verts were checked to the incorrect ones in findEdge and overlapEdges, edge verts have been flipped. Also added note for tri flipping in rcMergePolyMeshDetails (this function is currently unused, but if it ever gets used, the note's should be confirmed).
2024-07-02 00:56:20 +02:00
Kawe Mazidjatari
288c36bd5e Recast: fix variable names in rasterizer
Column cell indices are obtained through xy now instead of xz, adjusted variable names.
2024-07-01 16:49:00 +02:00
Kawe Mazidjatari
a2d5d52dc4 Recast: fixup tile mesh building to avoid post transformation
Properly flip edge vertices during the build. This also reduces the final mesh size, and significantly reduced the reachability table size (static pathing).
2024-07-01 16:47:49 +02:00
Kawe Mazidjatari
bc94f59439 Recast: duDebugDrawGridXY cleanup
Renamed duDebugDrawGridXY_TF2 to duDebugDrawGridXY and removed the old implementation of duDebugDrawGridXY.
2024-07-01 13:24:43 +02:00
Kawe Mazidjatari
8b51403310 Recast: fix camera movement bug (XZ -> XY)
Up/down should be applied to the Z axis.
2024-07-01 13:23:06 +02:00
Kawe Mazidjatari
2896dc0d37 Engine: fix code bug when running "uiscript_reset" during init or load screens
Make sure this command cannot be executed before the UI VM is initialized or during load screens, doing so will hard crash the engine.
2024-07-01 01:30:01 +02:00
Kawe Mazidjatari
fea8603258 ImGui: add shortcut button for reparsing all scripts
The "Reparse all scripts" button reparses every script file, and reloads/reconnects the game.
2024-07-01 00:25:31 +02:00
Kawe Mazidjatari
a1bd8bd012 Engine: add reconnect logic and concommand for client
Allow the user to reconnect to a server by running 'reconnect', this also allows for reparsing all client side scripts while debugging the game on a dedicated server.
2024-07-01 00:20:03 +02:00
Kawe Mazidjatari
7ba2d2caf5 Recast: fix trailing extension delimiter on model names when loading .gset files
The code assumed an extension of 3 characters, but .gset is 4 and is also supported, causing a trailing '.' as it only truncates the training 4 characters (including the null char). The code now searches for the extension delimiter and gets the actual model name regardless of the length of presence of an extension.
2024-06-30 21:57:26 +02:00
Kawe Mazidjatari
6a57cea9ef Recast: save off-mesh connection reference positions and yaws to geometry sets
Allow storing and loading of additional off-mesh connection data (newly added for titanfall and apex).
2024-06-30 18:36:51 +02:00
Kawe Mazidjatari
1e9363f9eb Recast: draw poly centers 2024-06-30 17:42:46 +02:00