diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dfd43300..98d5b9093 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -430,7 +430,7 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_float_log_parity.py - portable-mod: + jfr-analysis: if: github.event_name == 'workflow_dispatch' runs-on: [self-hosted, linux, horizon-game] steps: @@ -442,101 +442,7 @@ jobs: with: distribution: temurin java-version: '25' - - name: Compile original mod and test metrics - run: python tools/build_mod.py - name: Verify streaming JFR analysis against the JDK exporter run: python tools/test_jfr.py - name: Verify ZGC pause and allocation event interpretation run: python tools/test_jfr.py --gc zgc - - name: Build pinned portable packs - run: python tools/build_pack.py - - name: Measure isolated worker pacing on this platform - run: python -c "from tools.build_mod import benchmark_workers; benchmark_workers()" - - name: Measure isolated debounce queue polling - run: python -c "from tools.build_mod import benchmark_debounce; benchmark_debounce()" - - name: Measure wakeable idle queue latency - run: python -c "from tools.build_mod import benchmark_idle; benchmark_idle()" - - name: Measure object allocations with compact headers off and on - run: python -c "from tools.build_mod import benchmark_headers; benchmark_headers()" - - name: Test pack integrity and comparisons - run: python -m unittest discover -s tests -v - - name: Start recommended OpenGL macOS clients and verify framebuffer readback - if: runner.os == 'macOS' - run: | - python tools/test_client_graphics.py --native-display - cp dist/client-graphics-smoke.json dist/client-graphics-macos-title.json - python tools/test_client_graphics.py --native-display --world - cp dist/client-graphics-smoke.json dist/client-graphics-macos-world.json - - name: Compile the private dispatch fixture - run: python -c "from tools.build_mod import build_dispatch_fixture; build_dispatch_fixture()" - - name: Compile the private integrated-server graphics fixture - run: python -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('server-graphics', 'dev.horizonlab.metrics.ServerGraphicsIntegration', fixture_dependencies={})" - - name: Compile the private tick-manager state fixture - run: python -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('tick-state', 'dev.horizonlab.metrics.TickStateIntegration')" - - name: Compile the private terrain tick membership fixture - run: python -c "from tools.build_mod import build_tick_dedup_fixture; build_tick_dedup_fixture()" - - name: Compile the private culling whitelist fixture - run: python -c "from tools.build_mod import build_culling_empty_fixture; build_culling_empty_fixture()" - - name: Compile the private culling ray geometry fixture - run: python -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('culling-rays', 'dev.horizonlab.dispatch.CullingRayIntegration', ['entityculling'], ['CullingRayAccess'])" - - name: Compile the private terrain position lookup fixture - run: python -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('terrain-position', 'dev.horizonlab.dispatch.PositionIntegration')" - - name: Compile the private terrain quad reuse fixture - run: python -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('quad-reuse', 'dev.horizonlab.dispatch.QuadReuseIntegration')" - - name: Compile the private object-size agent and terrain quad fixture - run: python -c "from tools.test_quad_sizes import build_agent; from tools.build_mod import build_integration_fixture; build_agent(); build_integration_fixture('quad-size', 'dev.horizonlab.dispatch.QuadSizeIntegration')" - - name: Compile the private terrain read shutdown fixture - run: python -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('terrain-read', 'dev.horizonlab.dispatch.TerrainReadIntegration')" - - name: Install headless graphics libraries for applied-hook checks - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y xvfb libgl1 libegl1 libvulkan1 mesa-vulkan-drivers libasound2t64 libxkbcommon0 - - name: Verify integrated-server graphics report against the actual device - run: python tools/test_server_graphics.py ${{ runner.os == 'macOS' && '--native-display' || '' }} - - name: Exercise the applied dispatcher hooks and upstream rejection path - if: runner.os == 'Linux' - run: python tools/test_dispatch.py - - name: Verify applied tick membership transitions and allocation - if: runner.os == 'Linux' - run: python tools/test_tick_dedup.py - - name: Verify live culling whitelist registration and empty iteration - if: runner.os == 'Linux' - run: python tools/test_culling_empty.py - - name: Compare applied culling ray geometry and provider queries - if: runner.os == 'Linux' - run: python tools/test_culling_rays.py - - name: Verify actual full-data position lookup equivalence - if: runner.os == 'Linux' - run: python tools/test_terrain_position.py - - name: Verify actual terrain quad geometry and allocation - if: runner.os == 'Linux' - run: python tools/test_quad_reuse.py - - name: Measure actual builder and quad shallow sizes in both header modes - if: runner.os == 'Linux' - run: python tools/test_quad_sizes.py - - name: Verify interrupted DH reads and preserved shared futures - if: runner.os == 'Linux' - run: python tools/test_terrain_read.py - - name: Upload original mod and pack manifests only - uses: actions/upload-artifact@v4 - with: - name: horizon-linux - path: | - dist/*.mrpack - dist/horizon-*.jar - dist/worker-pacing-benchmark.txt - dist/debounce-queue-benchmark.txt - dist/idle-queue-benchmark.txt - dist/object-header-benchmark.txt - dist/dispatch-integration.json - dist/tick-dedup-integration.json - dist/culling-empty-integration.json - dist/terrain-read-integration.json - dist/culling-rays-integration.json - dist/terrain-position-integration.json - dist/quad-reuse-integration.json - dist/quad-size-integration.json - dist/server-graphics-smoke.json - dist/client-graphics-smoke.json - dist/client-graphics-macos-title.json - dist/client-graphics-macos-world.json - retention-days: 3 diff --git a/benchmarks/server-four-way-2026-10-19/README.md b/benchmarks/server-four-way-2026-10-19/README.md index 570f5bb24..7048c2743 100644 --- a/benchmarks/server-four-way-2026-10-19/README.md +++ b/benchmarks/server-four-way-2026-10-19/README.md @@ -131,8 +131,8 @@ average) and reached the ThinkPad over the tailnet. It ran with Paper's defaults except `connection-throttle: -1` in `bukkit.yml`. Every bot connects from one address, and the default throttle (4 s) refused all but the first. Paperclip patched the pinned server jar from its cache. Same Java and heap. -- Fabric + Lithium: the pinned server jar on Fabric loader 0.19.5 (`packs/fabric.lock.json`) with Lithium - `mc26.3-0.26.2-fabric` (`packs/mods.lock.json`, checked against its SHA-512). Lithium needs no Fabric API. +- Fabric + Lithium: the pinned server jar on Fabric loader 0.19.5 (`tools/benchmark-deps/fabric.lock.json`) with Lithium + `mc26.3-0.26.2-fabric` (`tools/benchmark-deps/mods.lock.json`, checked against its SHA-512). Lithium needs no Fabric API. Same Java and heap. The Paper and Fabric jars are dev-only downloads into `.local/server-bench/jars` and are never committed or diff --git a/docs/README.md b/docs/README.md index 00460d12d..26502148e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,6 +45,6 @@ To play, use [the launcher](../launcher/README.md); the project site is [playhor - [Collision geometry](collision-geometry.md): shapes, collision, movement and fluids. - [Face visibility](face-visibility.md): which model faces the mesher emits. -## The earlier Java track (no longer developed) +## Java comparison profiling -- [Java performance packs](java-packs.md), with [Vulkan on your Mac](vulkan.md), [collector comparisons](collectors.md), [profiling](profiling.md), [process memory](process-memory.md) and [tick state](tick-state.md). The Fabric server starter is retired: [host a server](hosting.md) with horizon-server. +- [JFR analysis for Java comparisons](profiling.md). diff --git a/docs/architecture.md b/docs/architecture.md index 99e9b630e..29e98f2e6 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -27,7 +27,7 @@ file selects ~103. | 10 | Launcher (124) | `launcher/src/` (`main.rs`, `backend.rs`, `cli.rs`, `mcp.rs`, `servers_page.rs`) | `cd launcher && cargo test`; `python3 tools/launcher_mcp_e2e.py` | | 11 | Mob types and species (117) | `L/mobs.rs`, `L/mobs/species.rs`, `L/mobs/data.rs`, `L/mobs/living.rs`, `L/mobs/drops.rs`, `L/mobs/gear.rs` | mob_attributes, entity_attribute, entity_death_loot, mob_ai | | 12 | Guests' actions on a server (98) | `G/lan_actions.rs` (`fn as_guest`, `fn tick_guests`), `G/lan_{attributes,pvp,chat,crafting,stations,trading,mount_menu,waypoints}.rs` | server_player_combat, server_player_damage, server_player_targets, lan_e2e (all) | -| 13 | Modpack porting, mod content (97) | `crates/horizon-port-pack/`, `L/mod_content.rs`, `tools/port_*.py`, `packs/` | `cargo test -p horizon-port-pack`; `python3 tools/mod_port_harness.py` | +| 13 | Modpack porting, mod content (97) | `crates/horizon-port-pack/`, `L/mod_content.rs`, `tools/port_*.py` | `cargo test -p horizon-port-pack`; `python3 tools/mod_port_harness.py` | | 14 | Mob AI (96) | `L/mobs/ai.rs`, `goals.rs`, `brain.rs`, `*_brain.rs`, `nav.rs`, `path.rs`, `control.rs` | mob_ai (probe `examples/mob_ai_probe.rs`; known failure on main: drowned_*, #290) | | 15 | Items and item use (96) | `L/items.rs`, `L/item_data.rs`, `G/hand.rs`, `G/consume.rs`, `G/potions.rs`, `L/effects.rs`; game.rs `fn use_hand`, `fn use_item` | use_item_on, item_use, item_use_lifecycle, consumable, consume_effect, status_effect | | 16 | Options and settings screens (93) | `L/options_ui.rs`, `G/options.rs`, `L/settings.rs`, `L/options_file.rs`, `L/graphics_ui.rs`, `L/graphics.rs` | options, toggle_keys | diff --git a/docs/benchmark.md b/docs/benchmark.md index 8bcc432e0..ca6c12e11 100644 --- a/docs/benchmark.md +++ b/docs/benchmark.md @@ -21,7 +21,7 @@ One game is started per window size (1280x720 and 1920x1080 by default) and rend - **Warm-up excluded.** Each scene's flight starts only after its chunks are loaded and drawn and 2 seconds have passed; the load itself is reported separately. JIT warm-up of the JVM during the first scene is part of vanilla's real behaviour and is not removed. - **The same statistics code.** Horizon returns its raw frame times (`horizon-ctl fly ... raw`) and the vanilla mod writes its own; `stats()` in the driver computes every figure for both. - **Vanilla as players run it.** Your own 26.3 client jar and libraries (as the official launcher installs them for your OS), the official launcher's default JVM arguments (`-Xmx2G` and its G1 options), Java 25. The game's assets index is not used, so neither game plays sound (Horizon runs with `HORIZON_NO_AUDIO=1`, vanilla with OpenAL's null device); textures, models and shaders come from the client jar as usual. -- **Performance mods.** `--game vanilla-mods` adds the Fabric builds for 26.3 of Sodium, Lithium, FerriteCore and ImmediatelyFast, the versions pinned with their hashes in `packs/mods.lock.json` (downloaded from Modrinth, never committed), plus Fabric API if one of them needs it. +- **Performance mods.** `--game vanilla-mods` adds the Fabric builds for 26.3 of Sodium, Lithium, FerriteCore and ImmediatelyFast, the versions pinned with their hashes in `tools/benchmark-deps/mods.lock.json` (downloaded from Modrinth, never committed), plus Fabric API if one of them needs it. ## Known caveats diff --git a/docs/collectors.md b/docs/collectors.md deleted file mode 100644 index 98b497328..000000000 --- a/docs/collectors.md +++ /dev/null @@ -1,48 +0,0 @@ -# Compare Java collectors - -Use the balanced pack first with the launcher's existing JVM policy. Java 25 -HotSpot supports explicit G1 (`-XX:+UseG1GC`) and ZGC (`-XX:+UseZGC`) selections; -the [Java command reference](https://docs.oracle.com/en/java/javase/25/docs/specs/man/java.html) -documents both. A collector choice can change CPU, heap headroom, collection -behavior and frame pacing. Lower pauses alone do not establish lower RAM or -higher FPS. The packs do not automatically select a collector. - -For a Mac comparison, duplicate one instance. In Edit > Settings > Java, enable -the Java Arguments override checkbox. Preserve existing non-collector arguments, -but use exactly one collector selector in each instance. Choose G1 in one and -ZGC in the other. Use the same native Java 25 ARM64, maximum/minimum heap, compact -header setting, world copy, resolution, shaders, distances and warmed camera route. -Alternate at least three 120-second runs rather than comparing unrelated captures. -Remove the explicit selector to restore the launcher's policy, then restart. - -The viewer shows the actual collector names captured by the game. Check them: -setting a launcher's text field does not establish which flags reached the VM. -Prism's per-instance Java Arguments and Memory settings have separate override -checkboxes. A global collector selection may need removal or replacement when -creating an explicit per-instance experiment. - -Record FPS, slowest-1% rate, frame spikes, heap and process RSS together. RSS does -not represent all shared GPU memory on Apple Silicon. `gc_time_ms` sums collector -MXBean counters; concurrent cycles and overlapping phases can contribute, so it -is not a measured pause total. Use JFR root pause events for pause analysis. -The streaming reader is checked against the JDK's event exporter with both -default-GC and ZGC fixtures in CI on Windows, Linux and ARM macOS. - -The developer demo launcher accepts `--gc default`, `--gc g1` or `--gc zgc`. -For example: - -```sh -python3 tools/runtime.py demo --instance .local/runtime/collector-test --heap 6G --gc zgc --compact-headers -python3 tools/test_jfr.py --gc zgc -``` - -Prepare demo mods/worlds before comparing. -Options affect only the launched process; they do not change global Java settings. -The collector and compact-header experiments can be tested independently. - -A local 3 GiB, compact-header ZGC client completed a 120-second game recording. -That recording also encountered a distant-terrain rejection storm. Its workload -and cache history differed from G1 captures, so the larger memory footprint and -different frame rate cannot be attributed to the collector alone. The dispatcher -experiment addresses the identified retry loop separately. No M2 collector -performance winner is established. diff --git a/docs/performance/java-perf-mods.md b/docs/performance/java-perf-mods.md index 62aab88a1..0ded82048 100644 --- a/docs/performance/java-perf-mods.md +++ b/docs/performance/java-perf-mods.md @@ -49,7 +49,7 @@ Source: [FerriteCore's summary of its changes](https://github.com/malte0811/Ferr | String deduplication in model locations | Duplicate `String`s from the constructor's round-trips | No `ModelResourceLocation` objects, so the round-trip doesn't exist | **n/a** | | Partly loaded chunk NBT kept between loading steps | The whole tag is kept | Chunks are decoded into Horizon's own structures | **n/a** | -Horizon's process memory is tracked against vanilla in `docs/process-memory.md`. +Horizon's process memory is tracked against vanilla in [comparison benchmarks](../benchmark.md). ## ImmediatelyFast (client draw submission) diff --git a/docs/process-memory.md b/docs/process-memory.md deleted file mode 100644 index 34058237c..000000000 --- a/docs/process-memory.md +++ /dev/null @@ -1,53 +0,0 @@ -# Measuring resident process memory - -Horizon 0.6.0 records process RSS alongside JVM heap and nonheap pools. RSS -counts resident pages belonging to the Minecraft process, including native -allocations and mapped pages. It helps detect cases where reducing heap use -merely moves memory elsewhere. It is not unique physical-memory ownership or -a complete accounting of GPU allocations, shared pages, compressed memory, -swap, or Apple Silicon unified memory. Do not add heap to RSS: heap pages can -already be included in it. - -Minecraft 26.3 already ships OSHI 6.9.0 and JNA on both client and server. The -original mod uses those dependencies without embedding them. Native reader -initialization and refresh happen on a low-priority daemon thread, never on -the render or server-tick thread. One reader serves overlapping frame and -tick recordings. Reads run about once per second only while recordings are -active; the scheduler stops polling when the last recording finishes. Ordinary -gameplay without a benchmark performs no resident-memory reads. - -Reports include these optional schema-1 fields: - -| Field | Meaning | -| --- | --- | -| `process_rss_peak_sampled_bytes` | Largest successful resident-memory sample during this recording | -| `process_rss_last_sampled_bytes` | Last successful sample, which can precede recording completion | -| `process_rss_samples` | Number of successful samples delivered to this recording | -| `process_rss_sample_interval_ms` | Requested 1,000 ms interval; reads can take longer | -| `process_rss_last_sample_age_ms` | Time from the last successful sample to report completion | - -Unsupported or failed reads leave these fields absent if no sample succeeded; -zero is not used as a substitute. Frames and ticks continue recording. A read -that completes after a recording finishes is ignored. Sampled peaks can miss -brief spikes, and the initial read can be delayed by native-library startup. - -The offline viewer compares RSS separately from heap/nonheap and warns about -stale resident samples. Keep recording duration, workload and warm-up matched -when comparing peaks. Process CPU counters cover the whole process over the -recording wall time, including native work and the integrated server; they do -not identify which thread or mod caused CPU use. - -`gc_time_ms` sums collector MXBean collection-time counters. With concurrent -collectors these can include cycle duration and overlapping phases; it is not a -direct stop-the-world pause measurement. The viewer calls it collection time. -Use [JFR pause events](profiling.md) when investigating GC-induced stalls. - -A three-pair heap experiment compared 3 GiB and 1.5 GiB -maximum heaps with the same core stack. It recorded variable RSS savings, nearly -unchanged average FPS and increased GC accounting; playable defaults stayed -unchanged. - -The native-read test exercises the real library, overlapping recordings, -background execution, idle cancellation and unavailable-reader behavior on -the build platform. This validates measurement availability, not an FPS or -RAM optimization result. diff --git a/docs/profiling.md b/docs/profiling.md index 5ec1f2009..1bd7732ed 100644 --- a/docs/profiling.md +++ b/docs/profiling.md @@ -1,7 +1,7 @@ # Find the next bottleneck -Frame and tick recordings describe player-visible timings. A private Java Flight -Recorder capture helps identify the code doing work or allocating objects. Use +For Java comparison runs, a private Java Flight Recorder capture helps identify +the code doing work or allocating objects. Use native Java 25, with `jcmd` and `java` from a JDK. Keep normal benchmark runs separate from profiling runs because sampling adds overhead. @@ -53,8 +53,7 @@ allocated bytes or proving that one object type owns most of the allocation. GC pause totals/maximum use top-level `jdk.GCPhasePause`, excluding nested phases and concurrent collection-cycle duration. `gc_cycles` is a separate count. `heap_used_peak_at_gc_bytes` considers recorded GC heap summaries and can miss -peaks between collections. It is separate from the game's once-per-second heap -and process-RSS measurements. +peaks between collections. It is separate from externally sampled process RSS. The reader ignores unselected event types and never extracts properties or arguments. `event_span_seconds` is the span of all observed event timestamps, @@ -70,12 +69,5 @@ python3 tools/test_jfr.py This creates a real JDK recording of bounded allocations and GC, then compares the reader's counter differences, observation counts, GC counts and heap summaries against `jfr print --json`. It also verifies escaped thread names and that sampled -weights do not appear as numeric allocation totals. CI runs it on Windows, Linux -and Apple Silicon macOS. The reader was independently checked against the older +weights do not appear as numeric allocation totals. The manual `jfr-analysis` CI job runs both collector fixtures on the Linux game runner. The reader was independently checked against the older real-game profile's JDK JSON export for 85 threads. - -The post-queue software-rendered profile confirms remaining allocations on the -integrated-server and chunk-meshing threads. It is not a matched comparison with -the older capture: world/cache state, heap and object-header flags differ. It -cannot establish M2 frame gains. Mac captures are needed before choosing a larger -renderer or native-kernel replacement. diff --git a/docs/research/java-mod-compat.md b/docs/research/java-mod-compat.md index 45d940722..1a5f96f8f 100644 --- a/docs/research/java-mod-compat.md +++ b/docs/research/java-mod-compat.md @@ -177,7 +177,5 @@ To be written as `docs/porting-from-fabric.md` once API 0.2 lands: - NeoForge documentation (`docs.neoforged.net`): events, registries, networking. - Modrinth's most-downloaded Fabric mods, for the porting list. -- Horizon's own Java test mod (`mods/horizon`, built by `tools/build_mod.py` - and the CI `portable-mod` job) is a Fabric mod used by the benchmarks and - parity oracles: it shows the Mixin pattern (`FrameHookMixin`) this page - describes, and stays a developer tool, not a player-facing mod. +- Horizon's Fabric benchmark instrumentation (`mods/horizon/src/bench/`) remains + a developer tool for Java comparisons. The parity oracles live in `mods/horizon/src/test/`. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 98bff8f82..12dd076f5 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -54,7 +54,6 @@ across 1,441,816 state pairs, including all pinned suppression-rule families. Animation metadata, frame sequences and tick-state selection now have native differential coverage, including all bundled animated texture metadata. GPU interpolation and game-loop synchronization remain unfinished. -The playable Java performance packs remain available during development. ## Completion criteria and playable builds diff --git a/docs/server.md b/docs/server.md index 6a73e768f..8c7fd9f8e 100644 --- a/docs/server.md +++ b/docs/server.md @@ -7,8 +7,7 @@ should beat vanilla, Paper and Fabric + Lithium on TPS/MSPT, RAM, CPU, chunk gen Gameplay stays vanilla: there are no Paper-style rule changes unless the owner turns one on. This page covers what the server does today (measured), the design of `horizon-server`, and what ships for the -first working version (2026-10-23). It replaced the Java/Fabric starter (`docs/server-quickstart.txt`, -`tools/server.py`, retired on 2026-10-19). The owner's guide is docs/hosting.md, also at +first working version (2026-10-23). The owner's guide is docs/hosting.md, also at https://playhorizon.dev/server. ## 1. Today @@ -467,7 +466,7 @@ reproducible by anyone, and show the same gameplay on both sides. - Horizon (`horizon-server`); - vanilla 26.3 (the owner's `server.jar`); - Paper (a jar the owner downloads; Paper's defaults are kept, and noted as non-vanilla); - - optionally Fabric + Lithium (the old starter's setup, via the pinned `packs/mods.lock.json`). + - optionally Fabric + Lithium (via the pinned `tools/benchmark-deps/mods.lock.json`). Java servers run on Java 25 with `-Xms` = `-Xmx` (the same heap for all, 4 GB by default), and the heap is reported. diff --git a/docs/tick-state.md b/docs/tick-state.md deleted file mode 100644 index abd4250c7..000000000 --- a/docs/tick-state.md +++ /dev/null @@ -1,26 +0,0 @@ -# Interpreting measured server ticks - -Tick execution time omits scheduler sleep. `stats.meanRate` is the inverse average duration, not actual TPS. `observed_ticks_per_second` already counts accepted plus dropped measured invocations divided by wall-clock recording duration. Frozen tick invocations count; paused wall time stays in the denominator. Neither number measures completed simulation work. - -Version 0.20 observes the server tick manager after each measured invocation on the server thread. Reports record the first and last sampled configured rate, frozen/stepping/sprinting flags and `runs_game_elements`, plus counters for samples with each nonstandard state. This is read-only instrumentation: it does not set a tick rate, freeze worlds or change game rules. Frame reports do not claim to sample server state; use their accompanying integrated-server tick reports. - -The recorder retains which state fields changed between samples. A 20 → 40 → 20 rate change or freeze → unfreeze sequence stays visible even when first and last states match. Both comparison tools mark such recordings as changed workloads, mark differing sampled boundary states, and warn about frozen, stepping, sprinting, suppressed-game-element and nonstandard-rate samples. A consistently configured custom rate can match another report at the same rate, with an explicit warning about that workload. Older, absent or invalid state metadata remains unknown, rather than normal by assumption. - -State and tick duration are accepted under the same recording lock, including buffer overflow. The observation path retains scalar values and allocates no maps or lists per invocation; report serialization creates them once. Non-finite or sub-minimum rates are counted as invalid observations without aborting duration capture. The state object is only allocated for tick recordings. - -Sampling has limits. These are first/last sampled server states, not exact recording boundary states. Changes entirely between samples can be missed. An integrated server paused by the game menu does not call the measured superclass method, so state counters do not enumerate paused time. The manager flag also does not establish that every entity/chunk was simulated, or detect all other reasons a server skips work. A final stepping tick may already have decremented the remaining-step counter to zero while `runs_game_elements` is still true. Compare world copies, entity populations, completed work and real player workloads separately. - -## Validation - -Pure recording checks exercise restored intermediate changes, distinct frozen/suppressed states, late observations, absent/invalid manager state and wall-clock TPS calculation under G1, compact headers and ZGC. Offline comparison checks cover map ordering, changed/custom states and legacy/malformed input. The desktop and 390-pixel viewer checks also load the actual discarded paused capture (12 ticks over approximately 120 seconds), display its roughly 0.1 observed TPS and distinguish it from execution capacity. That capture remains excluded from performance evidence. - -The private `TickStateIntegration` fixture runs only on a disposable demo-world copy. It starts a short recording, samples normal ticking, changes to 40 configured ticks/second and freezes, steps ten ticks, restores 20/unfrozen state, and requests a five-tick sprint. It checks that sampled boundary states match, all five intermediate state changes/counters survive, and accepted state/duration counts agree. The fixture is compiled in platform CI and excluded from the production JAR and downloadable packs. The [final local applied-hook observation](../benchmarks/tick-state-2026-10-04/live-observations.json) records 285 invocations, with 161 frozen, 9 stepping, 5 sprinting, 151 suppressed-game-element and 161 nonstandard-rate samples. All five change fields survive restored boundary states; CSV count/mean and zero invalid/drop observations are verified, and the client exits with code zero. This is functional evidence rather than a performance comparison. Compilation is not a live Mac result. - -Compile the private fixture after building the original mod: - -```sh -python3 tools/build_mod.py -python3 -c "from tools.build_mod import build_integration_fixture; build_integration_fixture('tick-state', 'dev.horizonlab.metrics.TickStateIntegration')" -``` - -Install `.local/mod-build/tick-state-fixture.jar` only into a disposable locally prepared balanced demo instance. Open its copied demo world and dismiss the demo screen. The fixture validates the report and closes the client after its sequence. Never add it to a normal play instance or starter package. diff --git a/docs/vulkan.md b/docs/vulkan.md deleted file mode 100644 index b0fa79fe9..000000000 --- a/docs/vulkan.md +++ /dev/null @@ -1,32 +0,0 @@ -# Compare the Vulkan renderer on your Mac - -The `vulkan` profile asks Minecraft 26.3 to use its existing Vulkan backend, with -its original OpenGL fallback. It uses balanced mods/distances. -The game renderer handles the backend; this project has not written a separate -Metal renderer. The benchmark records the actual backend and driver. - -The checksum-verified 26.3 manifest includes LWJGL Vulkan 3.4.3 Mac ARM64 natives. -Inspecting that official native JAR confirmed `libMoltenVK.dylib`; its paired -LWJGL loader first tries MoltenVK on macOS. [MoltenVK](https://github.com/KhronosGroup/MoltenVK) -implements Vulkan functionality over Apple's Metal framework. This verifies a -bundled route to Metal, rather than proving that a particular Mac backend starts -or performs better. No separately installed Vulkan SDK is required for the bundled -library; driver/backend compatibility still needs a real Mac test. - -Import `m2-balanced` and `vulkan` as separate Prism instances. Keep Java 25 ARM64, -heap, header/collector flags, world copies, resolution, view/simulation distance -and camera route equal. Warm terrain and shader/pipeline caches before comparing. -Run at least three alternating 120-second F8 recordings. Inspect nearby blocks, -distant terrain, transparency, water, lighting and reloads as well as timings. -Use the viewer's actual backend field: OpenGL fallback is an OpenGL result. - -After the isolated test works, `foreground-first` and `foreground-vulkan` compare -the two backends with the same combined terrain controls. Their 120 FPS adaptive -goal controls background duty cycle; rendering remains uncapped in pack options. -Do not add shaders to one side of an isolated backend comparison. - -Linux software rendering checks reached the actual Vulkan backend, rendered the -demo world and recorded matching CSV/JSON frame/tick samples. An unavailable -Vulkan-driver test reached the menu using OpenGL fallback. These tests do not -validate MoltenVK, real GPU speeds, all visual details or macOS 27. The user's -M2 Pro remains the priority device for those checks. diff --git a/mods/horizon/src/main/java/dev/horizonlab/HorizonLab.java b/mods/horizon/src/main/java/dev/horizonlab/HorizonLab.java deleted file mode 100644 index b6933a07e..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/HorizonLab.java +++ /dev/null @@ -1,78 +0,0 @@ -package dev.horizonlab; - -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import dev.horizonlab.metrics.Recording; -import dev.horizonlab.metrics.Reports; -import dev.horizonlab.metrics.ProcessMemoryMonitor; -import dev.horizonlab.metrics.ResidentMemory; -import java.nio.file.Path; -import java.util.Map; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; -import net.minecraft.commands.Commands; -import net.minecraft.network.chat.Component; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.permissions.Permissions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class HorizonLab implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("horizonlab"); - private static volatile Recording ticks; - - @Override public void onInitialize() { - ProcessMemoryMonitor.configure(new ResidentMemory()); - CommandRegistrationCallback.EVENT.register((dispatcher, context, selection) -> dispatcher.register( - Commands.literal("horizonserver") - .requires(source -> source.permissions().hasPermission(Permissions.COMMANDS_ADMIN)) - .then(Commands.literal("bench") - .then(Commands.argument("label", StringArgumentType.word()) - .then(Commands.argument("seconds", IntegerArgumentType.integer(10, 600)) - .executes(command -> { - boolean started = startTicks(StringArgumentType.getString(command, "label"), - IntegerArgumentType.getInteger(command, "seconds"), Path.of("horizon-benchmarks"), "server", - command.getSource().getServer().isDedicatedServer() ? "dedicated" : "integrated", Map.of()); - command.getSource().sendSuccess(() -> Component.literal(started - ? "Horizon: recording tick times; run the intended workload now." - : "Horizon: a tick recording is already active."), false); - return started ? 1 : 0; - })))) - .then(Commands.literal("stop").executes(command -> { finishTicks(); return 1; })))); - LOGGER.info("Horizon ready. Simulation rules and tick rate are unchanged."); - } - - public static synchronized boolean startTicks(String label, int seconds, Path output, String profile) { - return startTicks(label, seconds, output, profile, "unknown", Map.of()); - } - - public static synchronized boolean startTicks(String label, int seconds, Path output, String profile, - String runtimeKind, Map clientContext) { - if (ticks != null) return false; - Map context = dev.horizonlab.metrics.SoftwareContext.capture(); - context.put("profile", profile); - context.put("minecraft", "26.3"); - context.putAll(dev.horizonlab.metrics.ServerContext.capture(runtimeKind, clientContext)); - ticks = new Recording(label, "ticks", output, seconds, context); - return true; - } - - public static void tick(long durationNs, MinecraftServer server) { - Recording recording = ticks; - if (recording == null) return; - var tickRate = server.tickRateManager(); - recording.addTick(durationNs, server.getPlayerList().getPlayerCount(), tickRate.tickrate(), tickRate.isFrozen(), tickRate.isSteppingForward(), - tickRate.isSprinting(), tickRate.runsNormally()); - if (System.nanoTime() >= recording.deadlineNs) finishTicks(); - } - - public static synchronized void finishTicks() { - Recording recording = ticks; - if (recording == null) return; - ticks = null; - Reports.write(recording.finish()).whenComplete((path, error) -> { - if (error != null) LOGGER.error("Tick report failed", error); - else LOGGER.info("Horizon tick benchmark saved to {}", path); - }); - } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/budget/DebounceWait.java b/mods/horizon/src/main/java/dev/horizonlab/budget/DebounceWait.java deleted file mode 100644 index 9241baf31..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/budget/DebounceWait.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.horizonlab.budget; - -/** Wait only while an unchanged debounce deadline blocks progress. */ -public final class DebounceWait { - public static final long MAX_WAIT_NS = 1_000_000L; - private DebounceWait() {} - - public static long delay(long now, long firstQueued, long debounce, boolean preprocessingPending) { - if (preprocessingPending || debounce <= 0) return 0; - long age = now - firstQueued; - if (age < 0 || age >= debounce) return 0; - return Math.min(MAX_WAIT_NS, debounce - age); - } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/budget/DispatchRetry.java b/mods/horizon/src/main/java/dev/horizonlab/budget/DispatchRetry.java deleted file mode 100644 index 2ecd8f402..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/budget/DispatchRetry.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.horizonlab.budget; - -/** Per-picker state, used only while its existing dispatch lock is held. */ -public final class DispatchRetry { - private boolean rejectedExecutor; - private boolean rejectedPass; - - public void beginPass() { rejectedExecutor = false; rejectedPass = false; } - public void beginExecutor() { rejectedExecutor = false; } - public void rejected() { rejectedExecutor = true; rejectedPass = true; } - public int visibleSlots(int occupied) { return rejectedExecutor ? Integer.MAX_VALUE : occupied; } - public boolean needsRetry(boolean original, boolean shutdown) { return !shutdown && (original || rejectedPass); } - public long retryMilliseconds(long original) { return rejectedPass ? 1 : original; } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainBudget.java b/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainBudget.java deleted file mode 100644 index b2a8b4aa9..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainBudget.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.horizonlab.budget; - -/** Foreground-first background duty cycle. Inputs are two-second observation windows. */ -public final class TerrainBudget { - private double ratio; - private int healthyWindows; - - public TerrainBudget(double ceiling) { ratio = ceiling; } - - public double update(double ceiling, double meanFrameMs, double targetFrameMs, - double lateFraction, double heapFraction) { - if (!Double.isFinite(ceiling) || ceiling < 0.01 || ceiling > 1.0 - || !Double.isFinite(meanFrameMs) || meanFrameMs < 0 - || !Double.isFinite(targetFrameMs) || targetFrameMs <= 0 - || !Double.isFinite(lateFraction) || lateFraction < 0 || lateFraction > 1 - || !Double.isFinite(heapFraction) || heapFraction < 0 || heapFraction > 1) { - throw new IllegalArgumentException("Invalid budget observations"); - } - double floor = Math.min(ceiling, 0.05); - ratio = Math.min(ratio, ceiling); - boolean pressure = meanFrameMs > targetFrameMs * 1.35 || lateFraction > 0.20 || heapFraction > 0.85; - boolean healthy = meanFrameMs < targetFrameMs * 1.10 && lateFraction < 0.05 && heapFraction < 0.75; - if (pressure) { - healthyWindows = 0; - ratio = Math.max(floor, ratio * 0.65); - } else if (healthy) { - if (++healthyWindows >= 3) { - ratio = Math.min(ceiling, ratio + 0.025); - healthyWindows = 0; - } - } else { - healthyWindows = 0; - } - return ratio; - } - - public double ratio() { return ratio; } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainReadWait.java b/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainReadWait.java deleted file mode 100644 index e2210a1a9..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainReadWait.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.horizonlab.budget; - -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CancellationException; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; - -/** Allow the pinned DH generation pool's shutdown interrupt to release a read-only wait. */ -public final class TerrainReadWait { - private TerrainReadWait() {} - - public static T join(CompletableFuture future) { - // Ordinary game callers retain join's interrupt behavior. Completed reads use the original path. - if (future.isDone() || !Thread.currentThread().getName().startsWith("DH-World Gen Thread[")) - return future.join(); - try { - return future.get(); - } catch (InterruptedException shutdown) { - Thread.currentThread().interrupt(); - // DH recognizes this cause as shutdown. The cached future belongs to other callers too. - throw new CompletionException(shutdown); - } catch (ExecutionException | CancellationException failure) { - // Now completed: retain join's original exception identity and wrapping semantics. - return future.join(); - } - } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java b/mods/horizon/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java deleted file mode 100644 index 13c229ccc..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.horizonlab.budget; - -import java.util.concurrent.locks.LockSupport; - -/** A bounded idle park, preserving Thread.sleep's InterruptedException/cleared-flag contract. */ -public final class WakeableIdleWait { - private WakeableIdleWait() { } - - public static void pause(Object blocker, long nanoseconds) throws InterruptedException { - if (nanoseconds < 0) throw new IllegalArgumentException("Negative idle wait"); - if (Thread.interrupted()) throw new InterruptedException(); - LockSupport.parkNanos(blocker, nanoseconds); - if (Thread.interrupted()) throw new InterruptedException(); - } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/budget/WorkerPacer.java b/mods/horizon/src/main/java/dev/horizonlab/budget/WorkerPacer.java deleted file mode 100644 index 11992a080..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/budget/WorkerPacer.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.horizonlab.budget; - -/** Per-worker primitive state; amortizes short waits without discarding fractional milliseconds. */ -public final class WorkerPacer { - public static final long QUANTUM_NS = 250_000; - public static final long MAX_CREDIT_NS = 50_000_000; - private long started; - private long completed; - private double debtNs; - private double previousRatio = 1; - - public void begin(long now) { - if (completed != 0 && now - completed > 1_000_000_000L) debtNs = 0; - started = now; - } - - public long finish(long now, double ratio) { - long workNs = Math.max(0, now - started); - completed = now; - if (ratio != previousRatio) debtNs = 0; - previousRatio = ratio; - if (!Double.isFinite(ratio) || ratio <= 0 || ratio >= 1) { - debtNs = 0; - return 0; - } - debtNs += workNs * (1.0 / ratio - 1.0); - return debtNs < QUANTUM_NS ? 0 : (long) Math.min(debtNs, Long.MAX_VALUE / 4.0); - } - - public void pauseCompleted(long now) { - debtNs = Math.max(-MAX_CREDIT_NS, debtNs - Math.max(0, now - completed)); - completed = now; - } - - public void interrupted(long now) { debtNs = 0; completed = now; } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java b/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java deleted file mode 100644 index c21e9688a..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java +++ /dev/null @@ -1,74 +0,0 @@ -package dev.horizonlab.client; - -import com.seibel.distanthorizons.api.DhApi; -import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue; -import dev.horizonlab.HorizonLab; -import dev.horizonlab.budget.TerrainBudget; - -/** Loaded only when DH is installed. Overrides are temporary, never written to its TOML. */ -final class DistantTerrainBudget { - private IDhApiConfigValue setting; - private TerrainBudget policy; - private Double owned; - private boolean yielded; - private long windowStart; - private long totalNs; - private int count; - private int late; - private int changes; - - void observe(long now, long frameNs, double targetMs) { - if (yielded || DhApi.Delayed.configs == null) return; - if (setting == null) { - setting = DhApi.Delayed.configs.multiThreading().threadRuntimeRatio(); - if (!setting.getCanBeOverrodeByApi() || setting.getApiValue() != null) { - yielded = true; - HorizonLab.LOGGER.info("Adaptive terrain budget yielded to an existing DH override"); - return; - } - policy = new TerrainBudget(setting.getTrueValue()); - } - if (!java.util.Objects.equals(setting.getApiValue(), owned)) { - yielded = true; - owned = null; - HorizonLab.LOGGER.info("Adaptive terrain budget yielded after another DH override changed"); - return; - } - if (windowStart == 0) windowStart = now; - if (frameNs > 0) { - totalNs += frameNs; - count++; - if (frameNs / 1e6 > targetMs * 2) late++; - } - if (now - windowStart < 2_000_000_000L || count == 0) return; - Runtime runtime = Runtime.getRuntime(); - double heap = (runtime.totalMemory() - runtime.freeMemory()) / (double) runtime.maxMemory(); - double next = policy.update(setting.getTrueValue(), totalNs / 1e6 / count, targetMs, - late / (double) count, heap); - if (owned == null || Math.abs(next - owned) > 0.0001) { - if (setting.setValue(next, "Horizon adaptive budget")) { - owned = next; - changes++; - HorizonLab.LOGGER.info("Adaptive terrain background runtime ratio: {}", next); - } - } - resetWindow(); - } - - void suspend() { - if (setting != null && owned != null && java.util.Objects.equals(setting.getApiValue(), owned)) { - setting.clearValue(); - HorizonLab.LOGGER.info("Adaptive terrain override released; effective runtime ratio: {}", setting.getValue()); - } - owned = null; - policy = setting == null ? null : new TerrainBudget(setting.getTrueValue()); - resetWindow(); - } - - private void resetWindow() { windowStart = 0; totalNs = 0; count = 0; late = 0; } - - String status() { - return yielded ? "yielded to another mod" : owned == null ? "waiting for active gameplay" - : "DH runtime ratio " + owned + "; adjustments " + changes; - } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java b/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java deleted file mode 100644 index 28c9e7c56..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.horizonlab.client; - -import com.seibel.distanthorizons.api.DhApi; -import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfig; -import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue; -import java.util.LinkedHashMap; -import java.util.Map; - -/** Read effective API values once at capture boundaries; never change terrain settings. */ -final class DistantTerrainSettings { - private DistantTerrainSettings() {} - - static Map read() { return read(DhApi.Delayed.configs); } - - static Map read(IDhApiConfig configs) { - if (configs == null) return Map.of("dh_capture_status", "unavailable"); - Map values = new LinkedHashMap<>(); - try { - var graphics = configs.graphics(); - put(values, "dh_rendering_enabled", graphics.renderingEnabled()); - put(values, "dh_renderer_mode", graphics.renderingMode()); - put(values, "dh_lod_radius_chunks", graphics.chunkRenderDistance()); - put(values, "dh_horizontal_quality", graphics.horizontalQuality()); - put(values, "dh_vertical_quality", graphics.verticalQuality()); - put(values, "dh_max_horizontal_resolution", graphics.maxHorizontalResolution()); - put(values, "dh_transparency", graphics.transparency()); - put(values, "dh_lod_shading", graphics.lodShading()); - put(values, "dh_lod_only_mode", graphics.lodOnlyMode()); - put(values, "dh_camera_quality_dropoff", graphics.useCameraPositionForQualityDropOff()); - put(values, "dh_ambient_occlusion", graphics.ambientOcclusion().enabled()); - put(values, "dh_thread_count", configs.multiThreading().threadCount()); - put(values, "dh_runtime_ratio", configs.multiThreading().threadRuntimeRatio()); - values.put("dh_capture_status", "available"); - return values; - } catch (RuntimeException | LinkageError unavailable) { - // Missing/changed APIs must not look like disabled rendering or a zero distance. - return Map.of("dh_capture_status", "unavailable"); - } - } - - private static void put(Map target, String name, IDhApiConfigValue setting) { - Object value = setting.getValue(); // Includes active overrides; getTrueValue reads only the user base. - if (value == null) throw new IllegalStateException("Unavailable configuration value"); - target.put(name, value instanceof Enum choice ? choice.name() : value); - } -} diff --git a/mods/horizon/src/main/java/dev/horizonlab/client/HorizonClient.java b/mods/horizon/src/main/java/dev/horizonlab/client/HorizonClient.java deleted file mode 100644 index e429a8190..000000000 --- a/mods/horizon/src/main/java/dev/horizonlab/client/HorizonClient.java +++ /dev/null @@ -1,211 +0,0 @@ -package dev.horizonlab.client; - -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.platform.InputConstants; -import dev.horizonlab.HorizonLab; -import dev.horizonlab.metrics.Recording; -import dev.horizonlab.metrics.Reports; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.LinkedHashMap; -import java.util.Map; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.Minecraft; -import net.minecraft.client.Options; -import net.minecraft.client.KeyMapping; -import net.minecraft.network.chat.Component; -import static net.fabricmc.fabric.api.client.command.v2.ClientCommands.argument; -import static net.fabricmc.fabric.api.client.command.v2.ClientCommands.literal; - -public final class HorizonClient implements ClientModInitializer { - private static Recording frames; - private static long previousStart; - private static String profile = "custom"; - private static DistantTerrainBudget terrainBudget; - private static long previousBudgetFrame; - private static int targetFps = 60; - - @Override public void onInitializeClient() { - KeyMapping benchmarkKey = KeyMappingHelper.registerKeyMapping(new KeyMapping( - "key.horizonlab.benchmark", InputConstants.KEY_F8, KeyMapping.Category.MISC)); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - while (benchmarkKey.consumeClick()) { - if (client.level != null && client.gui.screen() == null) { - if (frames == null) start(profile, 120); else finish(); - } - } - }); - Path profileFile = FabricLoader.getInstance().getConfigDir().resolve("horizon-profile.txt"); - try { - if (Files.exists(profileFile)) profile = Files.readString(profileFile).strip(); - } catch (Exception error) { HorizonLab.LOGGER.warn("Profile label could not be read", error); } - Path budgetFile = FabricLoader.getInstance().getConfigDir().resolve("horizon-adaptive.properties"); - try { - if (Files.exists(budgetFile)) { - var properties = new java.util.Properties(); - try (var reader = Files.newBufferedReader(budgetFile)) { properties.load(reader); } - targetFps = Math.clamp(Integer.parseInt(properties.getProperty("targetFps", "60")), 10, 240); - if (Boolean.parseBoolean(properties.getProperty("enabled", "false"))) enableBudget(); - } - } catch (Exception error) { HorizonLab.LOGGER.warn("Adaptive budget disabled: invalid configuration", error); } - ClientCommandRegistrationCallback.EVENT.register((dispatcher, context) -> dispatcher.register( - literal("horizon") - .then(literal("bench") - .executes(command -> start("benchmark", 120)) - .then(argument("label", StringArgumentType.word()) - .executes(command -> start(StringArgumentType.getString(command, "label"), 120)) - .then(argument("seconds", IntegerArgumentType.integer(10, 600)) - .executes(command -> start(StringArgumentType.getString(command, "label"), - IntegerArgumentType.getInteger(command, "seconds")))))) - .then(literal("stop").executes(command -> { finish(); return 1; })) - .then(literal("adaptive") - .then(literal("on").executes(command -> { - if (frames != null) { message("Finish the recording before changing the budget"); return 0; } - message(enableBudget() ? "Adaptive terrain budget enabled" : "Distant Horizons is required"); - return 1; - })) - .then(literal("off").executes(command -> { - if (frames != null) { message("Finish the recording before changing the budget"); return 0; } - if (terrainBudget != null) terrainBudget.suspend(); - terrainBudget = null; - previousBudgetFrame = 0; - message("Adaptive terrain budget disabled"); return 1; - }))) - .then(literal("status").executes(command -> { - message("Profile: " + profile + "; recording: " + (frames != null) - + "; adaptive: " + (terrainBudget == null ? "off" : terrainBudget.status())); return 1; - })))); - HorizonLab.LOGGER.info("Horizon client profile: {}. F8 or /horizon bench