[core] ximesh files support [terrain type / limit widescan]#9686
[core] ximesh files support [terrain type / limit widescan]#9686WinterSolstice8 merged 1 commit intoLandSandBoat:basefrom
Conversation
03e1716 to
93f729d
Compare
054420a to
19a6454
Compare
zach2good
left a comment
There was a problem hiding this comment.
Excellent work here! (A million thanks to all the original authors and reference people too!)
| SOL_REGISTER("getTerrainType", CLuaBaseEntity::getTerrainType); | ||
| SOL_REGISTER("getFloorId", CLuaBaseEntity::getFloorId); |
There was a problem hiding this comment.
I'd probably name these currentTerrainType or getCurrentTerrainType etc., or I'd defer to the zone:
zone:getTerrainType(player:getPos()) etc.
Just to really hammer home what's going on - but any of these changes can come in later PRs
There was a problem hiding this comment.
Moved to zone bindings.
| player:setPos(54.84, -27.5, 16) | ||
| assert(player:getFloorId() == 15) | ||
| end) | ||
| end) |
There was a problem hiding this comment.
I'd probably want a couple more cases like for in Ronfaure, where our eventual scent testing will likely be tested - in the river and on the banks being different, etc.
There was a problem hiding this comment.
Added a couple positions in East Ronfaure river
| std::unique_ptr<CNavMesh> m_navMesh; | ||
| std::unique_ptr<ZoneLos> lineOfSight; | ||
|
|
||
| auto zoneMesh() const -> CZoneMesh*; |
There was a problem hiding this comment.
Is there any scenario where a zonemesh WONT be populated? Otherwise I'd push to return a reference here instead of a pointer. If the loading can fail or some zones don't have one, then we'd want to return a Maybe, so we enforce the null checking
There was a problem hiding this comment.
Is there any scenario where a zonemesh WONT be populated?
Right now we fail gracefully and let the load process continue as there are a couple naming issues we have to resolve but maybe we should back out early if the mesh doesn't load for any reason in the future.
I swapped it to Maybe for the time being.
| find_package(Threads REQUIRED) | ||
| link_libraries(${CMAKE_THREAD_LIBS_INIT}) | ||
|
|
||
| CPMAddPackage( |
There was a problem hiding this comment.
Does this mean we could get rid of our checked-in zlib stuff in the future?
There was a problem hiding this comment.
What we have in zlib.cpp isn't actually zlib, it's the FFXI custom Huffman table algorithm
00a542c to
f07e93b
Compare
Co-Authored-By: InoUno <774909+InoUno@users.noreply.github.com> Co-Authored-By: atom0s <atom0s@users.noreply.github.com> Co-Authored-By: Mike Murphy <6765305+xenonsmurf@users.noreply.github.com>
I affirm:
What does this pull request do?
Credits
I'll start with this because I legitimately can't claim credit for any of this, I am merely the plumber here.
Description
Wires in a new
CZoneMeshclass on CZone that loads, decompresses and prepares ximesh data for consumption.Exposes a general query API to get a cell information starting from world coords and a handful of helpers for terrain and floorId.
There's a lot of data in there which we are not using at the moment, such as barriers but they may come in useful when we swap LOS to use this.
I didn't port the raycast from xi-visualizer at this time.
Note that this introduces zlibstatic as a dependency.
Note that the zone_mesh.cpp code defers to Detour for
dtClosestHeightPointTrianglebut it is not a hard dependency,What this enables
!pos has been updated to display the information.
Memory
568MB usage for all zones on a single process
The key optimization is the deduplication done at load time to reuse blocks and packed everything tightly.
Perf
As a test I added
queryin the AI tick path to see how it would cope under future load. About 2us per call in most of my testing.Loading itself is around 100ms per zone
Steps to test these changes
xi_test has terrain tests.
Draft because there's a slight issue with a dozen zone name not matching the ximesh filename, need to fix that first.Added temporary rewriting of mesh filename for the few odd zones. Will work out the real fix in ximeshes repository at some point.