Skip to content

Restore visual parity and optimize packet-only displays#3

Merged
Arbousier1 merged 59 commits into
masterfrom
codex/optimize-display-culling
Jul 14, 2026
Merged

Restore visual parity and optimize packet-only displays#3
Arbousier1 merged 59 commits into
masterfrom
codex/optimize-display-culling

Conversation

@Arbousier1

@Arbousier1 Arbousier1 commented Jul 12, 2026

Copy link
Copy Markdown

Summary

This PR restores the original visual behavior while reducing display-side packet and tick cost.

  • render legacy floating labels as packet-only TextDisplay entities with the original name-tag geometry and style, without real server-side TextDisplay or ArmorStand entities
  • preserve workstation/item behavior: fixed visuals use non-pickable display entities, while moving/result animations retain fake packet item entities, so visuals cannot duplicate inventory items
  • align Crafting Table, Crafter, Grindstone, Anvil, Smithing Table, Loom, Campfire, Soul Campfire, Lectern, Note Block, Beacon, Conduit, Spawner, Banner, Brewing Stand, Bee Hive, Bee Nest, and Jukebox behavior with the original plugin
  • preserve block occlusion for text and prevent Anvil/Jukebox item-name wrapping
  • reduce dynamic-label work with an O(1) viewer-position dirty check, a dynamic-only reverse index, two-tick movement coalescing, and one direct teleport packet per update
  • retain the existing opt-in rollout controls; behavior-changing performance switches remain disabled by default

Validation — current HEAD b3c2453

Local CI-equivalent validation passed:

  • .\gradlew.bat check shadowJar --no-daemon --no-build-cache --rerun-tasks
  • production JAR: 2,837,513 bytes, SHA-512 5EDBA1024120162F3B1B4EB82955742E249EDAC784932D71070A643820701D4D659B5990F931638A0A82DE172EA1E03303379D7D024522728D6918C65927DD23
  • three independent code reviews found no remaining definite P1/P2 issue

Minecraft 26.1.2 runtime/protocol checks

An isolated Paper gallery server plus a real protocol client verified:

  • Beacon, Conduit, Spawner, Banner, Campfire, Soul Campfire, Brewing Stand, Note Block, and Lectern labels are packet-only, have the complete legacy metadata profile, and leave no real TextDisplay / ArmorStand
  • all virtual spawn bundles close correctly, with initial metadata in the same bundle; no new plugin warnings/exceptions and no leaked observer
  • Bee Hive/Bee Nest use exactly the original four label positions:
    • (151.5, -51.25, 14.2), (151.5, -51.5, 14.2)
    • (153.5, -51.25, 14.2), (153.5, -51.5, 14.2)
  • bee labels retain scale (1,1,1), translation (-0.025,-0.225,0), fixed billboard, background/see-through/shadow behavior, and 200 px line width
  • moving dynamic labels update as a stable pair every two ticks using unbundled absolute teleport packets; a 25.5-second static hold emitted zero position packets
  • transformed fixed workstation visuals use display entities, while moving/result visuals use fake packet item IDs and are removed on close

The initial long-form Brewing Stand pass reached that scene after its potion fixture had completed, producing a fixture-only zero-label result. Replaying three potions with zero fuel against the same final JAR produced exactly one virtual legacy label and passed every protocol/cleanup check.

Performance smoke checks

On the isolated one-player gallery server:

Scenario TPS MSPT p50 / p95 / p99 / max Virtual packet result
Static, 60.017 s 19.9942 2.017 / 3.212 / 4.262 / 8.008 ms 0 known virtual packets; 0 teleports
Continuous motion, 60.070 s 19.9934 2.315 / 3.642 / 4.976 / 10.715 ms 1,211 virtual teleports; 20.826 known virtual ops/s

No tick exceeded 50 ms and the client remained connected without errors. These are diagnostic smoke measurements.

Fresh GitHub ABBA results on b3c2453

The four-run restart-isolated campaigns passed their merge gates:

  • total downstream TCP payload: 72.41% lower, paired bootstrap 95% CI 68.89%–75.52%
  • protocol spawn observations: 2,048 → 1,024 in both pairs (50% lower), with zero duplicate-live-spawn or destroy-without-live observations
  • mean MSPT: 48.32% lower, paired bootstrap 95% CI 46.81%–49.80%
  • p95 MSPT: 52.56% lower, paired bootstrap 95% CI 51.29%–53.80%
  • p99 MSPT: 60.12% lower, paired bootstrap 95% CI 38.45%–74.16%
  • p999 MSPT remained statistically inconclusive (3.51% estimate, CI -7.53%–13.42%), so no tail-latency improvement is claimed
  • observed TPS stayed effectively capped at 20 (A: 19.9979/19.9988; B: 19.9994/19.9998)

The deterministic Paper A/B suite completed 1,618/1,618 cases: cramping won 6/6 (minimum 1.397×), production visibility won 702/702 (median 7.831×), and production-range visibility won 102/102 (median 1.969×). The four-run ABBA campaigns are merge/smoke gates, not substitutes for a formal 12-run production campaign.

Rollout safety

The behavior-changing paths remain disabled in the bundled configuration:

Setting Default
Settings.Performance.VirtualItems.StaticAnchorDuringAnimation false
Settings.Performance.VirtualItems.PacketOnlyStatic false
Settings.Performance.VisibilityRateLimit.Enabled false
Settings.Performance.BlockUpdates.EventDriven false
Entities.Item.Options.VisibilityCulling.Enabled false
Entities.Item.Options.VisibilityRateLimit.Enabled false

GitHub merge gate — passed on current HEAD b3c2453

GitHub reports the PR as mergeable with no failing or pending required checks. It remains Draft only for the maintainer's final merge-state decision.

Copy link
Copy Markdown
Member

Phase 2 validation update

Implemented and pushed the three experimental paths, all default-off:

  • packet-only stationary item displays
  • per-player visibility token bucket
  • event-driven furnace/smoker/blast-furnace/beehive/bee-nest refresh

CI

Client compatibility smoke tests

  • 512 packet-only items: visual parity with the tracker-anchor baseline, 512 virtual spawn bundles, 0 Bukkit entity spawns, no ghost after clear.
  • 512 visibility-limited items: 512 queued / 512 drained; hide stayed immediate, full restore completed after the intended short wave.
  • World switch lifecycle: virtual items disappeared on unload, recreated on return, and cleared without ghosts.
  • Furnace, blast furnace, smoker, beehive and bee nest displays were checked in a real 26.1.2 client; front orientation and lifecycle remained correct.

Preliminary block-update comparison

30-second steady samples:

Mode checks plugin block-update time
legacy A1 300 68.674 ms
legacy A2 302 51.738 ms
event B1 8 4.383 ms
event B2 8 8.137 ms

This is 97.3% fewer block checks and 84.3–93.6% lower measured plugin block-update time. B1 also reduced mean MSPT from 4.115 to 2.921 ms versus A1, but B2 had to run with a 1 GiB heap after host native-memory pressure, so whole-tick MSPT is not treated as a valid paired conclusion.

Remaining merge gates

  • administrator-run PktMon wire capture
  • PresentMon FPS capture (current desktop session returns access denied)
  • formal same-heap, randomized ABBA rerun

Keeping the PR draft until those separate capture/compatibility gates are complete.

@TypeThe0ry TypeThe0ry changed the title Cull distant dropped item labels Optimize display hot paths with opt-in rollout controls Jul 14, 2026
@Arbousier1 Arbousier1 changed the title Optimize display hot paths with opt-in rollout controls Restore visual parity and optimize packet-only displays Jul 14, 2026
@Arbousier1
Arbousier1 marked this pull request as ready for review July 14, 2026 14:45
@Arbousier1
Arbousier1 merged commit 165edd6 into master Jul 14, 2026
4 checks passed
@Arbousier1
Arbousier1 deleted the codex/optimize-display-culling branch July 14, 2026 14:47
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.

2 participants