4751 Commits

Author SHA1 Message Date
Kawe Mazidjatari
5ddc96dc34 Recast: allocate extra links for detail edge boundaries
We need more links as detail edges are used for traverse linking. Unused links will be removed during the prune stage.
2024-10-18 13:00:36 +02:00
Kawe Mazidjatari
4501581c6a Recast: fix several bugs in traverse link algorithm
- rdCalcSubEdgeArea2D could return false when tmin > tmax, which prevents the link from being established, but tmin can be larger than tmax when the detail edge equals the main edge. The issue we wanted to prevent where the triangle had an inverted winding order has been fixed in commit 1e48d8abd9e604a384e65cf633b62f4e11737d35.
- In dtNavMesh::connectTraverseLinks, the extraneous dot product check has been removed; this is now handled by the user installed dtTraverseLinkConnectParams::getTraverseType and dtTraverseLinkConnectParams::getTraverseType.
- In dtNavMesh::connectTraverseLinks, when we ran out of links in the land tile, we would still continue the traversal of all its detail edges and polygons. We now break out of all loops to move on to the next tile as we can not establish any traverse link when there are no free ones available.
2024-10-18 12:13:16 +02:00
Kawe Mazidjatari
2ed41d67ae Recast: render unconnected portal edges
Mark them bright red or blue (depending on the polygon group id).
2024-10-18 12:01:57 +02:00
Kawe Mazidjatari
6d41854ed2 Recast: mark unconnected portal edges as boundary edges
We can utilize this edge to create traverse links, which only happen on boundary edges.
2024-10-17 20:37:42 +02:00
Kawe Mazidjatari
af19a2e5b3 Recast: fix off-mesh connection user id's when loaded from project files
User id's were never assigned when the off-mesh links were loaded from project files.
2024-10-17 13:41:04 +02:00
Kawe Mazidjatari
1e48d8abd9 Recast: revert to post polygon transformation
In commit a2d5d52dc4e571388b9b86f21e40a5110a69665e, the logic has been adjusted to build the polygon in the right order in the algorithm itself, but some indices are incorrect causing bad tesselation. The issue is somewhere in RecastMesh.cpp, writing polygon indices in the incorrect order '0, 3, 2, 1' instead of '3, 2, 1, 0'.  Reverted to using "REVERSE_DIRECTION 0" for RecastMesh.cpp.
Additional notes, tesselation appears correct when building the mesh with the layered partitioner, monotone and watershed causes bad tesselation. The vertex order is however still incorrect.
2024-10-17 13:09:43 +02:00
Kawe Mazidjatari
a8b302f165 Recast: rewrite polygon island grouping algorithm
Flood-fill assign instead to make sure all polygon islands are mapped to a contiguous range of group id's on the first pass. This is required as we will otherwise reach the DT_MAX_POLY_GROUP_COUNT limit on complex and large geometry before the prune pass while we don't have DT_MAX_POLY_GROUP_COUNT polygon islands inside the navmesh. Also implemented poly group overflow protection and simplified the API.
2024-10-16 19:55:37 +02:00
Kawe Mazidjatari
d027621028 Recast: set new default rasterization and polygonization values
Defaults have been fine tuned and now generated much better results, especially in narrow area's such as small buildings and corridors. Previously, there usually were gaps in between door frames and tunnels.
2024-10-16 19:51:05 +02:00
Kawe Mazidjatari
d5116913d6 Recast: fix heap buffer overflow during link remap [ASAN]
Polyrefs may become invalid as we remove dead polygons and reindex the remainders. If the polyref is invalid, skip the link as it will be thrown out anyways. Issue was found using address sanitizer on level mp_rr_desertlands_64k_x_64k.
2024-10-16 19:43:17 +02:00
Kawe Mazidjatari
9b44b098f8 Recast: use DT_MIN_POLY_GROUP_COUNT for dtCalcTraverseTableSize
Use the actual constant instead.
2024-10-16 17:06:18 +02:00
Kawe Mazidjatari
5460427cda Recast: fix typo in comment (XZY -> XYZ)
This is the Z axis as we changed the coordinate system.
2024-10-16 16:50:24 +02:00
Kawe Mazidjatari
4a34481e43 Recast: implement tile update algorithm to prune all unlinked polygons
The algorithm goes over each polygon in the tile and only keeps polygons and associated data if they don't originate from an unlinked polygon island (DT_UNLINKED_POLY_GROUP). The algorithm also drops all data associated to the polygons such as the detail meshes, cells, links, verts and detail (if not used by other polygons), off-mesh links that are dead (not having the DT_POLYFLAGS_JUMP_LINKED flag), and rebuilds the BVTree.

This algorithm reduced the file size of a navmesh generated for the map mp_rr_desertlands_64k_x_64k by over 50% (209mb to 97mb) while keeping it functionally identical.

