Skip to content

recastnavigation-m 1.6.0.2: stable sorts, the same BV tree and contours on every platform - #1

Merged
Sunrisepeak merged 1 commit into
mainfrom
stable-sorts
Nov 15, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
stable-sorts

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

patches/0004: the BV tree and the contours' hole merging sort with std::stable_sort instead of the C library's qsort (not stable; glibc, macOS, the UCRT and musl order equal keys differently, so a mesh with ties had different bytes by platform). New test TiledHallTies pins the tiled mesh's bytes (0x3cfa3346e30b08f1) and a crowd on it (0x858c19b1c3879c98); without the patch wasm32 gave 0x396a14792154130e. Version 1.6.0.2.

…rs on every platform

dtCreateNavMeshData's BV tree (compareItemX/Y/Z) and rcBuildContours' hole merging (compareHoles,
compareDiagDist) sorted with the C library's qsort, which is not stable: glibc, macOS, the Windows UCRT and
emscripten's musl order equal keys differently, so a mesh whose BV items or contour holes and diagonals tie
(common on a grid) had different bytes by platform, and a crowd on it walked differently (a consumer's pinned
crowd hash failed on the Web and Windows rows only).

- patches/0004 (upstream-worthy): the five calls use std::stable_sort with the same comparators; a stable
  sort's order is fixed by the comparator and the input, the same everywhere. Pre-applied in upstream/;
  documents.json records both files' tarball and patched checksums and the patch.
- tests/navmesh_test.cpp: TiledHallTies, a hall tiled in four with a grid of pillars and four closed rooms,
  eight agents walked across it; the tiles' bytes pinned at 0x3cfa3346e30b08f1, the crowd at
  0x858c19b1c3879c98. Without the patch the tiles hash 0x3cfa3346e30b08f1 on Linux x86-64 (glibc) and
  0x396a14792154130e on wasm32-emscripten; with it both give 0x3cfa3346e30b08f1, in dev and release. The
  earlier mesh and crowd hashes are unchanged.
- mcpp.toml: version 1.6.0.2, the build comment on the stable sorts; READMEs.
@Sunrisepeak
Sunrisepeak merged commit 17911f6 into main Nov 15, 2026
8 checks passed
Sunrisepeak pushed a commit to mcpplibs/mcpp-index that referenced this pull request Nov 15, 2026
… platform (stable sorts)

recastnavigation-m mwrap-1.6.0.2 (mcpplibs/recastnavigation-m#1): patches/0004 makes the BV tree and the
contours' hole merging sort with std::stable_sort instead of qsort, which orders equal keys differently by C
library; a new test pins a tiled grid hall's bytes and a crowd on it, the same on every CI row. GLOBAL and CN
archives are byte-identical (sha256 7e08fd3902ca9e5e57d46151a8909b401bda5fd3bac1e106397b98391dd7f822). The
consumer test recastnavigation-path moves to 1.6.0.2 (its pinned hashes are unchanged).
Sunrisepeak added a commit to mcpplibs/mcpp-index that referenced this pull request Nov 15, 2026
… platform (stable sorts) (#800)

recastnavigation-m mwrap-1.6.0.2 (mcpplibs/recastnavigation-m#1): patches/0004 makes the BV tree and the
contours' hole merging sort with std::stable_sort instead of qsort, which orders equal keys differently by C
library; a new test pins a tiled grid hall's bytes and a crowd on it, the same on every CI row. GLOBAL and CN
archives are byte-identical (sha256 7e08fd3902ca9e5e57d46151a8909b401bda5fd3bac1e106397b98391dd7f822). The
consumer test recastnavigation-path moves to 1.6.0.2 (its pinned hashes are unchanged).

Co-authored-by: Sunrisepeak <speakshen@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant