fix: reduce warmup ground-check timeout from 20s to 5s
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

The warmup loop waited up to 20 seconds for getHeightAt() to return a
terrain height within 15 units of spawn Z before accepting the ground
as ready. In practice, the terrain was loaded and the character was
visibly standing on it, but the height sample didn't match closely
enough (terrain LOD, chunk boundary, or server Z vs client height
mismatch).

Reduce the tile-count fallback timeout from 20s to 5s: if at least 4
tiles are loaded after 5 seconds, accept the ground as ready. The
exact height check still runs in the first 5 seconds for fast-path
cases where it does match.
This commit is contained in:
Kelsi 2026-03-31 01:27:32 -07:00
parent 5ad225313d
commit ea8b0d9305

View file

@ -5385,8 +5385,12 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
}
}
}
// After 20s, accept any loaded terrain (fallback for unusual spawns)
if (!groundReady && elapsed >= 20.0f) {
// After 5s with enough tiles loaded, accept terrain as ready even if
// the height sample doesn't match spawn Z exactly. This handles cases
// where getHeightAt returns a slightly different value than the server's
// spawn Z (e.g. terrain LOD, MCNK chunk boundaries, or spawn inside a
// building where floor height differs from terrain below).
if (!groundReady && elapsed >= 5.0f) {
if (auto* tm = renderer->getTerrainManager()) {
if (tm->getLoadedTileCount() >= 4) {
groundReady = true;