Some additional updates that were required to make this work:
* dtCalcTraverseTableSize now return NULL if there are 2 or less polygroups.
* unionTraverseLinkedPolyGroups will not run if parameters instruct it to collapse groups, it will also not run if the disjoint set doesn't contain any poly groups.
* dtCreateTraverseTableData will not allocate traverse tables if there are 2 or less polygroups, as dtCalcTraverseTableSize will now always return 0 in this case. This is an enforcement of an optimization from the engine itself as there is no point in allocating and doing lookups on a table with only 2 groups (unlinked and linked), and linked will always be reachable and unlinked can't be reached in the first place.
2024-10-15 17:25:14 +02:00
Kawe Mazidjatari
324e933c04 Recast: properly implement detail mesh edge renderer
Previous implementation was incorrect as it was trying to render triangles as lines.
2024-10-15 16:43:36 +02:00
Kawe Mazidjatari
f6e27b8b86 Recast: draw crosses in dark color if a reverse link is broken 2024-10-15 16:12:03 +02:00
Kawe Mazidjatari
272818ade0 Recast: remove cell height offset from poly mesh verts
The reason why the BVTree's appeared under the polygon was because we were rendering and calculating them incorrectly. After fixing this, they now appeared above the polygons. This offset is not necessary as it causes BVTree's to build incorrectly.
2024-10-15 15:43:49 +02:00
Kawe Mazidjatari
b5527cff5b Recast: increase cell height
32 seems to generate the nicest tessellation, way better and more consistent than the previous value.
2024-10-15 15:33:46 +02:00
Kawe Mazidjatari
136fc4ecf5 Recast: properly free data on shutdown
Editor::m_navMesh is always deleted in the base class, removed extraneous deletion from the tilemesh editor.
2024-10-13 21:39:12 +02:00
Kawe Mazidjatari
1491f6eaac Recast: default to watershed
Larger levels require watershed as some complex geometry (buildings with multiple floors) will exceed the maximum number of allowed sweep scans when building regions.
2024-10-13 21:38:04 +02:00
Kawe Mazidjatari
9f430a455e Recast: traverse over every tile in the array
dtNavMesh::getTileCount returns the total number of added tiles, the issue with this is that if the navmesh gets pruned, that means disabling unlinked polygons and removing dead tiles, then some tile instances in the m_tiles array may become empty. Less tiles will be installed and since there are null tiles in between, we won't be traversing each tile.
2024-10-13 21:36:46 +02:00
Kawe Mazidjatari
c9c687fc73 Recast: add bounds check for sweepscan indices
Only happens on extremely large and complex geometry.
2024-10-13 14:39:52 +02:00
Kawe Mazidjatari
248a652a15 Recast: add option for collapsing linked polygon groups
This is necessary for navmeshes with more than UINT16_MAX polygon islands. Building navmeshes for mp_rr_desertlands_64k_x_64k will hit this limit.
2024-10-13 14:36:09 +02:00
Kawe Mazidjatari
dedcf4f94f Recast: add >4GB file support for OBJ mesh loader
Needed for very large levels.
2024-10-12 01:49:49 +02:00
Kawe Mazidjatari
c0832b91d3 SDL: fix buffer overrun in SDL_strncmp
Always check len first before dereferencing the pointers.
2024-10-12 01:47:52 +02:00
Kawe Mazidjatari
d9432129b2 Recast: allow loading OBJ and PLY geometry from project files
Deduplicated mesh load function and implemented a simple type handler instead. Code can now load OBJ and PLY geometry from the user interface and project files.
2024-10-11 01:17:52 +02:00
Kawe Mazidjatari
b4b0e22d61 Recast: fix crash in prune tool when initiating NavMesh flood algorithm
dtNavMeshQuery::findNearestPoly can return an error flag, and the function cal also succeed while returning a NULL polyref. Both need to be checked before the algorithm is called. Also moved the memory allocation for flags inside this new check to avoid allocating for nothing.
2024-10-11 01:15:45 +02:00
Kawe Mazidjatari
dabedb2c8b ImGui: remove extraneous print 2024-10-08 23:24:13 +02:00
Kawe Mazidjatari
0db61d2244 Resource: remove old imgui layout config file during update 2024-10-08 23:09:28 +02:00
Kawe Mazidjatari
455b7220f9 ImGui: load and save imgui layout configuration from user cfg directory
Keep it separate from the system configurations.
2024-10-08 23:07:24 +02:00
Kawe Mazidjatari
3974ba70bb Tier0: separate launcher and imgui configs to user directory
Keep it separate from the system configurations.
2024-10-08 23:04:45 +02:00
Kawe Mazidjatari
3d2b15cde2
Merge pull request #130 from O-Robotic/p4sync
Fix GetFactorySystem not being exported
2024-10-08 17:33:18 +02:00
O-Robotic
db72a5c42e Fix GetFactorySystem not being exported 2024-10-08 13:18:45 +01:00
Kawe Mazidjatari
64a3832e24 Common: remove unnecessary patches
These patches are no longer needed; the server and client already have the fatal error flag removed (process continues instead of hard erroring since script errors aren't fatal to the engine). The server also has its own routine within the function so client code never gets called.
2024-10-07 20:32:07 +02:00
Kawe Mazidjatari
3d19fa95ff PluginSystem: move mod status file to mod base directory
A more suitable location. Unclutters the platform base directory and also makes it easier to find for modders.
2024-10-07 14:54:47 +02:00
Kawe Mazidjatari
e0e5232434 Public: mark BSP lumps required by the server
The server needs these lumps in order to work. Any other lump not marked as SV should not be packaged into server VPK's as this will increase the install size (the server never parses them, as it doesn't need to render light maps for example).
2024-10-07 14:52:32 +02:00
Kawe Mazidjatari
8356ac0351 Resource: update VPK build script
Add "mp_rr_desertlands_holiday", remove "mp_rr_desertlands_64k_x_64k_tt". "mp_rr_desertlands_holiday" is the same as "mp_rr_desertlands_64k_x_64k_tt", but the BSP originates from a later version of the game, and the map has been fully ported over to R5Reloaded rendering "mp_rr_desertlands_64k_x_64k_tt" redundant.
2024-10-07 14:50:22 +02:00
Kawe Mazidjatari
046c37f160 Engine: improve level pak unload logic
Only handle level related paks and data when we are processing the level pak (the 4th pak in the list).
2024-10-07 11:17:16 +02:00
Kawe Mazidjatari
e925f4cb6e Engine: fix level pak unloading crash
Changing the load/unload system to FILO caused a crash when loading 3 level paks, either through request load or level settings, and then unloading them in reverse order. This is a regression caused when the pak loading and unloading system was reworked. Changing the system back to FIFO fixes the issue.
2024-10-07 11:07:06 +02:00
Kawe Mazidjatari
ab0672126d Common: EULA accept check should always return true for dedicated servers
IsEULAUpToDate will always fail on dedicated servers as there is no user interface to display and accept the EULA (dedi's can also be ran without a terminal). The dedicated server users agree with the EULA upon launching the dedicated server.
2024-10-06 22:33:09 +02:00
Kawe Mazidjatari
7a62cf8c8b Tier2: only show message boxes if -nomessagebox isn't passed in
Typically for dedicated servers you don't want any message boxes as they hang the process. The '-nomessagebox' helps solve this problem. Also removed extraneous check on MessageBoxA in EngineLoggerSink, we should always terminate regardless if MessageBoxA fails or not. The error will always be logged anyways.
2024-10-06 22:29:22 +02:00
Kawe Mazidjatari
02ba900a18 Tier0: don't check on MessageBoxA return type during errors
Always terminate the process, MessageBoxA hangs the process anyways. If for some reason MessageBoxA fails then it will still terminate rather than continue and crash.
2024-10-06 22:13:58 +02:00
Kawe Mazidjatari
e551bb9e6f Tier2: check for user consent before submitting crash report
If the crash occurs during the initialization of systems, and Tier1 wasn't initialized yet, the system will display a prompt asking the user whether or not to send the reports. If the crash occurs after Tier1 was initialized, the system will check if the user has crash reporting enabled, and if the user has accepted the EULA before submitting it automatically.
2024-10-06 12:30:56 +02:00
Kawe Mazidjatari
130161128c Launcher: add notes about changes to unhandled exception filter
The engine executable has been patched to no longer install this, therefore this function will never be called as we install a vectored exception filter anyways. This solves the issue where the crash message application gets called more than once when a crash occurs before the SDK detours are initialized.
2024-10-06 12:28:43 +02:00
Kawe Mazidjatari
6de498e7ba Common: make IsEULAUpToDate globally accessible
Will be used for crash reporting as well.
2024-10-06 11:50:31 +02:00
Kawe Mazidjatari
7440e2d5da Tier1: add function for checking if SDK ConVar's are registered 2024-10-06 11:49:15 +02:00
Kawe Mazidjatari
59a904320e LiveAPI: update readme
Nesting depth was increased in commit b91fd983f9440f274330c6d2c3fdf42f7288700a
2024-10-06 11:48:38 +02:00
Kawe Mazidjatari
56b884c7ff Engine: remove duplicate forward declaration 2024-10-06 11:47:30 +02:00
Kawe Mazidjatari
ec3c670b2b Tier0: increment sigcache db version number
Force full rebuild on server and client.
2024-10-04 16:38:31 +02:00
Kawe Mazidjatari
79afdf08fe Recast: fix editor crash in prune tool
Always reset flags buffer as polygon references will no longer align with flags buffer on rebuild.
2024-10-04 16:04:55 +02:00
Kawe Mazidjatari
b91fd983f9 Server: light LiveAPI improvements
Increase nesting limit to 128, this should make sure it will always be enough while also making sure no infinite recursions occur. Also improved error print formatting.
2024-10-04 13:00:09 +02:00
Kawe Mazidjatari
ed62ebec9f Server: map IServerGameClients interface out
Not everything has been reversed yet.
2024-10-04 12:53:05 +02:00