4034 Commits

Author SHA1 Message Date
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
Kawe Mazidjatari
74c0017c85 Recast: also draw off-mesh connection reference positions in editor mode 2024-06-30 17:42:32 +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
bff157bbb4 Server: add AI Hull enumeration
All AI hulls of the game
2024-06-30 16:12:53 +02:00
Kawe Mazidjatari
2b80341c51 Server: fix server entity structs
The sizes were correct, but some of the field offsets weren't. CBaseCombatCharacter also contained fields specific to CPlayer, these have been moved to CPlayer. CBaseCombatCharacter now aligns on all classes deriving from it (CAI_BaseNPC, etc..). Classes now align properly in the disassembler. Also added more static assertions to prevent mistakes.
2024-06-30 16:11:16 +02:00
Kawe Mazidjatari
b491abb5ec Recast: move pointers out of dtQueryData
A mistake was made thinking this was part of the struct, but the real change is that m_queryFilter is static in r5 rather than a pointer. Changing this in Recast is a big change however; reverted changes made in 1255629fcf5a0b0ca2140309ca891c79e2f24738 and 9049e61d34cb3f52627b8ca10f1b7da21e147ad9.
2024-06-27 14:41:18 +02:00
Kawe Mazidjatari
1255629fcf Recast: fix dtNavMeshQuery regression
pointers were also nulled during the memset after the move to the dtQueryStruct in commit 9049e61d34cb3f52627b8ca10f1b7da21e147ad9. Created dedicated 'Reset' method.
2024-06-27 13:35:13 +02:00
Kawe Mazidjatari
baa3d8f878 Recast: fix cmake debug options
Program is no longer called 'naveditor.exe', assigned to-debug program name to project name.
2024-06-27 13:21:22 +02:00
Kawe Mazidjatari
47a0b179cd Tier1: add xorstr tools 2024-06-27 11:08:40 +02:00
Kawe Mazidjatari
aa3e33a497 Engine: flip lump loading check
Make it more obvious what we are loading and what not (instead of checking if its client only, check if the server should load it since the client needs everything). This will also make sure that we never load other lumps even if they are present in the VPK or disk (they aren't for dedi builds).
2024-06-27 00:07:58 +02:00
Kawe Mazidjatari
2c94c9907d Tier0: extra malloc override constification 2024-06-26 00:37:36 +02:00
Kawe Mazidjatari
a2acc45c5e Tier0: remove extraneous memset in '_recalloc_base'
CStdMemAlloc::Realloc already nulls memory, no need to memset it.
2024-06-24 00:34:16 +02:00
Kawe Mazidjatari
ec44837022 Server: add static asserts for node graph structs
Make sure they don't change in size, else the AI node graph file becomes invalid.
2024-06-17 15:46:06 +02:00
Kawe Mazidjatari
4b67f4c27e Client: add reverse engineered Input interface
IInput and CInput interfaces reverse engineered.
2024-06-17 15:29:56 +02:00