437 Commits

Author SHA1 Message Date
Kawe Mazidjatari
bb99cec2fe ImGui: remove extraneous code
No longer needed as we don't call the ImGui window procedure if no imgui surface is drawn.
2024-11-24 14:02:38 +01:00
Kawe Mazidjatari
6f534e9811 ImGui: readjust and fix imgui keybind configuration
In commit f5f14c153f0115af7a0ac5fe3b4be98b3816be84, a change was made to switch the default keys to pgup and pgdown. It appears however that these keys were used for the chat window.

The defaults have been adjusted to (backtick and f10) for console, and (insert and f11) for the browser.

There was also a bug in ImGuiConfig::Save() where it double nested the keyvalues, this has also been fixed. The keyvalue file now parser properly.

The option panel in the console has been slightly reworked to also show the secondary binding options for both the console als browser allowing the user to change both the primary and secondary for both windows without having to manually edit the files.
2024-11-23 00:09:21 +01:00
Kawe Mazidjatari
f5f14c153f ImguiSystem: change default keys
The home key should be reserved for console input as this is useful when running script code through the console, and needing to switch cursor positions to fix a typo or copy something. Page Up and Page Down weren't used and are less likely to be used by something in the game, remapped the defaults' secondary to these keys.
2024-11-17 03:09:03 +01:00
Kawe Mazidjatari
35f5c34190 Recast: use dtLink's traverse type getters
Small cleanup.
2024-11-14 02:53:19 +01:00
Kawe Mazidjatari
94c296561f Recast: remove commented off-mesh connection check
Off-mesh links should never make it into rebuildBVTree, there is also an assert for it to catch bugs if it happens. Removed commented code.
2024-11-13 14:05:34 +01:00
Kawe Mazidjatari
cb598e397d Recast: add option to limit portal creation between 2 polys to 1
The algorithm can create multiple portals of different traverse types between 2 specific polygons, this option allows the user to override this behavior by limiting this to 1.
2024-11-12 14:20:51 +01:00
Kawe Mazidjatari
24e731e4ee ThirdParty: upgrade l8w8jwt library to 2.4.0
Security fixes.
2024-11-12 00:10:46 +01:00
Kawe Mazidjatari
0806b10f79 Recast: delay sub-edge area calculation
Optimization by only calulcating it when its used to avoid calculating it for nothing when we end up moving to the next edge. This is only used when the link is established.
2024-11-10 14:28:10 +01:00
Kawe Mazidjatari
a6a4e76677 Recast: allow keeping unlinked polygons
The prune code will prune everything marked unlinked, but unlinked means that that polygon doesn't link to another, it doesn't mean its useless. Therefore, if we have an island that is unlinked, but still want to keep it, we should be to. The polygon should only be considered dead when its unlinked and disabled, which only happens through the prune tool. This allows for pruning and cleaning single polygon navmeshes.
2024-11-08 21:47:58 +01:00
Kawe Mazidjatari
7bd90f191e Recast: fix typo in dtHint struct
dtHint::triangle should be triangles as it can contain more than one triangle, renamed it to 'tris' to keep consistency with the rest of the code base. Also fixed its comment explaining what its size is.
2024-11-08 21:42:31 +01:00
Kawe Mazidjatari
a7086a600a Recast: add const qualifier to dtNavMesh::arePolysAdjacent 2024-11-08 20:08:12 +01:00
Kawe Mazidjatari
ff33a19b85 Recast: move triangle intersection code to shared
Light cleanup and reusability.
2024-11-06 21:37:07 +01:00
Kawe Mazidjatari
247a99765c Recast: add option to disable the filtering of neighbor slopes
This causes many problems in titanfall and apex maps due to the large voxel sizes we have to use to generate navmeshes. A single unwalkable voxel makes a large difference. disabling these feature results in much better results. The problems this test filters away can be fixed with setting proper cell heights in our case.
2024-11-06 14:44:06 +01:00
Kawe Mazidjatari
40cea14a49 Recast: return out early if we have no spans
All code below this will fail anyways as they rely on span count which can be null.
2024-11-06 14:28:49 +01:00
Kawe Mazidjatari
bef18681cf Recast: return out early if we have no regions 2024-11-06 14:27:11 +01:00
Kawe Mazidjatari
eb6692ab9e Recast: fix heap buffer overflow in partitioning code
Fixes https://github.com/recastnavigation/recastnavigation/issues/317. This can happen when we mave multiple spans in the X row. So far this crash only occured in Capitol City in Apex Legend's Worlds Edge map, where there are internal polygons in high rise buildings with 10 or more floors equally placed on top of another.
2024-11-06 14:24:14 +01:00
Kawe Mazidjatari
851ae9c75f Recast: fix typo in parameter name
After coordinate system conversion, this shouldb e X-Y.
2024-11-06 14:17:30 +01:00
Kawe Mazidjatari
c4cdbe38ce Recast: increase max span height bits
Increase to 29 bits for span limits, previously this was 13 and since the next field in the struct was a pointer, we end up using the 4 bytes padding so the struct size didn't increase. The reason for this increase is that rcSpan::smin and rcSpan::smax overflow when building a navmesh with a low cell height. This is especially an issue with maps that contain mountains. For the season 1 kings canyon map, the tiles containg the polygons for the firing range will be entirely flat due to the massive height difference between the base map and the firing range which resides under the map, causing it to be clamped to the previous MAX_HEIGHT value.
2024-11-05 02:06:06 +01:00
Kawe Mazidjatari
98ed726cb4 Recast: always start from north during traverse linkage
During new tests, not starting from the neighboring tile at north caused some smaller links to not establish, which is roughly 30 links in angel_city.bsp. This patch makes it always start from north without any alternation and yields the best results during all tests.
2024-11-03 16:52:01 +01:00
Kawe Mazidjatari
065150158a Recast: small optimization for traverse link algorithm
Only calculate edge directions and normals when we are sure this is going to get used.
2024-11-03 15:36:09 +01:00
Kawe Mazidjatari
3e7c7cb7da Recast: fix incorrect base side classification
rdClassifyDirection never got intercardinal sides causing it to be unreliable and inaccurate. rdClassifyPointInsideBounds and rdClassifyPointOutsideBounds are tested and confirmed correct during every case, switched use to rdClassifyPointInsideBounds instead and removed rdClassifyDirection for the start side of the neighbor tile lookup. For the links: the base side is always the opposite of the land side.
2024-11-03 15:33:44 +01:00
Kawe Mazidjatari
d0a8549dc9 Recast: change return type of tile side getters to unsigned char
Value will never be higher than 7 as we only have 8 sides (0-7). Avoids having to cast as dtLink::side is an unsigned char.
2024-11-03 15:21:25 +01:00
Kawe Mazidjatari
b4e7bb7886 Recast: never attempt link to the same polygon
Big optimization as you cannot link to the same polygon, you also cannot link to the same triangle. This drops polyCount number of iterations on polygons per tile.
2024-11-03 15:16:10 +01:00
Kawe Mazidjatari
7c3509fd34 Recast: add dedicated double-precission time type
The library used signed 32bit integers and single precission floating points to represent build times, but on long build times this will overflow. Added a dedicated time type while promoting it to double precission and adjusting all use cases throughout the library.
2024-11-03 12:25:11 +01:00
Kawe Mazidjatari
b41141018e Recast: run the full compass rose during traverse linkage
Go over each neighboring tile starting with the tile facing the edge normal, and then its oposite, and perform the same alternation on the next tiles. This link pattern gives the best and most consistent results by trying to link all sides equally. In order to guarantee maximum coverage, the link count multiplication has been increased from 8 to 32 per detail mesh bound as this new approach is creating an incredible amount of new links. Some of the links will end up not being used, but these will be removed during the prune stage.
2024-11-03 02:04:27 +01:00
Kawe Mazidjatari
1d994404d6 Recast: fix incorrect land-side classification for neighbor links
Out of bounds classification for land poly's edge must always be performed on the AABB of the base tile.
2024-11-03 01:57:43 +01:00
Kawe Mazidjatari
393944b064 Recast: major improvement to traverse link validation
- Portal kink point is now always offset twice the walkable radius to account ledge spans and center of hull to ledge, any extra is put on top with the default being 4.f to account for irregularities.
- Make sure we have enough clearance over the kink point and lower start point of the portal so that the NPC does not clip into overhead obstacles when performing an animation.
- Make sure we don't link a portal from underneath geometry by performing a raycast from the edge's mid point, and 2 additional ones if the link's span is larger than 100.f in world units.
2024-11-03 00:43:34 +01:00
Kawe Mazidjatari
4ea7c3ebfc Recast: add tile side wrapper
This allows for getting the direct side of a side by doing side-1, side+1, etc.. A useful case would be to get tiles at sides facing the normal of an edge on our own tile and doing anything with these tiles.
2024-11-02 21:00:21 +01:00
Kawe Mazidjatari
1e2c445cf3 Recast: remove unnecessary abs with epsilon check
Introduced in 2745f8b27c43b9c78c106e3dc278a2d1752fd7a5 but this is not needed.
2024-11-02 20:57:26 +01:00
Kawe Mazidjatari
7ee884b39c Recast: fix bug in cylinder intersect detection code
If there's no movement on the x-y plane between sp and sq, there will be no magnitude, and thus also no discriminant. The code however will continue as it only checks if discriminant < 0. Due to this, the code  will no longer take the origin and radius of the cylinder into account and that will cause any ray that extends above or below the cylinder to be a hit, regardless of where it was emitted from in the world. If we have no magnitude, we should always check if the start point resides inside the cylinder area on the x-y plane and determine from there whether to perform a vertical intersection test.
2024-11-02 20:46:51 +01:00
Kawe Mazidjatari
a229662a8e Recast: deduplicate epsilon constant
Value was identical to RD_EPS.
2024-11-02 20:11:00 +01:00
Kawe Mazidjatari
2745f8b27c Recast: use epsilon for vertical intersection tests
Take floating point precission into account.
2024-11-02 20:09:14 +01:00
Kawe Mazidjatari
b47b52dd08 Recast: optimize alignPortalLimits
Only calculate shiftAmount if we are going to shift the portal left or right.
2024-11-01 16:07:49 +01:00
Kawe Mazidjatari
e2197dd3fe Recast: fix typo in API documentation
Portal align can also be 0.5 but not higher.
2024-11-01 14:01:11 +01:00
Kawe Mazidjatari
bb140317c7 Recast: implement traverse portal alignment
Shift portal mins and maxs together to try and align the portals. The system is dynamic and will take portal span into consideration. Also slightly changed the API to implement an optimization by switching the directional vector of the edges to their normals as we only need the normals in traverseLinkInLOS, this avoids having to recalculate them.
2024-11-01 13:57:38 +01:00
Kawe Mazidjatari
2c5659164b Recast: improve rendering of poly edges on dead polygons 2024-11-01 13:28:58 +01:00
Kawe Mazidjatari
1d9d0ed6d6 Recast: constify 2024-10-31 19:29:42 +01:00
Kawe Mazidjatari
48aa2700fa Recast: remove extraneous polygroup check from traverse link algorithm
The static pathing data is either not built, or has to be rebuilt at this stage. If we have do happen to have dead polygons that we can use for traverse portals then we should leverage them to get as much coverage as possible.
2024-10-31 19:21:08 +01:00
Kawe Mazidjatari
582ecec038 Recast: do not connect adjacent polygons with traverse links
Connecting adjacent polygons with traverse links will cause pathfinding to run into itself infinitely if either of the 2 poly's first link references the polygon from which the traverse link originates from. The behavior in-game is that the AI become stuck in the area with error code FAIL_NO_ROUTE_BLOCKED. Implemented the method 'dtNavMesh::arePolysAdjacent' to make sure we never connect adjacent polygons on our own or neighboring tile with a traverse link.
2024-10-31 19:09:59 +01:00
Kawe Mazidjatari
ce14f2a150 Recast: only set bits corresponding to polygroup in traverse table
The table is fully nulled when allocated, resetting bits is not necessary.
2024-10-29 12:52:20 +01:00
Kawe Mazidjatari
64de9f6a48 Recast: use spherical extends to clamp off-mesh link to poly
The traversability of off-mesh links is not dictated by the walkable climb in this engine; an off-mesh connection can be higher from the ground due to ziplines.
2024-10-29 12:51:24 +01:00
Kawe Mazidjatari
3ca08ede1a Recast: rename off-mesh connection debug draw function
Force naming consistency.
2024-10-28 16:59:42 +01:00
Kawe Mazidjatari
8340951b9e Recast: move the off-mesh ref vert towards the clamped start vert
Must be moved as well rather than staying in place when the start point is clamped.
2024-10-27 02:28:01 +02:00
Kawe Mazidjatari
67c5145862 Recast: expose option to ignore input triangle winding order to user interface
Disabled by default.
2024-10-25 16:35:20 +02:00
Kawe Mazidjatari
0940ad3ce6 Recast: add option to ignore input triangle winding order
The mesh data from the game's BVH4 tree does not appear to have a fixed triangle winding order, making it nearly impossible to generate correct navmeshes while using the decoded BVH4 data. Fixing the sign enables us to generate the navmesh over the game's collision data properly rather than using the render mesh. This change does not appear to have a negative effect on the generated NavMesh.
2024-10-25 11:04:27 +02:00
Kawe Mazidjatari
ed9cd80034 Recast: fix generation of concave polygons
These changes seem to yield better results for the larger maps. The improvements are minimal however. This change is probably more noticable on tile cache.
2024-10-25 01:12:51 +02:00
Kawe Mazidjatari
6451405fba Recast: ensure polygon is always within bounding volume
In recastnavigation/recastnavigation@15ebb8bd25 the change was made to use detail polygons, but it appears that after this change, the bounding volume gets build under the polygons, especially if the polygons's Z are equal on all vertices. Flooring the mins and ceiling the maxs appears to yield correct behavior in all scenarios by making sure the bounding volume always encases its respective polygon.
2024-10-25 00:51:54 +02:00
Kawe Mazidjatari
563427ae63 Recast: add option to disable rendering of shape volumes 2024-10-25 00:40:40 +02:00
Kawe Mazidjatari
349f7bd3b9 Recast: move and rename render flags
Improve code readability.
2024-10-25 00:39:35 +02:00
Kawe Mazidjatari
d1c5228d23 Recast: add getter for area edge color
Also get the color for the edge per area type, previously we would still render a blue edge on a green trigger area.
2024-10-24 15:06:12 +02:00