50 Commits

Author SHA1 Message Date
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
Amos
c7adefa56c Recast: update poly area's for MSET >= 7
These should be the poly area enumerants for MSET version 7 or higher.
2024-07-24 23:39:39 +02:00
Amos
ebfc4ec091 Recast: implement polygon cell generation algorithm
Fully generates polygon cells for the entire navmesh. Previously we never build this which caused ai to clip into, or walk into each other in-game (this system is an MSET 8 feature).
2024-07-24 11:30:00 +02:00
Amos
0269882bea Recast: temporarily comment out development code 2024-07-24 11:21:37 +02:00
Amos
2a45ced5f4 Recast: fix compile error caused by missed version checks 2024-07-24 10:26:41 +02:00
Amos
49a0ceb148 Recast: initial implementation of multi-set support
Allow to compile the editor for separate versions of the navmesh set. NavMesh cells are now also partially reversed and properly read out. Creating and writing them will happen in the future.
2024-07-22 18:48:41 +02:00
Kawe Mazidjatari
740c593197 Recast: setup off-mesh connections properly (WIP)
Titanfall navmeshes have the dtOffMeshConnection::userId field changed from unsigned into to unsigned short, and the lower half seems to be used for the jump types and (possibly) some flag. Work in progress implementation of the jump system on off-mesh links.
2024-07-18 17:00:31 +02:00
Kawe Mazidjatari
a7b1389e14 Recast: add tool to mark polygon by its ref 2024-07-18 00:59:39 +02:00
Kawe Mazidjatari
38f57d95ad Recast: several large improvements
The dtNavMesh structure members were marked as public, but they should be private. Made them private. Also, dtNavMesh::addTile was reconstructing all links, even when we add tiles with pre-existing links. The link building logic has been moved to a new member function 'dtNavMesh::connectTile'. This should only be called once the navmesh tile has been added succesfully during build. If we load a navmesh now, the existing links will be used from now on. The dtNavMesh::m_tileCount member is now also correctly incremented and decremented in addTile/removetile.
2024-07-17 17:51:01 +02:00
Kawe Mazidjatari
b3ce300338 Recast: properly split PCH between library and editor
Both were using the same PCH, but the recast library doesn't need anything from SDL or ImGui, properly split them apart and cleaned up includes.
2024-07-15 20:53:38 +02:00
Kawe Mazidjatari
5f90ea08f2 Recast: make all math helpers shared
There was an issue where Recast's common math library was less complete than that of Detour. Some common math operations were also isolated in specific translation units causing copies everywhere. All common math operations have been moved to the Shared library ultimately fixing all the above issues.
2024-07-15 19:27:55 +02:00
Kawe Mazidjatari
a99f3f3eb3 Recast: add option to adjust navmesh bounding area
User can now define where the navmesh will be build and what would be excluded in the map. Also adjusted some colors of existing bounding boxes to make them more visible. They weren't as visible as they used to be after the UX and rendering improvements.
2024-07-15 11:58:09 +02:00
Kawe Mazidjatari
0edf5c1717 Recast: add ability to offset Recast and Detour debug drawing
New ability to adjust it in all directions, recast and detour offsets are separate. By default, the Recast mesh renders 20 units from the input geom and Detour 30 units to avoid z-fighting.
2024-07-14 18:34:13 +02:00
Kawe Mazidjatari
fadb53cb46 Recast: fix tile tool not rebuilding static pathing data
Static pathing data is only build when the entire navmesh is build, but if an individual tile has been created, then the data isn't rebuild to accommodate the changes. Building code has been moved to the base class as it should be used for all tile editors, and is now also called from other code paths that require it.
2024-07-13 11:43:18 +02:00
Kawe Mazidjatari
727a4377ba Recast: reset poly mesh area flags after build
Flags are changed to game specific flags, but never reset after build causing the recast debug draw to be incorrect. Reset area flags to fix this issue.
2024-07-13 11:27:57 +02:00
Kawe Mazidjatari
dc5777145e Recast: properly implement poly debug text overlay
Properly implemented with toggles in the tile tool.
2024-07-13 01:43:01 +02:00
Kawe Mazidjatari
912a30610f Recast: fix regression causing tile size slider to not work
Regression was caused in commit f95eb13ab30c78c03c38aa20492389d0fdf39a7f. The m_tileSize member was moved to the base class as this allows us to run the navmesh type selector in the base class which is subclassed by all the other 3 editors. The member wasn't removed from the tilemesh editor class causing it to shadow the base class one.
2024-07-13 00:39:25 +02:00
Kawe Mazidjatari
b76f613bd7 Recast: double max clamp for tile size
Allow building larger tiles for test scenarios.
2024-07-13 00:34:48 +02:00
Kawe Mazidjatari
f95eb13ab3 Recast: tilemesh editor refactor
Move common code to Editor_Common and fix solomesh. Solomesh is useful for debugging recast as it allows for generating everything in 1 tile. Also did numerous fixes for the tilecache code, though this is still broken and won't be really used for the r5sdk project, but its nice to have for a potential project outside r5sdk that uses the xyz coordination system, which avoids having to run the navmesh through a conversion pass in runtime.
2024-07-12 13:01:47 +02:00
Kawe Mazidjatari
d38bdd1abd Recast: improve text and value representation on GUI
Small UX improvement.
2024-07-11 09:22:08 +02:00
Kawe Mazidjatari
63d85f0db5 Recast: some minor consistency changes
UI displays navmesh as NavMesh, changed it everywhere for consistency.
2024-07-10 11:13:06 +02:00
Kawe Mazidjatari
192f5dd326 Recast: rework render options
Also used flag approach for tilemesh rendering, previously you could only render one thing, or a hardcoded set of things at a time. Now you can toggle what you want to draw (e.g. the voxels and detail polys). Also moved all NavMesh drawing options to the NavMesh category instead of TileMesh, e.gm the BVTree drawing options. This patch also allows you to toggle the input mesh off separately from the NavMesh, which is useful for larger levels.
2024-07-10 11:06:50 +02:00
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