From 069acd9aba710dc5908427b4bdab061d126ba3e4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 14 Oct 2026 00:19:43 +0200 Subject: [PATCH] Streaming: wait only for lower-ranked chunks that can be decorated A chunk in the decoration range whose diagonal neighbour falls outside the generation range never gets its 3x3 protos, so it must not hold back the higher-ranked chunks within two of it. Render distances 2, 5 and 12 load and keep loading while flying without stalling. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/streaming.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/streaming.rs b/crates/horizon-client/src/streaming.rs index 73637f284..eec4b9eeb 100644 --- a/crates/horizon-client/src/streaming.rs +++ b/crates/horizon-client/src/streaming.rs @@ -546,11 +546,29 @@ impl Streaming { }); } if self.decorates && self.decorating < workers * 2 { + // The generation margins below. + let (margin, reach) = (3, 2); let wants = |s: &Self, x: i32, z: i32| { !s.decorated.contains(&(x, z)) && !world.chunks.contains_key(&(x, z)) && (s.in_range(x, z, 2) || s.near_finished(x, z, 1)) }; + // A wanted chunk holds back higher-ranked ones only if it can be + // decorated: its 3x3 neighbourhood is (or will be) generated as + // protos, none of them already final. + let waits_for = |s: &Self, x: i32, z: i32| { + wants(s, x, z) + && (-1..=1).all(|dz| { + (-1..=1).all(|dx| { + let n = (x + dx, z + dz); + !world.chunks.contains_key(&n) + && (s.protos.contains_key(&n) + || s.generating.contains(&n) + || s.in_range(n.0, n.1, margin) + || s.near_finished(n.0, n.1, reach)) + }) + }) + }; let keys: Vec<(i32, i32)> = self .protos .iter() @@ -573,7 +591,7 @@ impl Streaming { } if self .decoration_order - .blocked(x, z, |nx, nz| wants(self, nx, nz)) + .blocked(x, z, |nx, nz| waits_for(self, nx, nz)) { continue; }