28 Commits

Author SHA1 Message Date
Kawe Mazidjatari
76ecbd8062 Recast: polish GUI layout
Make sure nothing clips outside the rects and make it look good.
2024-07-09 19:40:28 +02:00
Kawe Mazidjatari
f843c69672 Recast: properly render text over screen
Use the drawlist wrapper instead of relying on ImGui windows (which didn't work to begin with). Also fixed all text colors that weren't converted from the previous library.
2024-07-09 16:40:08 +02:00
Kawe Mazidjatari
e2c48c49db Recast: upgrade legacy ImGui implementation to 1.90.4 (WIP)
Major upgrade to newer library. This is still work in progress, there are many bugs.
2024-07-09 11:41:05 +02:00
Kawe Mazidjatari
4801435d42 Recast: fix disjoint poly group builder bug
The new mapping was never applied on the disjoint set, causing the indices to be off during traversal table building. Also made the initialization of the disjoint set the responsibility of dtCreateDisjointPolyGroups.
2024-07-08 15:40:24 +02:00
Kawe Mazidjatari
c64ebe12c2 Recast: fix incorrect renaming
Everything 'dtAlloc', 'rcAlloc', 'dtAlloc', 'dtFree', got renamed into 'rdAlloc', 'rdFree'. There were a lot of object allocators that used these suffixes which were not accounted for causing those to be renamed. Everything has been renamed back to their original names (excluding the actual rdAlloc/rdFree functions as these were supposed to be renamed).

No code logic was changed in this commit.
The accidental renaming was caused in commit fa8d89d287752782ebdd5d9563f04fa72ef0bee9
2024-07-07 17:25:42 +02:00
Kawe Mazidjatari
3fbe657577 Recast: implement static pathing logic in editor
The editor now takes the static pathing data into account when creating paths/testing the navmesh using the NavMeshTesterTool or CrowdTool. An option is made allowing you to select which traverse anim type you want to use for pathing (each of them uses a different traversal table, thus giving them different options as to which links and jumps they can take).

This allows us to test AI withing the editor itself, thus saving a lot of time shuffling navmesh files around and reloading them in-game.
2024-07-07 17:04:00 +02:00
Kawe Mazidjatari
c56e1cc801 Recast: reorder mesh params properties display
Move mesh above tile (mesh -> tile -> poly).
2024-07-07 01:51:55 +02:00
Kawe Mazidjatari
23703dcd2a Recast: display details about built/loaded navmesh 2024-07-07 01:13:35 +02:00
Kawe Mazidjatari
fc18050b29 Recast: use '0' as null poly group identifier
(unsigned short)-1 (65535) is technically a valid poly group. We also count from 2 as 1 is reserved for unusable poly's, and 0 was reserved kept reserved for simplicity so just use 0 as the null identifier.
2024-07-07 00:00:06 +02:00
Kawe Mazidjatari
d7235a799a Recast: light variable name cleanup
Enforce consistency
2024-07-06 20:02:37 +02:00
Kawe Mazidjatari
602fa7d1ec Recast: editor improvements
- Separate disjoint set and traversal table building code
- Use game types and data to determine what to build into the traversal tables (e.g., 5 traversal tables for _small and only 1  for the rest).
- Automatically initialize the editor using the _small navmesh parameters instead of the broken defaults.
2024-07-06 19:51:31 +02:00
Kawe Mazidjatari
94e2df9542 Recast: add option to render poly's by group id
Useful for debugging static pathing data.
2024-07-06 11:48:14 +02:00
Kawe Mazidjatari
4134cd9f42 Recast: use actual hull values of the game for navmesh generation
These values seem to generate navmeshes that are almost identical to Titanfall 2 single player navmeshes in terms of geometry calculations per navmesh size. Its likely these are the actual values used internally to create these.
2024-07-06 11:46:34 +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
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
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
e8398ea60c Recast: improve naming and documentation for static path build code 2024-07-04 17:18:08 +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
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
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
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
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
cc73d147fc Recast: implement off-mesh connection yaw angles and reference positions
Used by the engine for AI wall running, but also other AI logic like move direction. This probably is some cached ref pos + yaw to save on computation in the runtime, and probably used to lerp the AI to the correct direction before jumping. Current implementation seems very close to original navs now, though, the original navs appear to have some yaw angles being rotated a bit, probably manual adjustments to make the AI face a wall that isn't perpendicular.

Also implemented debug drawing for the new ref positions, and made the start circle of the off-mesh connection red, and the end position green to make it easy what is what in bidirectional connections.
2024-06-30 17:36:01 +02:00
Kawe Mazidjatari
fd3e227a86 Align folder structure with p4 2023-09-19 22:13:22 +02:00