Merge origin/main into chore/wasmtime-48
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+9
-6
@@ -1,9 +1,10 @@
|
||||
# Horizon documentation
|
||||
|
||||
To play, use [the launcher](../launcher/README.md); the project site is [playhorizon.dev](https://playhorizon.dev). These pages are for developers.
|
||||
To play, use [the launcher](../launcher/README.md); the project site is [playhorizon.dev](https://playhorizon.dev). These pages are for developers. What is being done now and next, the work board and how to help: [the hub](https://playhorizon.dev/hub) ([ROADMAP.md](../ROADMAP.md), [roadmap/README.md](../roadmap/README.md) for keeping it current).
|
||||
|
||||
## Build and run
|
||||
|
||||
- [AGENTS.md](../AGENTS.md) and [Architecture](architecture.md): where each part of the code lives, how `Game` is organised, which harness checks which area.
|
||||
- [Build from source](../README.md#build-from-source): your own copy of the game, resource preparation, `cargo run`.
|
||||
- [Native client](native-client.md): options, controls, the dedicated server, `horizon-ctl` scripting, packaging, architecture.
|
||||
- [Host a server](hosting.md): install `horizon-server`, prepare the game files, first run, `server.toml`, the commands, the web panel, backups, services and Docker; what works today and what doesn't yet.
|
||||
@@ -11,16 +12,17 @@ To play, use [the launcher](../launcher/README.md); the project site is [playhor
|
||||
- [Agent control](agent-control.md): what AI agents can drive in the launcher and the game, and the design of the control socket, `horizon-ctl` and MCP.
|
||||
- [Graphics](graphics.md): the Simple and Advanced graphics settings, the graphics benchmark and what it measured.
|
||||
- [Benchmark](benchmark.md): Horizon against vanilla 26.3 and vanilla with performance mods, on the same machine, world, path and settings: what is measured, how it is kept fair, how to reproduce it.
|
||||
- [Shader packs](shader-packs.md): how the renderer draws a frame, the Horizon WGSL shader pack format (stages, uniforms, `pack.toml`, hot reload), and the plan to translate OptiFine/Iris packs.
|
||||
- [Extras](extras.md): optional zoom, minimap, FPS and keystroke overlays and auto-reconnect, all off by default.
|
||||
- [Mods](mods.md): Horizon's own mod system (Rust, sandboxed WebAssembly), how to make and install mods, and [what carries over from Java mods](research/java-mod-compat.md).
|
||||
- [Shader packs](shaders.md): Horizon's own WGSL shader packs, how to make and check one (`horizon-shader`).
|
||||
- [Mods](mods.md): Horizon's own mod system (Rust, sandboxed WebAssembly), how to make and install mods.
|
||||
- [Modpacks](modpacks.md): porting whole packs (ATM10 and smaller): import, inventory, carry-over, an agent per mod with a harness against the Java original, coverage, and how "10x" is measured.
|
||||
- [Launcher](../launcher/README.md): installs, updates and starts builds; its CLI and MCP server; releasing it.
|
||||
- [Versioning](versioning.md): how releases are numbered from 0.2 (`v0.2.x`, `launcher@0.2.x`), how installs from before 0.2 get there, and the steps for the day 0.2 ships.
|
||||
- [Resource packs](resource-packs.md): everything a 26.3 resource pack can change, whether Horizon honours it, and the proof.
|
||||
- [Opt-in data collection](telemetry.md): the consent, exactly what is sent, how it is stored and sent.
|
||||
- [Benchmark report format](benchmark-report.md): the versioned JSON every benchmark writes (game, launcher, `tools/perf_bench.py`), the local log and, with consent, the upload.
|
||||
- Menus: every screen is vanilla's (title, world list, create world, multiplayer, options, pause). Horizon's own settings hang off vanilla's Options the way mods add theirs: **Horizon Settings...** and **Mods...** in the last two slots of the Options grid (Horizon Settings opens Graphics, Advanced Graphics, Shader Packs, Controller Settings, Extras and Mods, each a vanilla options list), with Horizon Graphics, Advanced Graphics and Shader Packs also at the top of Video Settings and Controller Settings at the bottom of Controls. The title screen's and pause menu's Friends buttons open Join a Friend and Play with Friends ([play-with-friends.md](play-with-friends.md)).
|
||||
- [Horizon APIs](api/README.md): every surface other programs build on (mods, shaders, agent control, servers, the launcher, data formats), each with its guide, generated reference, stability and changelog, and the [stability and versioning policy](api/stability.md).
|
||||
- Menus: every screen is vanilla's (title, world list, create world, multiplayer, options, pause). Horizon's own settings hang off vanilla's Options the way mods add theirs: **Horizon Settings...** and **Mods...** in the last two slots of the Options grid (Horizon Settings opens Graphics, Advanced Graphics, Controller Settings, Extras and Mods, each a vanilla options list), with Horizon Graphics and Advanced Graphics also at the top of Video Settings and Controller Settings at the bottom of Controls. The title screen's and pause menu's Friends buttons open Join a Friend and Play with Friends ([play-with-friends.md](play-with-friends.md)).
|
||||
|
||||
## Parity
|
||||
|
||||
@@ -33,6 +35,7 @@ To play, use [the launcher](../launcher/README.md); the project site is [playhor
|
||||
## Architecture: world generation
|
||||
|
||||
- [World generation](world-generation.md): the pipeline from noise to features.
|
||||
- [Pregeneration](pregeneration.md): `/pregen`, generating, lighting and saving an area ahead of the players.
|
||||
- [Noise generation](noise-generation.md), [compiled density functions](density-functions.md), [structure density](structure-density.md), [terrain filling](terrain-filling.md).
|
||||
- Biomes: [lookup](biome-lookup.md), [temperatures](biome-temperatures.md).
|
||||
- Surfaces: [material surfaces](material-surfaces.md), [material conditions](material-conditions.md), [rule libraries](material-rule-libraries.md), [vertical anchors](vertical-anchors.md), [value providers](value-providers.md).
|
||||
@@ -45,6 +48,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).
|
||||
|
||||
@@ -71,7 +71,6 @@ passes on without checking it).
|
||||
| Dedicated server here: start, console, log, stop | Servers | yes | yes | yes | yes | `server`; MCP `server`, `server_command`, `server_log`, `server_stop` |
|
||||
| Hosted servers: list, create, set up, run a command, forget | Servers | yes | no | yes | yes | `servers ...`; `servers_forget` needs `confirm` |
|
||||
| Accounts: list, sign in, sign out, select, offline | Settings | yes | part | yes | yes | names and UUIDs only; sign-in is a device code; `account_offline` was missing |
|
||||
| Update channel (Alpha, Stable) | Settings | yes | yes | yes | yes | |
|
||||
| Game folder, server folder, install new versions, opening animation | Settings | no | no | yes | yes | `settings [KEY VALUE]` |
|
||||
| Extra game arguments | Settings | yes | no | yes | yes | `game-args` |
|
||||
| Applications menu entry (Linux) | Settings | yes | no | yes | yes | `desktop-entry` |
|
||||
@@ -79,7 +78,7 @@ passes on without checking it).
|
||||
| Patch notes, links | Patch notes, footer | yes | yes | yes | yes | |
|
||||
| Game log, crash reports | Settings | yes | yes | yes | yes | `logs [--crash]` |
|
||||
| Data collection: status, allow, deny, show, delete, send, bug, benchmark upload | Settings > Data | yes | part | yes | yes | sending was missing in MCP; `data_delete` needs `confirm` |
|
||||
| Mod browser: search, check, install, update, remove, list (mods, resource packs, shader packs, modpacks) | Mods | yes | no | yes | yes | `mods ...`; `mods_remove` needs `confirm` |
|
||||
| Mod browser: search, check, install, update, remove, list (mods, resource packs, modpacks) | Mods | yes | no | yes | yes | `mods ...`; `mods_remove` needs `confirm` |
|
||||
| Modpacks: import, port, play, remove, list | Modpacks | yes | no | yes | yes | `modpack ...`; `modpack_remove` needs `confirm` |
|
||||
| Launcher benchmark | (none) | yes | no | yes | yes | |
|
||||
| The game it started | (the game) | (horizon-ctl) | yes | (horizon-ctl) | yes | `game_*` |
|
||||
@@ -102,10 +101,10 @@ passes on without checking it).
|
||||
| Open to LAN | Pause > Open to LAN | part | no | yes | yes | `lan open\|close\|status` |
|
||||
| Play with Friends: host, stop, status | Pause | part | no | yes | yes | `friends host\|stop\|status` |
|
||||
| Vanilla options, every page | Options | yes | part | yes | yes | `options-get`, `options-set` (all of options.txt, typed); `options PAGE` was socket-only |
|
||||
| Horizon Settings: Graphics, Shader Packs, Controller, Extras, Mods, AI Agent | Horizon Settings | part | part | yes | yes | `options horizon\|graphics\|extras\|agent...`, then `ui`/`click`/`set` |
|
||||
| Horizon Settings: Graphics, Controller, Extras, Mods, AI Agent | Horizon Settings | part | part | yes | yes | `options horizon\|graphics\|extras\|agent...`, then `ui`/`click`/`set` |
|
||||
| Agent control on or off, status, connection details | Horizon Settings > AI Agent | no | no | yes | yes | new page (#1353) |
|
||||
| Key binds | Controls > Key Binds | yes | yes | yes | yes | `options-set key_key.jump key.keyboard.j` |
|
||||
| Resource packs, shader packs | Options > Resource Packs, Shader Packs | part | part | yes | yes | `options packs`, `options shader-packs`, then `ui` rows and `click`; `options-set resourcePacks` |
|
||||
| Resource packs | Options > Resource Packs | part | part | yes | yes | `options packs`, then `ui` rows and `click`; `options-set resourcePacks` |
|
||||
| Chat and commands | Chat | yes | yes | yes | yes | `chat`, `command`, `messages`, `chat-log` |
|
||||
| Inventory, containers, stations | Inventory, Chest... | yes | part | yes | yes | `inventory`, `screen`, `click-slot`; `container X Y Z` was socket-only |
|
||||
| Crafting, recipe book | Crafting | part | part | yes | yes | the grid by `click-slot`; the recipe book by `ui`/`click` |
|
||||
@@ -148,7 +147,7 @@ The switch is in three places: Settings > AI in the launcher, Horizon Settings i
|
||||
| Companion (#1068) | uses the same switch (see horizon-parity companion-notes.md) |
|
||||
|
||||
Every other launcher command stays usable: versions, install, remove, prepare, play, server,
|
||||
notes, links, account, update-channel, settings, game-args, logs, update, desktop-entry, data,
|
||||
notes, links, account, settings, game-args, logs, update, desktop-entry, data,
|
||||
modpack, mods, servers, no-ai and benchmark. None of them drives the game for an agent. The
|
||||
launcher itself, packagers, the docs and players' scripts need them, and `no-ai` has to stay to
|
||||
turn the switch off.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# Horizon APIs
|
||||
|
||||
Horizon has six surfaces that other programs and people build on. Each one has an **API** (the contract: what you
|
||||
may call, read or write, and what Horizon promises about it) and an **SDK** (the tools that help you use it). This
|
||||
section has one page per surface, plus the rules every surface follows:
|
||||
[stability and versioning](stability.md).
|
||||
|
||||
| Surface | For | API today | Stability | Reference |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| [Mods](mods.md) | mod authors | WIT `horizon:mods@0.1.0`, manifest `api` 0.1 (code) and 0.2 (content) | preview | [mods-reference.md](mods-reference.md) (generated) |
|
||||
| [Shaders](shaders.md) | shader authors | none yet: packs were removed on 2026-10-24 | planned | none |
|
||||
| [Agent control](agent-control.md) | agents, scripts, tests | `horizon-ctl`, its MCP server, the game's control socket | preview | [horizon-ctl-commands.md](../horizon-ctl-commands.md) (generated) |
|
||||
| [Servers](server.md) | hosts, panels, bots | `horizon-server` commands, `server.toml`, control API `/api/v1` | stable | [server-reference.md](server-reference.md) (generated) |
|
||||
| [Launcher](launcher.md) | players' agents, pack makers | `horizon-launcher` commands and its MCP server | preview | [launcher-commands.md](../launcher-commands.md) (generated) |
|
||||
| [Data formats](data-formats.md) | tools that read Horizon's files | benchmark reports, telemetry, settings files, signed checksums | stable or preview, per format | on that page |
|
||||
|
||||
## How these APIs are designed
|
||||
|
||||
- **From the people who use them.** Each API starts from what a mod author, a pack author, a server host or an agent
|
||||
needs to do, written down as tasks ("a host backs up the world from a script"), and from how Horizon is built:
|
||||
Rust, wgpu, WebAssembly components and a server thread that runs every world. A function exists because a task
|
||||
needs it.
|
||||
- **Our own design.** Horizon's APIs are not modelled on any other project's. Contributors may know other mod
|
||||
loaders, renderers and server platforms exist, but their source and API references are never read, copied or
|
||||
paraphrased here, and our names, shapes and docs are not taken from theirs. Vanilla Minecraft 26.3 is the reference for game
|
||||
concepts: ids, commands, `server.properties`, data packs and resource packs.
|
||||
- **Safe by default.** Mods run in a sandbox and can only use the capabilities their manifest declares; the control
|
||||
sockets listen on this computer only, behind a token; nothing here is on by default where it would change vanilla's
|
||||
look or behaviour.
|
||||
- **Free when unused.** An API nobody uses costs nothing per tick or per frame: no engine, no thread, no allocation.
|
||||
- **One contract for every mode.** In-frame single player, the server thread, LAN and the dedicated server run the
|
||||
same gameplay code ([AGENTS.md](../../AGENTS.md)), so a server-side API serves all of them.
|
||||
|
||||
## References are generated
|
||||
|
||||
A reference page is written by code from the source it describes, and a test fails when the two differ:
|
||||
|
||||
| Page | Generated from | Update it with |
|
||||
| --- | --- | --- |
|
||||
| [mods-reference.md](mods-reference.md) | `crates/horizon-mod-sdk/wit/horizon.wit`, the manifest's capabilities | `HORIZON_WRITE_DOCS=1 cargo test -p horizon-mods --features pack --test api_reference` |
|
||||
| [server-reference.md](server-reference.md) | `horizon-server`'s help, `config::TEMPLATE`, `api::ROUTES` | `HORIZON_WRITE_DOCS=1 cargo test -p horizon-server reference` |
|
||||
| [horizon-ctl-commands.md](../horizon-ctl-commands.md) | the command table in `crates/horizon-client/src/bin/horizon-ctl/commands.rs` | `horizon-ctl help --markdown > docs/horizon-ctl-commands.md` |
|
||||
| [launcher-commands.md](../launcher-commands.md) | `launcher/src/cli.rs` | `HORIZON_WRITE_DOCS=1 cargo test --manifest-path launcher/Cargo.toml the_launcher_reference` |
|
||||
|
||||
So a pull request that changes an API also changes its reference, and the reviewer sees the API's diff in the
|
||||
reference's diff. The guides (overview, how-to, examples) are written by hand.
|
||||
|
||||
## Each surface's page
|
||||
|
||||
Every page has the same parts: **Overview** (what you can build), **Guide** (where to start), **Reference**,
|
||||
**Examples**, **Stability** (the level of each part, per [stability.md](stability.md)), **Changelog** and
|
||||
**Not there yet** (what is planned, so nobody builds on a guess).
|
||||
|
||||
The website shows these pages at [playhorizon.dev/docs/api](https://playhorizon.dev/docs/api), built from this
|
||||
folder, and a summary for players and authors at [playhorizon.dev/docs/apis](https://playhorizon.dev/docs/apis)
|
||||
(`website/docs/apis.md`).
|
||||
@@ -0,0 +1,55 @@
|
||||
# Agent control API
|
||||
|
||||
How a program drives a running game: an AI agent through MCP, a script through `horizon-ctl`, a test through the
|
||||
control socket. Design and inventory: [agent-control.md](../agent-control.md); for players:
|
||||
[playhorizon.dev/docs/agents](https://playhorizon.dev/docs/agents).
|
||||
|
||||
## Overview
|
||||
|
||||
The game listens on a local control socket (a Unix socket, or localhost TCP with a token on Windows), takes one
|
||||
command per text line and answers one JSON line. `horizon-ctl` wraps it: it starts the game, sends commands and
|
||||
serves the same commands as MCP tools. The launcher's MCP server offers them too, as `game_<tool>`.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| `horizon-ctl` commands | 96, in 8 groups (session, observe, move and look, act, screens and chat, multiplayer, world and cheats, scripting and benchmarks) |
|
||||
| MCP tools | 88 (8 commands are CLI only) |
|
||||
| Destructive commands (need `--confirm`) | 3 |
|
||||
| Command names the game's socket answers | about 160, test hooks included (`horizon-ctl help --game`) |
|
||||
|
||||
## Guide
|
||||
|
||||
1. Build `horizon-ctl` (`cargo build --profile fast -p horizon-client`), then
|
||||
`horizon-ctl --socket $PWD/ctl.sock launch --world W --creative --wait --resources <prepared files>`.
|
||||
2. `horizon-ctl --socket … state`, `keys`, `turn`, `command`, `screenshot`, `quit`.
|
||||
3. For an agent: `horizon-ctl mcp`, or the launcher's `horizon-launcher mcp` with `agent-config` to connect a client
|
||||
([launcher-commands.md](../launcher-commands.md)).
|
||||
|
||||
## Reference
|
||||
|
||||
[horizon-ctl-commands.md](../horizon-ctl-commands.md), generated from the command table in
|
||||
`crates/horizon-client/src/bin/horizon-ctl/commands.rs`: every command, its MCP tool and its arguments.
|
||||
|
||||
## Examples
|
||||
|
||||
- `tools/agent_control_e2e.py`: starts a game and drives it end to end through `horizon-ctl` and MCP.
|
||||
- `tools/lan_e2e.py`: two games over LAN, both driven through their sockets.
|
||||
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)). The commands in `horizon-ctl`'s table and their MCP tool names are what the
|
||||
API offers; the other commands the game's socket answers are test hooks and experimental.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- **A version.** A `hello` command that answers the protocol version, the game's release and the features it has;
|
||||
MCP `serverInfo` carries the same version; `horizon-ctl` refuses a game whose major it doesn't speak.
|
||||
- **Reply schemas.** Each command's reply described in the table (fields, types, units), so the reference documents
|
||||
replies as well as arguments and MCP tools declare an output schema.
|
||||
- **Events as a stream.** `events --since` polls today; a subscription that pushes events as they happen.
|
||||
- **Test hooks apart.** The hooks only harnesses use move under their own prefix, out of the agent's tool list.
|
||||
- **Compatibility tests.** A transcript per protocol version: commands and the reply keys each must keep.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Unversioned so far: the command table and the generated reference are the contract.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Data formats
|
||||
|
||||
The files Horizon writes that other tools may read: benchmark reports, telemetry, settings, mods, release checksums
|
||||
and worlds. Each entry names its version field, its documentation and its level ([stability.md](stability.md)).
|
||||
|
||||
## Overview
|
||||
|
||||
| Format | Where | Version | Level | Documented in |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Benchmark report | the benchmark's output, the local log, uploads | `"format": "horizon-benchmark-report"`, `"version": 1` | stable | [benchmark-report.md](../benchmark-report.md) |
|
||||
| Telemetry batch | `POST /v1/batch` from the launcher | `"schema": 1` | stable | [telemetry.md](../telemetry.md) |
|
||||
| Telemetry consent | `telemetry/consent.json` in the game folder | `"version": 2` | stable | [telemetry.md](../telemetry.md) |
|
||||
| Mod package | `.hmod`: a zip with `horizon-mod.toml`, `mod.wasm`, `assets/`, `data/` | the manifest's `api` | preview | [mods.md](../mods.md#the-manifest), [mods-reference.md](mods-reference.md) |
|
||||
| Mods turned on | `horizon-mods.txt` | none | preview | [mods.md](../mods.md#playing-with-mods) |
|
||||
| Horizon settings | `horizon-graphics.txt`, `horizon-extras.txt` (`key:value`, as `options.txt`) | none: unknown keys fall back to defaults | preview | [graphics.md](../graphics.md), [extras.md](../extras.md#options-storage) |
|
||||
| Server settings | `server.toml` | its keys | stable | [server-reference.md](server-reference.md) |
|
||||
| Control endpoints | the game's socket file (TCP form), `.horizon/api.json` | none | preview | [agent-control.md](agent-control.md), [server-reference.md](server-reference.md) |
|
||||
| Release checksums | `SHA256SUMS`, `SHA256SUMS.sig` on releases since signing began (#1011) | the signed text names the tag | stable | [security.md](../security.md) |
|
||||
| Worlds | the world folder | vanilla 26.3's (`DataVersion`) | vanilla's | [world-data.md](../world-data.md) |
|
||||
|
||||
Worlds are vanilla's format, so any tool that reads a 26.3 world reads a Horizon world; Horizon adds itself to
|
||||
`level.dat`'s `ServerBrands` as vanilla's server does.
|
||||
|
||||
## Rules for every format
|
||||
|
||||
- A reader ignores fields it doesn't know, and refuses a version newer than it knows with a clear message.
|
||||
- An optional field may be added in the same version; renaming, removing or changing the meaning of a field makes the
|
||||
next version, and Horizon's own readers keep reading the older ones for the deprecation window.
|
||||
- Each versioned format has a sample file of every version its reader accepts, read by a test.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- Versions for the settings files and the control endpoint files (a `version` line or field).
|
||||
- Sample files and reader tests for every versioned format.
|
||||
- A generated schema for the benchmark report and the telemetry batch from their Rust types, checked by a test like
|
||||
the references.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Benchmark report version 1; telemetry schema 1, consent version 2.
|
||||
@@ -0,0 +1,57 @@
|
||||
# Launcher API
|
||||
|
||||
What a player's agent, a script or a pack maker can do with `horizon-launcher`: install and run versions, manage
|
||||
accounts, settings, mods, modpacks and hosted servers, from a terminal or over MCP. The launcher itself:
|
||||
[launcher/README.md](../../launcher/README.md).
|
||||
|
||||
## Overview
|
||||
|
||||
Every page of the launcher has a command, and every command but three has an MCP tool with the same arguments; a tool
|
||||
runs the command with `--json`. Tools that change the player's things for good need `confirm: true`; with No AI on,
|
||||
the MCP server is off.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Commands | 46: versions, installs, play, the server, notes, links, accounts, settings, logs, updates, data collection, modpacks, mods, hosted servers, MCP, benchmark |
|
||||
| MCP tools | 43, plus the game's tools as `game_<tool>` ([agent-control.md](agent-control.md)) |
|
||||
| Modpack formats it imports | 3: a Modrinth `.mrpack`, a CurseForge zip, an instance folder |
|
||||
|
||||
## Guide
|
||||
|
||||
1. `horizon-launcher versions`, `horizon-launcher install latest`, `horizon-launcher play`.
|
||||
2. Modpacks: `horizon-launcher modpack import <file>`, then `modpack port` and `modpack play`
|
||||
([modpacks.md](../modpacks.md)).
|
||||
3. For an agent: `horizon-launcher agent-config` prints how to connect a client to `horizon-launcher mcp`.
|
||||
|
||||
## Reference
|
||||
|
||||
[launcher-commands.md](../launcher-commands.md), generated from `launcher/src/cli.rs`: every command, its arguments
|
||||
and its MCP tool.
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
horizon-launcher versions --installed --json
|
||||
horizon-launcher mods search minimap --kind mod --json
|
||||
horizon-launcher servers create --name "Weekend" --player Alex --json
|
||||
```
|
||||
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)): command names, arguments and MCP tool names are the contract; `--json`
|
||||
output shapes are not yet described in the reference.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- **A Horizon modpack manifest.** A pack made for Horizon (not a port of a Java pack) needs its own file: the pack's
|
||||
id, name and version; the Horizon API lines and the release line it needs; its `.hmod` mods (id, version, SHA-256,
|
||||
where to download it, client, server or both); resource packs; default settings; and whether it has a server side.
|
||||
One manifest serves the launcher, `horizon-server` (a server installs the server side of the same pack) and the mod
|
||||
browser. Designed from what a pack maker does, versioned per [stability.md](stability.md), with a schema test.
|
||||
- **JSON output schemas** for every command, in the generated reference, so MCP tools declare their output.
|
||||
- **A version** in MCP `serverInfo` and `--json` output, as for agent control.
|
||||
- **Compatibility tests**: golden `--json` output per command.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Unversioned so far: the command table and the generated reference are the contract.
|
||||
@@ -0,0 +1,165 @@
|
||||
# The registry index and `.hpack`
|
||||
|
||||
Horizon's registry lists what is made for Horizon and reviewed: mods (`.hmod`), modpacks (`.hpack`), resource packs
|
||||
and, once their format exists, Horizon shader packs. Submissions are pull requests in
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods); merging one publishes it. The launcher and the
|
||||
website read one file, `index.json`, which that repository's CI builds. The Rust types and every check below are
|
||||
`horizon_mods::index` and `horizon_mods::modpack` (feature `index`); the sample is
|
||||
`crates/horizon-mods/tests/index/index-v1.json`, read by the tests with the files it lists.
|
||||
|
||||
Level: preview ([stability.md](stability.md)). Schema 1.
|
||||
|
||||
## `index.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"schema": 1,
|
||||
"generated": "2026-10-24T18:00:00Z",
|
||||
"projects": [{
|
||||
"id": "coords_hud", "kind": "mod", "name": "Coordinates HUD", "summary": "One line.",
|
||||
"description": "Markdown.", "authors": ["Horizon"], "owners": ["ludovic111"],
|
||||
"license": "MIT", "source": "https://github.com/...", "icon": "https://...png", "key": "RWT...",
|
||||
"versions": [{
|
||||
"version": "0.1.0", "published": "2026-10-24", "changelog": "",
|
||||
"api": "0.1", "side": "client", "capabilities": ["game-read", "hud", "chat"], "game": "26.3",
|
||||
"file": { "name": "coords_hud-0.1.0.hmod", "url": "https://github.com/ludovic111/horizon-mods/releases/download/...",
|
||||
"size": 438, "sha256": "e113...", "signature": "untrusted comment: ...\n...\ntrusted comment: ...\n...\n" }
|
||||
}]
|
||||
}],
|
||||
"revoked": [{ "id": "bad_mod", "sha256": "1111...", "reason": "Sent chat messages it didn't declare.", "date": "2026-10-24" }]
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Meaning |
|
||||
| --- | --- |
|
||||
| `schema` | 1. A reader refuses a higher number with "update Horizon" rather than misread it. |
|
||||
| `projects[].id` | `[a-z0-9_]{1,64}`, unique; a mod's is its manifest's `id`. |
|
||||
| `kind` | `mod`, `modpack`, `resourcepack`, `shader` (Horizon's own shader packs, not Iris or OptiFine packs). Other kinds (data packs, worlds, themes) may come without a new schema: a reader keeps a kind it doesn't know and doesn't offer it. |
|
||||
| `summary`, `description` | One line for lists; Markdown for the project's page. |
|
||||
| `owners` | GitHub logins allowed to publish updates. |
|
||||
| `license`, `source` | An SPDX expression and an `https://` address of the source code: both required. |
|
||||
| `icon` | `https://`, optional. |
|
||||
| `key` | The author's [minisign](https://jedisct1.github.io/minisign/) public key. When set, every version must be signed with it; an update signed with another key is refused. Absent: the project is unsigned and the launcher says so. |
|
||||
| `versions` | Newest first, at least one. |
|
||||
| `api` | A mod's API line (its manifest's `api`); a modpack's manifest format (`1`). |
|
||||
| `side`, `capabilities` | A mod's, read from its manifest by CI, never typed by hand. |
|
||||
| `game` | The Minecraft version it is for. |
|
||||
| `requires` | A modpack's mods: `{ id, version, sha256 }`, each a version in this index with that hash. |
|
||||
| `file` | A plain name with the kind's extension (`.hmod`, `.hpack`, `.zip`), an `https://` URL, the size (at most 64 MiB), the lowercase hex SHA-256, and the `.minisig` text when the project has a key. |
|
||||
| `revoked` | Files taken down: one file by `sha256`, or every version of `id` without it. The launcher refuses to install them and turns installed copies off with the reason. |
|
||||
|
||||
Readers ignore fields they don't know, so an optional field can be added to schema 1. Renaming or removing a field, or
|
||||
changing what one means, makes schema 2.
|
||||
|
||||
## Before a file is installed
|
||||
|
||||
`index::check_file` runs on the downloaded file, before it reaches the game folder:
|
||||
|
||||
1. Its size and SHA-256 are the ones the entry lists, and it isn't revoked.
|
||||
2. With a project key: its signature verifies with that key (minisign's prehashed and legacy signatures both).
|
||||
3. What the file says matches the entry: a mod's `horizon-mod.toml` (id, version, API, side, capabilities) and its
|
||||
content's fence ([mods.md](../mods.md#content-mods-api-02)); a modpack's manifest (id, version, format, game,
|
||||
mods); a resource pack's `pack.mcmeta`.
|
||||
4. A kind this build can't install is refused with "this Horizon can't install a … yet".
|
||||
|
||||
The game still checks a mod's component imports against its capabilities when it starts it, as for any mod.
|
||||
|
||||
## `.hpack`
|
||||
|
||||
A zip holding `horizon-modpack.toml` and, optionally, `overrides/`. The mods are not inside: the launcher downloads
|
||||
each from the index and checks it as above.
|
||||
|
||||
```toml
|
||||
format = 1
|
||||
id = "cozy" # [a-z0-9_]{1,64}: the profile's folder
|
||||
name = "Cozy"
|
||||
version = "1.0.0"
|
||||
description = "Coordinates and a calm render distance."
|
||||
authors = ["Horizon"]
|
||||
game = "26.3"
|
||||
|
||||
[[mods]]
|
||||
id = "coords_hud"
|
||||
version = "0.1.0"
|
||||
sha256 = "e1135345692f6dd8fd4c51920151944b82333e17049c9bb7d756f27b8deefc53"
|
||||
on = true # optional, default true: turned on in the profile's horizon-mods.txt
|
||||
```
|
||||
|
||||
Unknown keys are refused. `overrides/` may hold only `options.txt`, `horizon-graphics.txt`, `horizon-extras.txt`,
|
||||
`resourcepacks/<name>.zip` and `horizon-mods/.horizon-mod-data/<a listed mod>/...` (a mod's own saved settings,
|
||||
capability `storage`), each at most 64 MiB and 256 MiB in all; anything else refuses the pack. The launcher copies
|
||||
them into the profile's game folder.
|
||||
|
||||
## The registry repository
|
||||
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods) holds one `mods/<id>.toml` per project, written by
|
||||
the submission form or by hand, and `revoked.toml`. What an entry can't vouch for is read from its file by the kind's
|
||||
own check (`index::inspect`): a mod's API, side and capabilities, a modpack's mods, the size. Types and rules:
|
||||
`horizon_mods::index::registry`.
|
||||
|
||||
```toml
|
||||
id = "coords_hud" # the file's name, and the manifest's id
|
||||
kind = "mod" # mod | modpack | resourcepack; shader once its format exists
|
||||
name = "Coordinates HUD"
|
||||
summary = "One line, at most 160 characters."
|
||||
description = """Markdown.""" # optional
|
||||
authors = ["Horizon"]
|
||||
owners = ["ludovic111"] # GitHub logins who may publish updates
|
||||
license = "MIT"
|
||||
source = "https://github.com/..."
|
||||
icon = "icons/coords_hud.png" # optional: a PNG of at most 256 KiB in the repository, or https://
|
||||
key = "RWT..." # optional: the minisign public key every version is signed with
|
||||
|
||||
[[versions]] # newest first
|
||||
version = "0.1.0" # letters, digits, '.', '-', '_': the release tag is <id>-<version>
|
||||
published = "2026-10-24"
|
||||
game = "26.3"
|
||||
file = "coords_hud-0.1.0.hmod" # the name players download
|
||||
sha256 = "e113..." # pins the reviewed file
|
||||
signature = """untrusted comment: ...""" # when the project has a key
|
||||
changelog = "" # optional
|
||||
```
|
||||
|
||||
```toml
|
||||
# revoked.toml
|
||||
[[revoked]]
|
||||
id = "bad_mod"
|
||||
sha256 = "1111..." # optional: without it, every version
|
||||
reason = "Sent chat messages it didn't declare."
|
||||
date = "2026-10-24"
|
||||
```
|
||||
|
||||
The submission form's service (`crates/horizon-mod-registry`) writes these entries: it signs the creator in with GitHub, runs the file's checks, uploads the file to the repository's `staging` release as `<sha256>.<extension>` and opens the pull request. Only an entry's `owners` publish updates through it.
|
||||
|
||||
Unknown keys are refused. Its CI runs `cargo-horizon-mod` (`crates/cargo-horizon-mod`):
|
||||
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| `cargo horizon-mod check <file> [--json]` | A submission's checks: its kind's (above), its signature with `--key` and `--signature`, and for a mod a trial run in the sandbox (40 ticks, 120 frames, a chat line, each command). |
|
||||
| `cargo horizon-mod registry check <base> <head> --files <dir>` | `check` on each file `head` lists and `base` doesn't: a pull request's new files. |
|
||||
| `cargo horizon-mod registry list <checkout>` | `<sha256> <id> <version> <file>` per version: the files to download. |
|
||||
| `cargo horizon-mod registry build <checkout> --files <dir> --out index.json` | Reads every entry and its file (`<dir>/<sha256>`), lists every problem, and writes the index with URLs `<release><id>-<version>/<file>` (`--release`, ending in `/`, defaults to the repository's releases). |
|
||||
| `cargo horizon-mod registry review <base> <head> --author <login>` | A pull request's changes: a published file never changes and is never removed (take it down in `revoked.toml`), a kind never changes; changes by a non-owner and to owners or keys are pointed out for the reviewers. |
|
||||
|
||||
How the repository runs (its workflows are in `.github/workflows/`):
|
||||
|
||||
- **A pull request** (`check.yml`) runs `registry review`, downloads each new file from the `staging` prerelease, runs
|
||||
`registry check` on it and builds the index it would publish; the report is the run's summary. The tool is
|
||||
`cargo-horizon-mod` from Horizon at the commit in the repository variable `HORIZON_REV`. The form's pull requests
|
||||
are opened with the token of the account in the variable `REGISTRY_BOT`; for those, the author is the login in the
|
||||
body's `<!-- submitted-by: … -->` line.
|
||||
- **Merging** needs the `check` run and a CODEOWNER's review. `publish.yml` then makes each new version a release
|
||||
`<id>-<version>` and deploys `index.json` and `icons/` to GitHub Pages:
|
||||
`https://ludovic111.github.io/horizon-mods/index.json`, served with `Access-Control-Allow-Origin: *`.
|
||||
- **Weekly**, `cleanup.yml` deletes staged copies of published files after 7 days and of files no open pull request
|
||||
lists after 30.
|
||||
- **Taking a file down** is a pull request adding it to `revoked.toml`. Removing an entry outright (a test, a project
|
||||
nobody installed) fails `registry review` on purpose and needs an administrator's merge.
|
||||
|
||||
Kinds open to submissions: `mod`, `modpack`, `resourcepack`. `shader` is in the schema and stays closed until
|
||||
Horizon's own shader pack format exists (Iris and OptiFine packs are for the Modrinth browser); its check will compile
|
||||
the pack in a headless Horizon. A new kind gets its own check before it opens.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Schema 1 (2026-10-24): kinds `mod`, `modpack`, `resourcepack`, `shader`; `.hpack` format 1.
|
||||
@@ -0,0 +1,240 @@
|
||||
<!-- Generated from crates/horizon-mod-sdk/wit/horizon.wit and the manifest's capabilities by crates/horizon-mods/tests/api_reference.rs; a test fails when this file is out of date. Update it with: HORIZON_WRITE_DOCS=1 cargo test -p horizon-mods --features pack --test api_reference -->
|
||||
# Mod API reference
|
||||
|
||||
The contract between Horizon and its mods: the WIT package `horizon:mods@0.1.0`, every interface, type, function and hook in it, and the capabilities a manifest may list. The guide is [mods.md](../mods.md); stability and versions: [stability.md](stability.md). Manifest `api` lines this game serves: `0.1`, `0.2`.
|
||||
|
||||
## Capabilities
|
||||
|
||||
| In `capabilities` | Grants | The player reads "May …" |
|
||||
| --- | --- | --- |
|
||||
| `game-read` | [`game`](#game) | see your position, health and the time |
|
||||
| `chat` | [`chat`](#chat) | show you chat messages |
|
||||
| `hud` | [`hud`](#hud) | draw text on your screen |
|
||||
| `storage` | [`storage`](#storage) | save its own settings to disk |
|
||||
| `command` | [`command`](#command) | run commands as you, with your permissions |
|
||||
| `registries` | data files (`assets/`, `data/`), no interface | add blocks and items to your worlds |
|
||||
| `ui` | [`ui`](#ui) | show its own screens and a settings page |
|
||||
|
||||
## World `horizon-mod`
|
||||
|
||||
- Imports (what the game offers): `log`, `game`, `chat`, `hud`, `storage`, `command`
|
||||
- Exports (what the mod provides): `events`
|
||||
|
||||
## World `horizon-ui-mod`
|
||||
|
||||
A mod with widgets (capability `ui`): the SDK builds every mod against this world. Mods built for `horizon-mod` alone (no `ui-events` export) still load and simply hear nothing of their widgets.
|
||||
|
||||
- Imports (what the game offers): `ui`, `log`, `game`, `chat`, `hud`, `storage`, `command`
|
||||
- Exports (what the mod provides): `ui-events`, `events`
|
||||
|
||||
## World `ui-host`
|
||||
|
||||
The game's side of `horizon-ui-mod` beyond `horizon-mod`.
|
||||
|
||||
- Imports (what the game offers): `ui`
|
||||
- Exports (what the mod provides): `ui-events`
|
||||
|
||||
## `log`
|
||||
|
||||
Access: always granted.
|
||||
|
||||
The mod's log, in the game's log under the mod's id. Always granted.
|
||||
|
||||
### enum `level`
|
||||
|
||||
| Case | |
|
||||
| --- | --- |
|
||||
| `debug` | |
|
||||
| `info` | |
|
||||
| `warn` | |
|
||||
| `error` | |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `write` | `func(level: level, message: string)` | One line in the game's log as `[mod <id>] message`, at that level. |
|
||||
|
||||
## `game`
|
||||
|
||||
Access: capability `game-read`.
|
||||
|
||||
Capability `game-read`: the local player and the world clock.
|
||||
|
||||
### record `player`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `x` | `f64` | Feet position, in blocks. |
|
||||
| `y` | `f64` | |
|
||||
| `z` | `f64` | |
|
||||
| `yaw` | `f32` | Degrees, as F3 shows them. |
|
||||
| `pitch` | `f32` | Degrees: -90 looks straight up, 90 straight down. |
|
||||
| `health` | `f32` | Hit points as vanilla counts them: 20 is full health without effects. |
|
||||
| `food` | `u32` | 0 to 20, as the hunger bar. |
|
||||
| `dimension` | `string` | `minecraft:overworld`, `minecraft:the_nether`, ... |
|
||||
|
||||
### record `clock`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `game-time` | `u64` | Ticks since the world was created. |
|
||||
| `day-time` | `u64` | 24000 ticks per day; 0 is 6:00 on the first day. |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `get-player` | `func() -> option<player>` | None on the title screen. |
|
||||
| `get-clock` | `func() -> option<clock>` | None on the title screen. |
|
||||
|
||||
## `chat`
|
||||
|
||||
Access: capability `chat`.
|
||||
|
||||
Capability `chat`: messages only the local player sees.
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `show` | `func(text: string)` | Shown in chat after the mod's name, like a system message. |
|
||||
|
||||
## `hud`
|
||||
|
||||
Access: capability `hud`.
|
||||
|
||||
Capability `hud`: one panel of text lines per mod, drawn by the game every frame until the mod changes or clears it (no call per frame).
|
||||
|
||||
### enum `corner`
|
||||
|
||||
| Case | |
|
||||
| --- | --- |
|
||||
| `top-left` | |
|
||||
| `top-right` | |
|
||||
| `bottom-left` | |
|
||||
| `bottom-right` | |
|
||||
|
||||
### record `line`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `text` | `string` | Plain text, up to 256 characters. |
|
||||
| `color` | `u32` | 0xRRGGBB. |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `set-panel` | `func(corner: corner, lines: list<line>)` | Replaces the mod's panel: up to 16 lines in that corner of the screen. |
|
||||
| `clear` | `func()` | Removes the mod's panel. |
|
||||
|
||||
## `storage`
|
||||
|
||||
Access: capability `storage`.
|
||||
|
||||
Capability `storage`: a per-mod folder of small key/value files, quota'd (docs/mods.md). Keys are `[a-z0-9_.-]{1,64}`, one path segment.
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `get` | `func(key: string) -> option<list<u8>>` | None if `key` has never been `set`, or the key is not well-formed. |
|
||||
| `set` | `func(key: string, value: list<u8>) -> result<_, string>` | Errs on a malformed key or over quota (bytes for the whole mod). |
|
||||
| `delete` | `func(key: string)` | No error if `key` was already absent. |
|
||||
|
||||
## `command`
|
||||
|
||||
Access: capability `command`.
|
||||
|
||||
Capability `command`: vanilla commands run as the player, with the player's permissions, after the hook call returns (8 per call). A mod's own commands are not run this way.
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `run` | `func(line: string)` | `line` without its slash; its feedback goes to the chat as if typed. |
|
||||
|
||||
## `ui`
|
||||
|
||||
Access: capability `ui`.
|
||||
|
||||
Capability `ui`: widgets the game draws with its own menus' widgets, for a screen the mod owns and a settings page in Options > Mods. Layout and drawing are the game's: a mod says what its widgets hold, never where they sit or how they look, and the game clips everything it is handed.
|
||||
|
||||
### record `text-widget`
|
||||
|
||||
A line of text.
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `id` | `u32` | The mod's own name for the widget; `ui-events` calls echo it. |
|
||||
| `text` | `string` | Up to 256 characters. |
|
||||
| `color` | `u32` | 0xRRGGBB; 0 is the menus' white. |
|
||||
|
||||
### record `item-widget`
|
||||
|
||||
An item's icon and a name beside it, as recipe viewers show them.
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `id` | `u32` | The mod's own name for the widget. |
|
||||
| `item` | `string` | `minecraft:diamond`, `<mod>:<path>`; an unknown id draws a "?". |
|
||||
| `name` | `string` | The name shown beside the icon (empty: the item's own). |
|
||||
|
||||
### record `list-widget`
|
||||
|
||||
Rows the player picks one of, as an options page lists choices: a pick is `ui-events::select`, `selected` is the row to mark now.
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `id` | `u32` | The mod's own name for the widget; `ui-events::select` echoes it. |
|
||||
| `rows` | `list<string>` | The rows' texts, at most 512, each up to 256 characters. |
|
||||
| `selected` | `option<u32>` | The row to mark as the current choice, if any. |
|
||||
|
||||
### variant `widget`
|
||||
|
||||
A thing on a mod's screen or settings page.
|
||||
|
||||
| Case | Payload | |
|
||||
| --- | --- | --- |
|
||||
| `text` | `text-widget` | Text the player reads. |
|
||||
| `item` | `item-widget` | An item's icon and name. |
|
||||
| `list` | `list-widget` | Rows the player picks from. |
|
||||
|
||||
### record `screen`
|
||||
|
||||
A screen the mod owns: a title over widgets stacked down the middle, the Done button the game adds, and Esc to leave it.
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `title` | `string` | Its title, up to 256 characters. |
|
||||
| `widgets` | `list<widget>` | Its widgets, in order, at most 64. |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `open-screen` | `func(screen: screen)` | Show `screen` over the game; a second call while it is open replaces it. Only the last call of one hook counts. |
|
||||
| `close-screen` | `func()` | Close the mod's screen when it is open (the mod hears no `closed` for this: it was its own doing). |
|
||||
| `set-settings` | `func(widgets: list<widget>)` | The mod's page in Options > Mods, reached from a settings button on its row: the widgets it shows, an empty list for no page. The player opening the page is `ui-events::settings-opened`: push fresh widgets then; later calls update the page while it shows. |
|
||||
|
||||
## `ui-events`
|
||||
|
||||
Access: exported by the mod: the game calls it.
|
||||
|
||||
What the game calls on a mod that shows widgets (capability `ui`): what the player did with them.
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `select` | `func(id: u32, row: u32)` | A row of one of the mod's `list` widgets was picked: the widget's `id` and the row, on the screen or the settings page that showed it. |
|
||||
| `closed` | `func()` | The player left the mod's screen (Esc or Done); not for a screen the mod closed itself or one that went away with the mod. |
|
||||
| `settings-opened` | `func()` | The player opened the mod's settings page in Options > Mods: call `ui::set-settings` now to fill it with fresh widgets. |
|
||||
|
||||
## `events`
|
||||
|
||||
Access: exported by the mod: the game calls it.
|
||||
|
||||
What the game calls. Only the hooks `init` asks for are ever called.
|
||||
|
||||
### record `registration`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `commands` | `list<string>` | Chat commands, without the slash. A name vanilla already uses is refused (vanilla's command runs). |
|
||||
| `tick` | `bool` | Call `tick` every game tick (20 per second while playing). |
|
||||
| `frame` | `bool` | Call `frame` every rendered frame. Budget: 0.1 ms. |
|
||||
| `chat` | `bool` | Call `chat` for each chat line the player receives. |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `init` | `func() -> result<registration, string>` | Once, after loading. An error keeps the mod off and is shown. |
|
||||
| `tick` | `func(tick: u64)` | Each game tick while in a world, with the game's tick counter. |
|
||||
| `frame` | `func(seconds: f32)` | Each rendered frame, with the seconds since the last one. |
|
||||
| `command` | `func(name: string, args: string) -> result<option<string>, string>` | `/name args`: ok(some(text)) is shown as feedback, err(text) in red. |
|
||||
| `chat` | `func(text: string)` | Each chat line the player receives, as plain text. |
|
||||
@@ -0,0 +1,103 @@
|
||||
# Mod API
|
||||
|
||||
Mods are Rust crates compiled to sandboxed WebAssembly components. They run in the player's game and, once server
|
||||
mods land, wherever a world is simulated. Design and the runtime: [mods.md](../mods.md).
|
||||
|
||||
## Overview
|
||||
|
||||
A mod today can read the local player and the world clock, show chat lines only that player sees, draw a text panel
|
||||
on the HUD, keep small files of its own, register chat commands, and run on every tick, frame or chat line it asks
|
||||
for. A content mod adds blocks and items from JSON in its `.hmod`, copying vanilla templates, plus tags, recipes,
|
||||
loot, models, textures and structures in its own namespaces. Every capability is declared in the manifest, shown to
|
||||
the player before the mod is turned on, and checked against the component's real imports.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Interfaces the game offers | 5: `log`, `game`, `chat`, `hud`, `storage` |
|
||||
| Functions in them | 9 |
|
||||
| Hooks a mod exports | 5: `init`, `tick`, `frame`, `command`, `chat` |
|
||||
| Capabilities | 5: `game-read`, `chat`, `hud`, `storage`, `registries` |
|
||||
| Manifest `api` lines served | 2: `0.1` (code), `0.2` (content) |
|
||||
| SDK | the `Mod` trait (5 methods), `Registration` (4 builders), `export_mod!`, log helpers |
|
||||
| `cargo horizon-mod` | `new` (templates `code` and `content`), `build`, `run`, `check` |
|
||||
| Example mods | `coords-hud` (code), `ruby-content` (content) |
|
||||
|
||||
## Guide
|
||||
|
||||
The step-by-step guide, from installing the tools to publishing on the registry, is
|
||||
[Make a mod](https://playhorizon.dev/docs/make-a-mod) on the website. In short:
|
||||
|
||||
1. `rustup target add wasm32-unknown-unknown`, `cargo install --git https://github.com/ludovic111/horizon
|
||||
cargo-horizon-mod`, then `cargo horizon-mod new my-mod` ([Making a mod](../mods.md#making-a-mod)).
|
||||
2. Implement `Mod` for your type, list the capabilities you import in `horizon-mod.toml`
|
||||
([The manifest](../mods.md#the-manifest)).
|
||||
3. `cargo horizon-mod run` builds the `.hmod` and starts the game with it as a dev mod; after an edit,
|
||||
`cargo horizon-mod build` and the running game reloads it.
|
||||
4. Content mods: [Content mods (API 0.2)](../mods.md#content-mods-api-02).
|
||||
|
||||
## Reference
|
||||
|
||||
[mods-reference.md](mods-reference.md), generated from `crates/horizon-mod-sdk/wit/horizon.wit`: every capability,
|
||||
interface, type, function and hook, with the limits the guide lists (16 HUD lines of 256 characters, 8 chat lines per
|
||||
call, 4 MiB of storage, fuel per call).
|
||||
|
||||
## Examples
|
||||
|
||||
- `crates/horizon-mod-sdk/examples/coords-hud`: coordinates, facing and time on the HUD; `/where`, `/coords`; storage.
|
||||
- `crates/horizon-mod-sdk/examples/ruby-content`: no code; a gem and a block of ruby from vanilla templates, with
|
||||
their recipes, loot, tags, models, textures and names.
|
||||
- `crates/horizon-mods/tests/guest`: a mod that misbehaves on command (spins, panics, grows its memory), for the
|
||||
sandbox tests.
|
||||
|
||||
## Ways in
|
||||
|
||||
One API (the WIT world) and one sandbox (WebAssembly), whatever the mod is written in. Every way in produces a
|
||||
component for the same world, checked against the same capabilities and given the same limits; there is no second
|
||||
scripting runtime in the game.
|
||||
|
||||
| Way in | For | Status | Template and example |
|
||||
| --- | --- | --- | --- |
|
||||
| Rust | most mods; the fastest | first-class: the SDK, `cargo horizon-mod` | `cargo horizon-mod new`, `coords-hud` |
|
||||
| Data only | blocks and items with no code | first-class: content mods (API 0.2) | `cargo horizon-mod new --template content`, `ruby-content` |
|
||||
| Lua scripts | people who don't want a compiler | planned: a script mod whose code is a `.lua` file, run by Horizon's own interpreter mod | planned, with the same example as Rust |
|
||||
| C, C++, Zig | authors of those languages | to evaluate: bindings generated from the WIT, built without WASI | one each if it passes |
|
||||
| Go (TinyGo), AssemblyScript, JavaScript / TypeScript | authors of those languages | to evaluate: each needs its toolchain to emit a component without WASI imports, or an interpreter mod as for Lua | one each if it passes |
|
||||
|
||||
- **Scripts run inside the sandbox.** The Lua interpreter is itself a WebAssembly mod, built in Rust with the SDK and
|
||||
shipped by Horizon. A script mod's manifest names the interpreter and its own capabilities; the game links the
|
||||
interpreter with only those, so a script can do exactly what a compiled mod with the same manifest can.
|
||||
- **Hot reload.** The game keeps the interpreter compiled and loads the script into a fresh instance when the file
|
||||
changes, without restarting the game; what it saved with `storage` survives, as for dev mods.
|
||||
- **Measured, not guessed.** Each way in is listed with its measured cost on the same tick-heavy example (time and
|
||||
fuel per tick, memory, load time) against Rust, and a language is supported only with a template, an example and a
|
||||
test that builds and loads it in CI.
|
||||
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)): API 0.1 and content 0.2 are served together; a mod built for 0.1.0 keeps
|
||||
loading on every 0.1.x game. Server mods come as their own line, `api = "0.3"`, experimental first.
|
||||
|
||||
## Not there yet
|
||||
|
||||
What real mods need next, in the order modpacks and servers need it:
|
||||
|
||||
- **Server mods** (`api = "0.3"`): the same component running on the server thread and the dedicated server, with world events (block
|
||||
broken or placed, entity spawned or killed, player joined or left), game rules and server commands with typed
|
||||
arguments.
|
||||
- **World and blocks**: read blocks, block states and biomes in loaded chunks; change them through the server's block
|
||||
log, so clients and the parity harnesses see vanilla's updates.
|
||||
- **Items and inventories**: the player's inventory, held item and open container; item stacks with components.
|
||||
- **Entities**: query and change entities near a position; spawn from a mod's own entity types (data first).
|
||||
- **Block entities and menus**: ticking machines with slots and their screens.
|
||||
- **Screens and UI**: widgets built from vanilla's, a screen the mod owns, a settings page under Options > Mods.
|
||||
- **Networking**: a channel between a mod's two halves, client and server, typed by the mod's own WIT.
|
||||
- **Config**: typed settings the game shows and stores for the mod, on the server too.
|
||||
- **Keys and the crosshair target**: keybinds in Controls; what the player is looking at.
|
||||
- **Script mods and other languages**: see [Ways in](#ways-in).
|
||||
- **SDK**: a headless test runner (load a mod, feed it ticks and events, assert on its output, no window), templates
|
||||
per kind of mod, typed wrappers in the SDK for every interface. Dev mods already reload when rebuilt.
|
||||
|
||||
## Changelog
|
||||
|
||||
- API 0.2 (content): data-driven blocks and items, tags, `horizon:add_to`, terrain adaptation.
|
||||
- API 0.1.0: `log`, `game`, `chat`, `hud`, `storage`; `init`, `tick`, `frame`, `command`, `chat`.
|
||||
@@ -0,0 +1,137 @@
|
||||
<!-- Generated from crates/horizon-server/src (the help text, config::TEMPLATE, api::ROUTES) by reference.rs; a test fails when this file is out of date. Update it with: HORIZON_WRITE_DOCS=1 cargo test -p horizon-server reference -->
|
||||
# Server reference
|
||||
|
||||
Everything `horizon-server` offers a host or a tool: its commands, every `server.toml` key and the control API. How to host: [hosting.md](../hosting.md); the design: [server.md](../server.md); stability and versions: [stability.md](stability.md).
|
||||
|
||||
## Commands
|
||||
|
||||
`horizon-server help` prints:
|
||||
|
||||
```text
|
||||
horizon-server: host a Horizon (Minecraft Java Edition 26.3) server
|
||||
|
||||
Usage: horizon-server [--dir DIR] <command>
|
||||
|
||||
init Set up a server here: the EULA, the world, the port, who may join (asks, or takes flags:
|
||||
--eula --world NAME --seed SEED --port N --whitelist/--no-whitelist --player NAME... --op NAME
|
||||
--offline --yes)
|
||||
run Run the server in the foreground; type console commands, Ctrl-C stops it cleanly. It
|
||||
restarts the game if it crashes.
|
||||
start Run the server in the background (its output goes to logs/supervisor.log)
|
||||
stop, restart
|
||||
status [--json]
|
||||
Up or not, TPS, MSPT, players, RAM and CPU
|
||||
cmd COMMAND...
|
||||
Run a console command on the running server and print what it answers
|
||||
logs [-f] [-n N]
|
||||
The last N lines of the log (default 50); -f follows it
|
||||
backup [NAME]
|
||||
Zip the world and the settings into backups/ (a running server saves first and stays up)
|
||||
backups [--json]
|
||||
List the backups
|
||||
restore BACKUP [--yes]
|
||||
Put a backup's world in place (the current one is kept in backups/); a running
|
||||
server restarts with it
|
||||
service install|uninstall|print [--system]
|
||||
Start the server at boot or login: a systemd unit on Linux (--system: for every user,
|
||||
with sudo), a launchd agent on macOS, a task at logon on Windows
|
||||
panel A one-time login link for the web panel ([panel] in server.toml; 127.0.0.1:8130 by
|
||||
default)
|
||||
update [--check [--json]] [--version TAG] [--timeout SECONDS]
|
||||
Install the newest release (checked against GitHub's SHA-256), back up the world and
|
||||
restart on it; goes back by itself if the game isn't up within the timeout (300 s).
|
||||
--archive FILE --version NAME installs an archive you have
|
||||
rollback Back to the release used before the update
|
||||
config [--json]
|
||||
The settings in server.toml
|
||||
config set KEY=VALUE... [--json]
|
||||
Change settings (for example world.difficulty=hard server.max_players=10), checked first;
|
||||
a running server takes the difficulty, default game mode and whitelist at once, the rest
|
||||
at its next start
|
||||
import FILE Write server.toml from a vanilla server.properties
|
||||
op NAME, deop NAME
|
||||
whitelist on|off|list, whitelist add|remove NAME
|
||||
Who may join (on the running server, or in the files when it is stopped)
|
||||
|
||||
--dir DIR The server folder (default: the current folder)
|
||||
|
||||
Settings live in server.toml; the server writes server.properties from it before every start.
|
||||
```
|
||||
|
||||
## `server.toml`
|
||||
|
||||
Horizon server settings (docs/server.md). The server writes them into server.properties before every start: edit this file, not that one. Unknown keys are refused. `horizon-server init` writes this file with these defaults; `horizon-server config set SECTION.KEY=VALUE` changes it.
|
||||
|
||||
### `[server]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `motd` | `"A Minecraft Server"` | `motd` | the line under the server's name in the server list |
|
||||
| `port` | `25565` | `server-port` | the port players connect to |
|
||||
| `bind` | `""` | `server-ip` | listen on every address, or only on this one (server-ip) |
|
||||
| `max_players` | `20` | `max-players` | how many players can be online at once |
|
||||
| `online_mode` | `true` | `online-mode` | check players' Minecraft accounts (false: anyone joins under any name) |
|
||||
| `whitelist` | `true` | `white-list` | only whitelisted players and operators can join |
|
||||
| `enforce_whitelist` | `false` | `enforce-whitelist` | kick online players taken off the whitelist |
|
||||
| `view_distance` | `10` | `view-distance` | chunks sent around each player |
|
||||
| `simulation_distance` | `10` | `simulation-distance` | chunks around each player where mobs, crops and redstone tick |
|
||||
|
||||
### `[world]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `name` | `"world"` | `level-name` | the world folder |
|
||||
| `seed` | `""` | `level-seed` | empty: a random seed on the first start |
|
||||
| `game_mode` | `"survival"` | `gamemode` | survival, creative, adventure or spectator |
|
||||
| `difficulty` | `"easy"` | `difficulty` | peaceful, easy, normal or hard |
|
||||
| `hardcore` | `false` | `hardcore` | one life: a player who dies becomes a spectator |
|
||||
|
||||
### `[properties]`
|
||||
|
||||
Any other server.properties key, spelled as vanilla spells it, for example: spawn-protection = 16
|
||||
|
||||
### `[engine]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `path` | `""` | | the game program; empty: the one installed beside horizon-server |
|
||||
| `resources` | `""` | | the prepared game files; empty: resources/ here, else the usual places |
|
||||
| `restart_on_crash` | `true` | | start the game again when it crashes |
|
||||
|
||||
### `[backups]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `every` | `"6h"` | | automatic backups while the server runs: 30m, 6h, 1d...; "0" turns them off |
|
||||
| `keep` | `12` | | automatic backups kept (backups made by hand are never deleted) |
|
||||
|
||||
### `[updates]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `keep` | `1` | | other releases kept by updates, besides the one in use and the one rollback goes to |
|
||||
|
||||
### `[panel]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `bind` | `"127.0.0.1:8130"` | | the web panel: this computer only, or a tailnet address (100.x); "" turns it off |
|
||||
| `allow_public` | `false` | | true lets bind be any address; never put the panel on the open internet |
|
||||
|
||||
## Control API (`/api/v1`)
|
||||
|
||||
HTTP and JSON on 127.0.0.1. A running server writes its address and a random token to `.horizon/api.json`, readable only by its own user; every request sends `Authorization: Bearer <token>` and a `Host` that is that address. Errors answer `{"error": "..."}` with 400, 401, 403, 404, 405 or 409. The web panel uses the same routes with its session.
|
||||
|
||||
| Method | Path | Takes | Answers | What it does |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `GET` | `/api/v1/status` | nothing | `phase`, `version`, `pid`, `uptime_seconds`, `engine_pid`, `engine_uptime_seconds`, `crashes`, `last_crash`, `sample` (TPS, MSPT, players, RAM, CPU), `update` | How the server does |
|
||||
| `GET` | `/api/v1/metrics` | `?since=T` (seconds since 1970) | `{"samples": [...]}`: one a second, the last 10 minutes | The samples taken after T, for graphs |
|
||||
| `GET` | `/api/v1/logs` | `?since=N` | `{"next": N, "lines": [...]}` | The log lines after the Nth (the last 2000 are kept) |
|
||||
| `POST` | `/api/v1/command` | `{"line": "<one command>"}` | the lines the command logged | Run a console command on the running game |
|
||||
| `POST` | `/api/v1/stop` | nothing | `{"ok": true}` | Stop the game and the supervisor |
|
||||
| `POST` | `/api/v1/restart` | nothing | `{"ok": true}` | Restart the game |
|
||||
| `GET` | `/api/v1/backups` | nothing | `{"backups": [{"name", "bytes"}]}` | List the backups |
|
||||
| `POST` | `/api/v1/backups` | `{"name": "..."}` (optional) | `{"name": "<file>"}` | Back up now (a running game saves first and stays up) |
|
||||
| `POST` | `/api/v1/restore` | `{"name": "<backup>"}` | `{"name": "<backup>"}` | Restart the game with that backup's world (the current one is kept in backups/) |
|
||||
| `POST` | `/api/v1/update` | `{"tag": "...", "timeout": seconds}` (both optional) | `{"ok": true}`; `status` says how it went (`update`) | Restart on that installed release, or download the newest first; goes back if the game isn't up within the timeout |
|
||||
| `POST` | `/api/v1/panel/login` | nothing | `{"url": "..."}` | A one-time login link for the web panel (with the token only, not from the panel) |
|
||||
@@ -0,0 +1,60 @@
|
||||
# Server API
|
||||
|
||||
What a host, a panel or a bot can do with a Horizon server: the `horizon-server` commands, `server.toml` and the
|
||||
control API. How to host: [hosting.md](../hosting.md); the design: [server.md](../server.md).
|
||||
|
||||
## Overview
|
||||
|
||||
`horizon-server` sets up a server folder, runs the game as a dedicated server under a supervisor (restarts on a crash,
|
||||
backups on a schedule, updates with a rollback), and lets other programs manage it through a local HTTP API with a
|
||||
token. The web panel uses that API.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Commands | 22 (`init`, `run`, `start`, `stop`, `restart`, `status`, `cmd`, `logs`, `backup`, `backups`, `restore`, `service`, `panel`, `update`, `rollback`, `config`, `config set`, `import`, `op`, `deop`, `whitelist`, `version`) |
|
||||
| `server.toml` keys | 22 in 6 sections, plus `[properties]` for any other vanilla key |
|
||||
| Control API endpoints | 11 under `/api/v1` |
|
||||
|
||||
## Guide
|
||||
|
||||
1. `horizon-server init` in an empty folder, then `horizon-server start` ([hosting.md](../hosting.md)).
|
||||
2. From a script: `horizon-server status --json`, `horizon-server cmd say hi`, `horizon-server backup`.
|
||||
3. From a program: read `.horizon/api.json` (address and token), then `GET /api/v1/status` with
|
||||
`Authorization: Bearer <token>`.
|
||||
|
||||
## Reference
|
||||
|
||||
[server-reference.md](server-reference.md), generated from `horizon-server`'s source: the help text, every
|
||||
`server.toml` key with its default and the `server.properties` key it writes, and every endpoint.
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
token=$(jq -r .token .horizon/api.json); address=$(jq -r .address .horizon/api.json)
|
||||
curl -s -H "Authorization: Bearer $token" "http://$address/api/v1/status"
|
||||
curl -s -H "Authorization: Bearer $token" -d '{"line": "list"}' "http://$address/api/v1/command"
|
||||
```
|
||||
|
||||
## Stability
|
||||
|
||||
Stable ([stability.md](stability.md)): the commands, `server.toml`'s keys and `/api/v1`. A new key or endpoint is an
|
||||
addition; a change to one starts `/api/v2`, served beside `/api/v1`.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- **Players**: list with ping and position, kick, ban and pardon, op and deop, the whitelist, as endpoints (today only
|
||||
through `cmd` and the files).
|
||||
- **Console stream**: the log as a stream (server-sent events) rather than `logs?since=N` polling; chat, joins, leaves,
|
||||
deaths and crashes as typed events.
|
||||
- **Metrics**: a plain-text metrics endpoint any monitoring tool can scrape (TPS, MSPT percentiles, players, chunks,
|
||||
entities, RAM, CPU), from the samples `status` already takes.
|
||||
- **Backups**: delete and download one; restore a single dimension.
|
||||
- **Server mods**: list, turn on and off, and their settings, once the mod API runs on the server
|
||||
([mods.md](mods.md)).
|
||||
- **An MCP server** for the same endpoints, so a host's agent manages the server as it manages the game.
|
||||
- **Compatibility tests**: golden replies per endpoint, and a `server.toml` from each release line.
|
||||
|
||||
## Changelog
|
||||
|
||||
- `api::ROUTES` lists the endpoints; the reference is generated from it.
|
||||
- `/api/v1`: status, metrics, logs, command, stop, restart, backups, restore, update, panel login.
|
||||
@@ -0,0 +1,162 @@
|
||||
# Shader API reference (0.1)
|
||||
|
||||
Generated from `crates/horizon-shader-api` (`HORIZON_WRITE_DOCS=1 cargo test -p horizon-shader-api --test reference`
|
||||
rewrites it; the test fails when it drifts). The API's design and pack format: [shaders.md](shaders.md).
|
||||
|
||||
A stage is a function your WGSL defines, with the signature below; Horizon puts the prelude (these structs, the
|
||||
resources and helpers) before your files and calls the function from its own pass. Your files declare no
|
||||
bindings and no entry points, and no names starting with `horizon_`.
|
||||
|
||||
## Stages
|
||||
|
||||
| Stage | In `horizon-shaders.toml` | Your function |
|
||||
| --- | --- | --- |
|
||||
| sky | `[sky]` | `fn sky(input: SkyInput) -> vec4<f32>` |
|
||||
| material | `[material]` | `fn material(input: MaterialInput) -> Surface` |
|
||||
| post | `[[post]]` | `fn post(input: PostInput) -> vec4<f32>` |
|
||||
|
||||
## sky
|
||||
|
||||
`fn sky(input: SkyInput) -> vec4<f32>`
|
||||
|
||||
### `SkyInput`
|
||||
|
||||
One direction of the sky, for `fn sky(input: SkyInput) -> vec4<f32>`. The sun, moon, stars and clouds are drawn over the result.
|
||||
|
||||
| Field | Type | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `direction` | `vec3<f32>` | Unit view ray, camera-relative world axes. |
|
||||
| `color` | `vec4<f32>` | Vanilla's sky colour along the ray (sky, fog and sunrise). |
|
||||
|
||||
Resources (bind group 3):
|
||||
|
||||
| Binding | Declaration | Meaning |
|
||||
| --- | --- | --- |
|
||||
| 0 | `var<uniform> frame: Frame` | The frame (`Frame`). |
|
||||
|
||||
## material
|
||||
|
||||
`fn material(input: MaterialInput) -> Surface`
|
||||
|
||||
### `MaterialInput`
|
||||
|
||||
One point of a block's surface, for `fn material(input: MaterialInput) -> Surface`.
|
||||
|
||||
| Field | Type | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `albedo` | `vec4<f32>` | The block texture's colour here (alpha 0..1). |
|
||||
| `tint` | `vec4<f32>` | The vertex colour: biome tint, face shade and ambient occlusion. |
|
||||
| `light` | `vec2<f32>` | Block and sky light, 0..1, smoothed over the face. |
|
||||
| `lightmap` | `vec3<f32>` | Vanilla's light colour for that light this frame. |
|
||||
| `position` | `vec3<f32>` | The point, camera-relative, in blocks. |
|
||||
| `uv` | `vec2<f32>` | The texture coordinate inside the block atlas. |
|
||||
| `translucent` | `bool` | Drawn in the translucent pass (water, stained glass, ice). |
|
||||
|
||||
### `Surface`
|
||||
|
||||
What `material` returns. Vanilla's own is `albedo * tint * vec4(lightmap, 1.0)`; Horizon then applies the alpha test (cutout and translucent) and fog.
|
||||
|
||||
| Field | Type | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `color` | `vec4<f32>` | The lit colour, 0..1, with its alpha. |
|
||||
|
||||
Resources (bind group 3):
|
||||
|
||||
| Binding | Declaration | Meaning |
|
||||
| --- | --- | --- |
|
||||
| 0 | `var<uniform> frame: Frame` | The frame (`Frame`). |
|
||||
|
||||
## post
|
||||
|
||||
`fn post(input: PostInput) -> vec4<f32>`
|
||||
|
||||
### `PostInput`
|
||||
|
||||
One pixel of the picture, for `fn post(input: PostInput) -> vec4<f32>`.
|
||||
|
||||
| Field | Type | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `uv` | `vec2<f32>` | Where the pixel is, 0..1 from the top left. |
|
||||
| `pixel` | `vec2<f32>` | The pixel's centre, in pixels from the top left. |
|
||||
| `color` | `vec4<f32>` | The previous pass's colour here (the world's picture for the first pass). |
|
||||
| `depth` | `f32` | The world's depth here, reversed: 0 is the sky. |
|
||||
|
||||
Resources (bind group 3):
|
||||
|
||||
| Binding | Declaration | Meaning |
|
||||
| --- | --- | --- |
|
||||
| 0 | `var<uniform> frame: Frame` | The frame (`Frame`). |
|
||||
| 1 | `var scene_color: texture_2d<f32>` | The world's picture before any pass. |
|
||||
| 2 | `var scene_depth: texture_depth_2d` | The world's depth, reversed (1 near, 0 far and sky). |
|
||||
| 3 | `var previous: texture_2d<f32>` | The previous pass's output (`scene_color` for the first pass). |
|
||||
| 4 | `var linear_sampler: sampler` | Bilinear filtering, clamped to the edges. |
|
||||
| 5 | `var nearest_sampler: sampler` | Nearest texel, clamped to the edges. |
|
||||
|
||||
Helpers:
|
||||
|
||||
- `fn depth_at(uv: vec2<f32>) -> f32`: the world's depth at `uv`.
|
||||
- `fn view_position(uv: vec2<f32>, depth: f32) -> vec3<f32>`: the camera-relative position, in blocks, of
|
||||
the point at `uv` and `depth`.
|
||||
|
||||
## The frame
|
||||
|
||||
### `Frame`
|
||||
|
||||
The frame, as `frame` in every stage. Positions and directions are in world axes relative to the camera (x east, y up, z south), so they stay precise far from the world's origin; depth is reversed (1 near, 0 at the far plane and in the sky).
|
||||
|
||||
| Field | Type | Offset | Meaning |
|
||||
| --- | --- | --- | --- |
|
||||
| `view` | `mat4x4<f32>` | 0 | Camera-relative world to view space: the camera's rotation. |
|
||||
| `projection` | `mat4x4<f32>` | 64 | View to clip space (reversed depth, wgpu's clip space: z 0..1). |
|
||||
| `view_inverse` | `mat4x4<f32>` | 128 | View to camera-relative world space. |
|
||||
| `projection_inverse` | `mat4x4<f32>` | 192 | Clip to view space. |
|
||||
| `camera_position` | `vec3<f32>` | 256 | The camera's world position, in blocks (about a millimetre of precision 10 000 blocks out). |
|
||||
| `time` | `f32` | 268 | Seconds since the pack was loaded, wrapping to 0 every hour. |
|
||||
| `sun_direction` | `vec3<f32>` | 272 | Unit vector toward the sun (below the horizon at night). |
|
||||
| `day_time` | `f32` | 284 | The time of day, 0..1: 0 sunrise, 0.25 noon, 0.5 sunset, 0.75 midnight. |
|
||||
| `moon_direction` | `vec3<f32>` | 288 | Unit vector toward the moon. |
|
||||
| `game_time` | `f32` | 300 | Vanilla's GameTime: (game time % 24000 + partial tick) / 24000, 0..1. |
|
||||
| `sky_color` | `vec3<f32>` | 304 | Vanilla's sky colour this frame, 0..1. |
|
||||
| `rain` | `f32` | 316 | Rain strength, 0..1. |
|
||||
| `fog_color` | `vec3<f32>` | 320 | Vanilla's fog colour this frame (also the clear colour), 0..1. |
|
||||
| `thunder` | `f32` | 332 | Thunder strength, 0..1. |
|
||||
| `resolution` | `vec2<f32>` | 336 | The size of the world's picture, in pixels (the resolution scale applied). |
|
||||
| `eye_light` | `vec2<f32>` | 344 | Block and sky light at the camera, 0..1 (level / 15). |
|
||||
| `fog_start` | `f32` | 352 | Where vanilla's fog starts, in blocks from the camera. |
|
||||
| `fog_end` | `f32` | 356 | Where vanilla's fog is full, in blocks. |
|
||||
| `render_distance` | `f32` | 360 | The render distance, in blocks. |
|
||||
| `far` | `f32` | 364 | The far plane, in blocks. |
|
||||
| `night_vision` | `f32` | 368 | Night vision strength, 0..1. |
|
||||
| `blindness` | `f32` | 372 | Blindness strength, 0..1. |
|
||||
| `darkness` | `f32` | 376 | The darkness effect's strength, 0..1. |
|
||||
| `brightness` | `f32` | 380 | The Brightness option, 0..1 (Moody to Bright). |
|
||||
| `eye_in` | `u32` | 384 | What the camera is in: 0 air, 1 water, 2 lava, 3 powder snow. |
|
||||
| `dimension` | `i32` | 388 | 0 the Overworld, -1 the Nether, 1 the End, 2 any other dimension. |
|
||||
| `frame_index` | `u32` | 392 | Frames drawn since the pack was loaded (wraps). |
|
||||
| `hide_gui` | `u32` | 396 | 1 while F1 hides the HUD, else 0. |
|
||||
|
||||
## Options
|
||||
|
||||
Each `[[options]]` entry sets the WGSL `override` of the same name when the pipelines are built:
|
||||
|
||||
| `type` | Keys | The `override` |
|
||||
| --- | --- | --- |
|
||||
| `bool` | `default` | `override <id>: bool` |
|
||||
| `float` | `default`, `min`, `max`, `step` | `override <id>: f32` |
|
||||
| `int` | `default`, `min`, `max` | `override <id>: i32` |
|
||||
| `choice` | `values`, `default` (one of them) | `override <id>: u32`, the value's index |
|
||||
|
||||
## Limits
|
||||
|
||||
- 8 post passes, 64 options, `budget.gpu_ms` up to 16.
|
||||
- 256 KiB per WGSL file, 8 MiB per pack.
|
||||
- Per stage: 20000 naga expressions over all its functions, 64 texture reads (samples,
|
||||
gathers and loads, the prelude's included).
|
||||
|
||||
## The check
|
||||
|
||||
A pack runs only after it passes `horizon_shader_api::check` (the game when it loads a pack, the launcher before it
|
||||
installs one, the registry's CI): each stage is parsed and validated by naga, checked against its signature and
|
||||
the rules above, and translated for Vulkan (SPIR-V), Metal and DirectX 12 (HLSL) with its options at their
|
||||
defaults, minimums and maximums. Every option must be an `override` of its type in some stage; an `override`
|
||||
that is no option needs a default.
|
||||
@@ -0,0 +1,103 @@
|
||||
# Shader API
|
||||
|
||||
Horizon has no shader packs today: the earlier implementation was removed on 2026-10-24. Two things will replace it,
|
||||
designed separately: a **Horizon shader API**, described here, and a clean-room loader for the existing pack format
|
||||
(its own spec; it is not part of this API). Both sit on the same renderer hooks, agreed between the two.
|
||||
|
||||
## Overview: what a shader author will be able to do
|
||||
|
||||
Write WGSL against documented stages of Horizon's renderer, with typed inputs, options the player can change, a
|
||||
reload as soon as a file is saved and an overlay that shows what each pass costs and draws. The renderer keeps
|
||||
everything that makes it fast (culling, batching, LOD, the mesher); a pack changes how surfaces and light look, not
|
||||
how the world is fed to the GPU.
|
||||
|
||||
## The design
|
||||
|
||||
- **A pack** is a folder or a zip with `horizon-shaders.toml` (id, name, version, the `api` line, the stages it
|
||||
uses, its options) and WGSL files. No preprocessor and no other shading language: WGSL is what wgpu validates and
|
||||
compiles for Vulkan, Metal and DirectX 12.
|
||||
- **Stages, not pipelines.** A stage is a function with a fixed signature that the renderer calls inside its own pass,
|
||||
for example a terrain material (`fn material(input: TerrainInput) -> Surface`), the lighting of the visible
|
||||
surfaces, the sky, an optional shadow pass, and a chain of full-screen post passes ending in the frame. A pack
|
||||
that leaves a stage out gets vanilla's look for it.
|
||||
- **Typed inputs.** Each stage receives structs (the frame: time, camera, sun and moon, weather, fog; the surface:
|
||||
position, normal, block and its light) whose WGSL is generated from the Rust types the renderer uploads. The
|
||||
generated reference lists every field with its unit and range, and a test fails when it drifts.
|
||||
- **Options are WGSL `override` constants.** The manifest declares each option (on/off, a number in a range, a choice)
|
||||
with its default; the game shows them on the pack's settings screen and sets them when it builds the pipeline. No
|
||||
text substitution, and every option combination is validated the same way.
|
||||
- **Hot reload.** The game watches the pack's folder. A saved file is validated with naga and the stage rebuilt; on an
|
||||
error the last good version keeps drawing and the error, with its file and line, is shown in the overlay.
|
||||
- **Debug overlay.** GPU time per stage and pass (timestamp queries), the targets each pass writes (show any of them
|
||||
full-screen), the pack's options and its compile errors.
|
||||
- **Budgets.** A pack declares the targets and passes it needs; the renderer refuses more than its limits, and the
|
||||
benchmark ([benchmark-report.md](../benchmark-report.md)) records the pack and its cost, so "fast" stays measured.
|
||||
- **Off by default.** Without a pack the renderer is vanilla's look, and no pack code runs.
|
||||
|
||||
## The pack format (schema 1)
|
||||
|
||||
A pack is a folder, or the same files zipped as a `.hshader`, with `horizon-shaders.toml` at its root
|
||||
(crate `horizon-shader-api`; the sample with every key is
|
||||
`crates/horizon-shader-api/tests/samples/schema-1/`):
|
||||
|
||||
```toml
|
||||
schema = 1 # the manifest's format; a reader refuses schemas newer than it knows
|
||||
id = "soft_light" # [a-z0-9_]{1,64}: the settings key and the registry id
|
||||
name = "Soft Light"
|
||||
version = "1.0.0"
|
||||
api = "0.1" # the shader API line the WGSL is written for
|
||||
description = "..." # optional, like authors and license
|
||||
shared = ["common.wgsl"] # optional: WGSL put before every stage's file, in order
|
||||
|
||||
[sky] # each stage is optional, but a pack has at least one
|
||||
file = "sky.wgsl"
|
||||
|
||||
[material]
|
||||
file = "material.wgsl"
|
||||
|
||||
[[post]] # full-screen passes, in the order they run (8 at most)
|
||||
file = "post/grade.wgsl"
|
||||
name = "Colour grade" # optional: the GPU time overlay's label
|
||||
|
||||
[[options]] # 64 at most; `id` is the WGSL `override` it sets
|
||||
id = "saturation"
|
||||
name = "Saturation"
|
||||
type = "float" # bool, float (min, max, step), int (min, max), choice (values)
|
||||
default = 1.1
|
||||
min = 0.0
|
||||
max = 2.0
|
||||
step = 0.05
|
||||
|
||||
[budget]
|
||||
gpu_ms = 1.5 # optional: the GPU time the pack aims to add (0 to 16 ms)
|
||||
```
|
||||
|
||||
An option's `override` has the type of its kind: `bool`, `f32`, `i32`, or `u32` for a choice (the index of the
|
||||
value). The pack holds only the manifest, the `.wgsl` files it names (each used, UTF-8, 256 KiB at most),
|
||||
`README.md`, `LICENSE` (`.md`, `.txt`) and `icon.png`, under plain paths, 8 MiB in all. A `.hshader` is built
|
||||
the same way every time (files in path order, fixed dates), so a pack's SHA-256 depends only on its files.
|
||||
|
||||
## Guide, reference and examples
|
||||
|
||||
- [shaders-reference.md](shaders-reference.md): every stage's signature, input and output structs, resources and
|
||||
helpers, the frame's fields with their units, option types and limits, generated from `crates/horizon-shader-api`.
|
||||
- [The guide](../shaders.md): making a pack with `horizon-shader new`, `check` and `pack`; the templates and the
|
||||
example pack (`crates/horizon-shader-api/packs/golden_hour`).
|
||||
|
||||
## Stability
|
||||
|
||||
Not started. The first stages will be experimental (opt-in), then preview once a reference, an example and a test
|
||||
pack exist ([stability.md](stability.md)).
|
||||
|
||||
## Not there yet
|
||||
|
||||
The stages and everything that runs a pack (the format above is read and checked). The order: the renderer hooks shared with the format loader, then the material and post
|
||||
stages with options and hot reload, then the overlay, lighting, sky and shadow stages.
|
||||
|
||||
## Changelog
|
||||
|
||||
- 2026-10-25: `horizon-shader` (`new`, `check`, `pack`), three templates, the example pack and the guide.
|
||||
- 2026-10-25: the check (naga validation, signatures, options, budgets, SPIR-V/Metal/HLSL translation).
|
||||
- 2026-10-25: the stages of API 0.1 (sky, material, post), their inputs and the generated reference.
|
||||
- 2026-10-25: the pack format, schema 1: `horizon-shaders.toml` and the `.hshader` package.
|
||||
- 2026-10-24: the earlier shader pack code was removed; this API is designed from scratch.
|
||||
@@ -0,0 +1,104 @@
|
||||
# API stability and versioning
|
||||
|
||||
The rules every Horizon API follows ([the APIs](README.md)): how each one is versioned, what the stability levels
|
||||
promise, how something is deprecated and removed, and the tests that keep old mods, scripts and tools working.
|
||||
|
||||
## Versions
|
||||
|
||||
- **Each API has its own version**, separate from the game's release (`v0.2.14`, [versioning.md](../versioning.md))
|
||||
and from Minecraft's. A game release says which API versions it serves.
|
||||
- **Semantic versioning**, `MAJOR.MINOR.PATCH`. A **line** is what stays compatible: `0.1`, `0.2`, … before 1.0,
|
||||
then `1`, `2`, ….
|
||||
- Before 1.0: an addition makes the next patch (`0.1.0` → `0.1.1`); a breaking change starts the next line
|
||||
(`0.2.0`).
|
||||
- From 1.0: an addition makes the next minor (`1.0` → `1.1`); a breaking change starts the next major (`2.0`).
|
||||
- **Where the version lives:**
|
||||
|
||||
| API | The version | A user names the line they need |
|
||||
| --- | --- | --- |
|
||||
| Mods | the WIT package (`horizon:mods@0.1.0`) | `api = "0.1"` in `horizon-mod.toml` |
|
||||
| Agent control | the control protocol's version (planned: a `hello` reply and MCP `serverInfo`) | `horizon-ctl --api 1` (planned) |
|
||||
| Server control API | the path (`/api/v1/`) | the path |
|
||||
| `server.toml` | the file's keys; a key is never renamed in place | nothing: old files keep loading |
|
||||
| Launcher commands | the command names and their `--json` output | nothing |
|
||||
| Data formats | a `version` or `schema` field in the file | the reader rejects versions newer than it knows |
|
||||
|
||||
## What counts as a breaking change
|
||||
|
||||
Breaking: removing or renaming anything; changing a type, a default, a unit or a meaning; making something optional
|
||||
required; refusing input that was accepted; a new case in a WIT `enum` or `variant` the game sends to mods (an older
|
||||
component cannot decode it); a JSON field that changes type.
|
||||
|
||||
Not breaking: a new function, interface, capability, command, endpoint, tool or `server.toml` key; a new optional
|
||||
argument or JSON field (readers must ignore fields they don't know); a new WIT case the mod *sends* (the game decodes
|
||||
every case it ever served); faster, or fixing behaviour to what the reference already says.
|
||||
|
||||
## Stability levels
|
||||
|
||||
Every part of an API has one level, shown in its reference and its surface page.
|
||||
|
||||
| | Experimental | Preview | Stable |
|
||||
| --- | --- | --- | --- |
|
||||
| Who may use it | opt-in only (a flag or a manifest field naming it); never in a release default | anyone; marked "preview" where players see it (a mod's row on the Mods page) | anyone |
|
||||
| May change | in any release, without notice | only at a new line, after a deprecation | only at a new major, after a deprecation |
|
||||
| Deprecation window | none | at least 30 days, with one release line serving old and new | at least 180 days, with the old major served beside the new one |
|
||||
| Needs | a design note | a generated reference, a guide section, an example, compatibility tests | the same, plus one line of real use without a break |
|
||||
|
||||
- **Promotion.** Experimental → preview when it has what the table asks. Preview → stable when real users (a published
|
||||
mod, a host's script, an agent's tool) used it for a whole line and nothing broke. The maintainers' orchestrator
|
||||
proposes the promotion with the evidence (the compatibility tests, the complete docs, that line of use) and Ludovic
|
||||
approves it.
|
||||
- **Horizon-only by design.** An API is stable only for what Horizon itself does; a vanilla concept it exposes (a block
|
||||
id, a command, a `server.properties` key) changes when vanilla changes it, with a version port
|
||||
([version-ports.md](../version-ports.md)), and the changelog says so.
|
||||
|
||||
## Deprecation and removal
|
||||
|
||||
1. The pull request that deprecates marks it where it is defined (a `/// Deprecated: use X; goes in 0.3.` doc comment,
|
||||
WIT's `@deprecated`, a `deprecated` field in a tool's schema) and adds the replacement in the same release.
|
||||
2. The reference shows it as deprecated, and the surface page's changelog says what replaces it and when it goes.
|
||||
3. Using it logs one warning per mod, session or client, naming the replacement; it keeps working.
|
||||
4. It is removed only after the window, and only at the next line (preview) or major (stable).
|
||||
5. A line or major that is no longer served is refused with a clear message (`needs API 0.1; this Horizon serves 0.3
|
||||
and 0.4`), never loaded half-way.
|
||||
|
||||
## Compatibility tests
|
||||
|
||||
Every preview and stable API has tests that run old users against the current code, in CI:
|
||||
|
||||
| API | The test |
|
||||
| --- | --- |
|
||||
| Mods | a test mod per served line, built from source against that line's WIT and SDK, loaded by today's runtime with expected output (`crates/horizon-mods/tests/`); a line is served as long as its test mod passes |
|
||||
| Agent control | a transcript per protocol version: commands and the reply keys each must have |
|
||||
| Server | `api::ROUTES` against `route()` (generated reference); a `server.toml` from each release line parses to the same settings; golden replies per endpoint |
|
||||
| Launcher | the generated reference; golden `--json` output per command |
|
||||
| Data formats | a sample file of every version a reader accepts, read by today's reader |
|
||||
|
||||
The generated references are the API's own diff: a pull request that changes an API changes its reference, and the
|
||||
reviewer applies the rules above to that diff.
|
||||
|
||||
## Changelog
|
||||
|
||||
Each surface page ends with a changelog: one line per change, newest first, with the API version and the pull request.
|
||||
Deprecations and breaking changes are in bold. The release notes of the game release that ships a change link it.
|
||||
|
||||
## Today
|
||||
|
||||
| Part | Level | Version |
|
||||
| --- | --- | --- |
|
||||
| Mod API: `log`, `game`, `chat`, `hud`, `storage`, `command`, `events` | preview | 0.1.0 |
|
||||
| Mod API: `ui`, `ui-events` (a mod's screens and settings page) | experimental | manifest `experimental = ["ui"]` |
|
||||
| Content mods (`registries`: data-driven blocks and items) | preview | manifest `api = "0.2"` |
|
||||
| Server mods (events, world, server commands) | not started | manifest `api = "0.3"`, experimental first |
|
||||
| Script mods (Lua run by an interpreter mod, [mods.md](mods.md#ways-in)) | not started | |
|
||||
| `cargo horizon-mod` (`new`, `build`, `run`), `horizon-mod-sdk` | preview | 0.1.0 |
|
||||
| Shader API | not started | |
|
||||
| `horizon-ctl` commands and MCP tools | preview | none yet (unversioned) |
|
||||
| The game's own control-socket commands outside `horizon-ctl`'s table (test hooks) | experimental | |
|
||||
| `horizon-server` commands, `server.toml` | stable | `horizon-server --version` |
|
||||
| Server control API | stable | `/api/v1` |
|
||||
| `horizon-launcher` commands and MCP tools | preview | none yet (unversioned) |
|
||||
| Benchmark report | stable | `"version": 1` |
|
||||
| Telemetry batch and consent | stable | `"schema": 1`, consent `2` |
|
||||
| `horizon-graphics.txt`, `horizon-extras.txt`, `horizon-mods.txt` | preview | none |
|
||||
| `SHA256SUMS` and `SHA256SUMS.sig` | stable | |
|
||||
@@ -0,0 +1,57 @@
|
||||
# Architecture: feature → files → checks
|
||||
|
||||
The 40 areas changed most often in the 30 days to 2026-10-23 (commits on main touching the area; `game.rs` is
|
||||
counted only for the game loop because nearly every gameplay change touches it). The crate map, how `Game` is
|
||||
organised and how to build and test are in [AGENTS.md](../AGENTS.md).
|
||||
|
||||
Paths: `L/` = `crates/horizon-client/src/`, `G/` = `crates/horizon-client/src/game/`, `W/` =
|
||||
`crates/horizon-world/src/`. Checks: a bare name is a harness (`python3 tools/parity.py <name>`, script
|
||||
`tools/test_<name>_parity.py`); `lan_e2e <check>` is `python3 tools/lan_e2e.py --check <check>`.
|
||||
|
||||
For the full set of harnesses a file can affect, ask the runner:
|
||||
`printf '%s\n' <paths> > /tmp/p.txt && python3 tools/parity.py --changed-files /tmp/p.txt --list`.
|
||||
Any file of the game binary (`game.rs`, `game/`) selects the ~25 harnesses that run the binary; a client lib
|
||||
file selects ~103.
|
||||
|
||||
| # | Area (commits) | Files | Checks |
|
||||
|---|---|---|---|
|
||||
| 1 | Game loop, tick order, frame pacing (554) | `L/game.rs` (`fn tick`, `fn tick_world`, `fn render`, `about_to_wait`), `L/clock.rs`, `L/window.rs`, `L/spans.rs` | game_loop, frame_limiter, interaction_input, tick |
|
||||
| 2 | Mobs in the game loop, spawning (166) | `G/creatures.rs`, `G/natural_spawning.rs`, `L/mobs/spawning.rs`, `L/mobs/spawn_rules.rs`, `L/mobs/spawn_selection.rs`, `L/mobs/finalize.rs`, `G/spawner.rs`, `G/trial_spawner.rs` | natural_spawn, spawn_rules, finalize_spawn, spawner, trial_spawner, mob_ai |
|
||||
| 3 | World save and load (163) | `L/save.rs`, `G/saving.rs`, `G/persist.rs` (entities), `L/entity_nbt.rs`, `L/block_entity_nbt.rs`, `W/region.rs`, `W/nbt.rs` | save_roundtrip, world_reopen, world, datafix |
|
||||
| 4 | World generation (153) | `W/worldgen.rs`, `W/worldgen/` (`generator*.rs`, `feature_graph.rs`, `structure/`, `placement/`), `L/vanillagen.rs` | chunk_generation, worldgen, server_world_gen, world_spawn, feature_graph, feature_placement, decoration and the other worldgen harnesses |
|
||||
| 5 | Multiplayer client, packets in (145) | `G/remote.rs` (`fn handle_packet`, `fn tick_remote`), `G/remote_*.rs`, `L/net.rs` | dedicated_server, server_entities, lan_e2e (all) |
|
||||
| 6 | Agent control, horizon-ctl (145) | `L/control.rs`, `L/bin/horizon-ctl/`, `G/control.rs`, `G/agent.rs`, `G/events.rs`, `G/ui_control.rs` | `python3 tools/agent_control_e2e.py`; `cargo test -p horizon-client --bin horizon-ctl` |
|
||||
| 7 | CI and release (134) | `.github/workflows/` (`ci.yml`, `parity.yml`, `release.yml`, `launcher.yml`), `tools/ci/`, `tools/parity.py`, `tools/pr_ready.py` | `python3 -m unittest discover -s tests`; actionlint (`.github/actionlint.yaml`) |
|
||||
| 8 | LAN host: connections, play state, tracking (133) | `L/lan/` (`conn.rs`, `hub.rs` + `hub/`, `chunks.rs`, `entity.rs`, `tracking.rs`, `guest.rs`, `playerdata.rs`), `G/lan.rs` | lan, lan_e2e (all), `cargo test -p horizon-client --test lan_bot` |
|
||||
| 9 | Renderer core (132) | `L/gfx.rs` (`Renderer::new`, `Renderer::render`), `L/gfx/` (cull, occlusion, translucency, upload, timing, lod) | client_graphics, culling_rays, translucency; `horizon-client --benchmark standard` |
|
||||
| 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` | `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 |
|
||||
| 17 | HUD, chat, tab list (93) | `L/hud.rs`, `L/hud_layout.rs`, `L/hud_overlays.rs`, `L/chat.rs`, `G/chat.rs`, `L/tab_list.rs`, `L/locator_bar.rs`, `G/locator_bar.rs` | hud, tab_list, locator_bar, chat_screen, secure_chat |
|
||||
| 18 | Command execution (88) | `G/commands.rs`, `G/commands/*.rs`, `L/scoreboard_cmd.rs`, `L/data_cmd.rs`, `G/functions.rs` | command_exec (corpus `tools/command_exec_corpus.py`), scoreboard, server_ops_feedback, lan_e2e commands |
|
||||
| 19 | Chunk streaming, light, tickets (85) | `L/streaming.rs`, `L/world.rs`, `L/chunk.rs`, `L/chunk_map.rs`, `L/light.rs`, `L/ticket_levels.rs`, `L/tick_chunk_membership.rs`, `G/world_loading.rs` | light, chunk_status, random_tick_sections; `cargo test -p horizon-client --test streaming_meshes` |
|
||||
| 20 | Mob models and animation (78) | `L/mobs/render.rs`, `L/mobs/anim.rs`, `L/mobs/body_anim.rs`, `L/mobs/keyframes.rs`, `L/entity.wgsl` | entity_model |
|
||||
| 21 | Block behaviour, server side (78) | `W/level/` (`mod.rs`, `tick.rs`, `hooks.rs`, `data.rs`, `redstone.rs`, `place.rs`), `G/block_entity_ticks.rs`, `G/moving_pistons.rs` | block_update, redstone, random_tick, simple_block, piston_movement, block_entity_tickers |
|
||||
| 22 | Player movement and collision (75) | `L/motion.rs` + `L/motion/`, `L/collisions.rs`, `W/entity_move.rs`, `W/player_travel.rs`, `W/collision.rs` | collision, entity_move, player_travel, living_motion, climbing, swimming; `python3 tools/test_native_scene_motion.py` |
|
||||
| 23 | Resource packs and models (65) | `L/packs.rs` + `L/packs/`, `L/pack_screen.rs`, `L/atlas_sources.rs`, `L/sprites.rs`, `L/model_library.rs`, `G/packs.rs`, `crates/horizon-assets/` | resource_pack, pack_selection, pack_screen, model_resolution, item_model, mipmap |
|
||||
| 24 | Container menus and inventory (61) | `L/menu.rs`, `L/container_screen.rs`, `L/containers.rs`, `L/creative.rs`; game.rs `fn menu_ops`, `fn click_inventory` | menu_click, container_screen, creative, lan_e2e containers clicks |
|
||||
| 25 | Workstations (60) | `L/stations.rs`, `G/stations.rs`, `L/enchant.rs`, `L/brewing.rs` | enchanting, screen_layout, lan_e2e brewing loom stonecutter grindstone anvil smithing |
|
||||
| 26 | Crafting and the recipe book (59) | `L/crafting.rs`, `L/recipe_book.rs`, `L/recipe_book_screen.rs`, `G/recipe_book.rs`, `G/machines.rs`, `G/machines/crafter.rs` | recipe, recipe_book, recipe_book_view, place_recipe, ghost_recipe, crafter |
|
||||
| 27 | Vehicles and mounts (54) | `G/boats.rs`, `G/boat_passengers.rs`, `G/minecarts.rs`, `G/mounts.rs`, `G/mount_menu.rs`, `G/llamas.rs`, `G/passengers.rs` | server_entities, lan_e2e boats minecarts riding mounts |
|
||||
| 28 | Villagers, trading, raids (50) | `L/mobs/villager*.rs`, `L/merchant.rs`, `G/trading.rs`, `G/villagers.rs`, `L/raid.rs`, `G/raids.rs`, `L/gossip.rs` | trading, raid, mob_ai |
|
||||
| 29 | Title, worlds, startup (49) | `L/title.rs` + `L/title/`, `G/startup_menu.rs`, `L/title_edition.rs` | world_options; `cargo test -p horizon-client --lib title` |
|
||||
| 30 | Dedicated server, horizon-server (48) | `G/dedicated.rs`, `G/dedicated/status.rs`, `crates/horizon-server/`, `crates/horizon-server-files/` | dedicated_server, server_files, user_cache, online_mode, server_ops_feedback |
|
||||
| 31 | Particles and client effects (46) | `L/particles.rs`, `G/render_tick.rs`, `G/level_particles.rs`, `L/animate_tick.rs` | particle_providers, block_particles, entity_particles, emitter_particles, marker_particles |
|
||||
| 32 | Bosses and the End (45) | `G/dragon.rs`, `G/wither.rs`, `G/end.rs` | server_dragon, end_podium, end_gateway |
|
||||
| 33 | Protocol and packets (44) | `crates/horizon-protocol/src/` (`packets/play.rs`, `entity_data.rs`, `connection.rs`) | dedicated_server, online_mode, secure_chat; `cargo test -p horizon-protocol` |
|
||||
| 34 | Multiplayer and LAN screens, friends (44) | `L/multiplayer.rs`, `G/lan_screen.rs`, `G/friends.rs`, `L/friends_screen.rs`, `crates/horizon-friends/`, `crates/horizon-relay/` | lan, world_options; `python3 tools/test_friends.py` |
|
||||
| 35 | Dispensers (43) | `G/dispenser.rs`, `G/dispense_fixture.rs` (the harness side) | dispenser |
|
||||
| 36 | Audio and music (38) | `L/audio.rs`, `L/sound_engine.rs`, `L/sound_events.rs`, `L/music.rs`, `G/music.rs`, `L/ambience.rs`, `G/subtitle_hud.rs` | sound_engine, sound_event, music, situational_music, ambient_sound, subtitle |
|
||||
| 37 | Integrated server and levels (34) | `G/integrated.rs`, `G/levels.rs`, `G/server_travel.rs` | server_dimension_players, `lan_e2e --server-thread` (portals, levels, distance, lava) |
|
||||
| 38 | Command parsing (34) | `L/command/` (`args.rs`, `selector.rs`, `tree_*.rs`, `vanilla.rs`) | command_parse (corpus `tools/command_parse_corpus.py`) |
|
||||
| 39 | Benchmarks and telemetry (34) | `L/benchmark.rs`, `tools/perf_bench.py`, `L/telemetry.rs`, `crates/horizon-telemetry*/`, `crates/horizon-bench/` | `python3 -m unittest tests.test_perf_bench`; [benchmark.md](benchmark.md) |
|
||||
| 40 | Explosions and TNT (31) | `G/explosion.rs`, `G/tnt.rs` | lan_e2e blast; no dedicated harness yet |
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -137,8 +137,8 @@ Geist (400, 500, 600) and Geist Mono (400), bundled under the SIL Open Font Lice
|
||||
- **Launcher** (`launcher/`): drawn in the Blocks look below. A top bar (wordmark, the pages as
|
||||
tabs, the account chip, Settings), a sidebar (the instances, the hosted servers, the launcher's
|
||||
own version and channel at its foot), and the page over a stone texture. Home opens on a pixel
|
||||
landscape banner with the hero, the version picker and Play; Mods holds the resource pack,
|
||||
shader pack and modpack tabs; Versions and Patch notes are lists of panels; Settings is
|
||||
landscape banner with the hero, the version picker and Play; Mods holds the mod, resource pack
|
||||
and modpack tabs; Versions and Patch notes are lists of panels; Settings is
|
||||
grouped panels of rows. Dark by default, Light or System in Settings (Appearance).
|
||||
- **Website** (`website/`): the Blocks look below. The same page structure as before (what it
|
||||
is, screenshots, parity, launcher, patch notes, community), headings in Pixelify Sans, lists as
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ Horizon category in Controls, and adding one would put a non-vanilla mapping int
|
||||
|
||||
### Dynamic lights (`dynamicLights`, default off)
|
||||
- A light source held by a player or mob (main or off hand), dropped as an item, or an entity on
|
||||
fire lights the blocks, entities and hand around it, as LambDynamicLights and OptiFine do. Not
|
||||
fire lights the blocks, entities and hand around it, as dynamic-light mods do. Not
|
||||
in vanilla; the idea is ported, not a mod's code (issue #814).
|
||||
- An item glows like its block's default state (`getLightEmission`): torches 14, lanterns,
|
||||
glowstone, sea lanterns and jack o'lanterns 15, soul torches 10, a redstone torch 7; a lava bucket
|
||||
|
||||
+1
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
## Settings
|
||||
|
||||
Horizon's graphics settings are two screens built from vanilla's widgets, opened from the top of **Video Settings** (**Horizon Graphics...** and **Advanced Graphics...**, beside **Shader Packs...**, where Sodium and Iris put theirs) or from **Options → Horizon Settings...**:
|
||||
Horizon's graphics settings are two screens built from vanilla's widgets, opened from the top of **Video Settings** (**Horizon Graphics...** and **Advanced Graphics...**) or from **Options → Horizon Settings...**:
|
||||
|
||||
- **Graphics** (Simple): a preset (Performance, Balanced, Quality, Ultra or Custom) and LOD distance.
|
||||
- **Advanced Graphics**: every Horizon setting, grouped under Rendering, Quality, Display, Preferences, Performance and Overlay.
|
||||
@@ -45,8 +45,6 @@ Coverage and detail improve progressively; a large selected radius does not mean
|
||||
|
||||
Ordinary Overworld atmospheric fog extends with the selected LOD distance. Fog Off disables distance haze at large ranges too; fluid, darkness and boss fog retain their limits.
|
||||
|
||||
LOD terrain enters the existing world colour and depth passes, so supported shader-pack postprocessing can see it. This does not add Iris material passes or shadow maps: Java packs still have the [existing fullscreen-pass limitations](shader-packs.md). Shader appearance and transitions need testing with the selected pack.
|
||||
|
||||
The setting is stored as `lodDistance` in `horizon-graphics.txt`; `0` disables it. Existing `renderDistance` in `options.txt` keeps its normal meaning for full chunks.
|
||||
|
||||
Not implemented: anisotropic filtering (wgpu needs linear magnification for it, which blurs close blocks), MSAA (FXAA instead) and exclusive fullscreen (fullscreen is borderless).
|
||||
|
||||
@@ -94,7 +94,7 @@ Every command `horizon-ctl` takes, its MCP tool in `horizon-ctl mcp` (the launch
|
||||
| `respawn` | `respawn` | Respawn from the death screen | none |
|
||||
| `pause` | `pause` | Open the pause menu | none |
|
||||
| `resume` | `resume` | Leave the pause menu | none |
|
||||
| `options [PAGE]` | `options` | Open the options screen, or one of its pages (Horizon's too) | `page` (main, video, sound, controls, keybinds, controller, controller-binds, mouse, chat, accessibility, language, font, packs, mods, graphics, graphics-advanced, extras, horizon, shader-packs, agent): the page (default: the main options) |
|
||||
| `options [PAGE]` | `options` | Open the options screen, or one of its pages (Horizon's too) | `page` (main, video, sound, controls, keybinds, controller, controller-binds, mouse, chat, accessibility, language, font, packs, mods, graphics, graphics-advanced, extras, horizon, agent): the page (default: the main options) |
|
||||
| `book [next\|back\|take\|done]` | `book` | The open book or lectern: its page text, or press one of its buttons | `action` (next, back, take, done): a button to press |
|
||||
| `signedit X Y Z [front\|back]` | `signedit` | Open the sign editor of the sign at X Y Z (then type and close) | `x` (integer, required): block X<br>`y` (integer, required): block Y<br>`z` (integer, required): block Z<br>`side` (front, back): which side |
|
||||
| `mount-menu` | `mount_menu` | Open the inventory of the horse, donkey, mule or llama being ridden | none |
|
||||
|
||||
@@ -165,6 +165,8 @@ hardcore = false
|
||||
# Any other server.properties key, spelled as vanilla spells it:
|
||||
[properties]
|
||||
# spawn-protection = 16
|
||||
# resource-pack = "https://example.com/pack.zip" # offered to players as they join; with
|
||||
# resource-pack-sha1, require-resource-pack and resource-pack-prompt, as on vanilla
|
||||
|
||||
[engine]
|
||||
path = "" # the game program; empty: the one beside horizon-server
|
||||
@@ -216,6 +218,9 @@ horizon-server rollback back to the release before
|
||||
While the server runs, `op`, `whitelist` and `cmd` go to the game's console, so they act exactly as vanilla's
|
||||
console commands do. While it's stopped, they edit vanilla's files directly. Any console command works through
|
||||
`cmd`: `horizon-server cmd ban Griefer`, `horizon-server cmd say Restarting in 5 minutes`.
|
||||
To generate the world around spawn ahead of the players, Horizon has its own `pregen` command, off until
|
||||
`server.toml` has `horizon-pregen = true` under `[properties]`: `horizon-server cmd pregen start 2500`
|
||||
([pregeneration](pregeneration.md)).
|
||||
|
||||
`config set` changes `server.toml` without opening it: `horizon-server config set world.difficulty=hard
|
||||
server.max_players=10`. Each key is a section and a name from the file (`properties.spawn-protection=0` for any
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# How Horizon is built
|
||||
|
||||
Who writes Horizon, how changes are checked, and why it is safe to run. You can check every claim on this page in the repository, and anything not done yet is marked as not done.
|
||||
|
||||
This page is also on the website: [playhorizon.dev/docs/how-horizon-is-built](https://playhorizon.dev/docs/how-horizon-is-built). The longer version, with what is still missing, is [Security](security.md).
|
||||
|
||||
## Who builds it
|
||||
|
||||
Horizon is Ludovic Marie's project: he decides what it does and what ships. **Most of the code is written by AI agents**: Claude sessions that Ludovic runs, and contributors' own AI tools. Some contributors write their code by hand.
|
||||
|
||||
Agents say what they are. A pull request opened by one of Ludovic's agents starts with "Opened by Ludovic's AI agent (Claude), not by Ludovic himself.", its comments start with "🤖 Agent:", and its commits name the agent in a `Co-Authored-By` line.
|
||||
|
||||
## How changes are checked
|
||||
|
||||
Not every line is read by a person. Instead, every change is checked against the real game, automatically:
|
||||
|
||||
- **Harnesses.** A harness is a test that gives the same inputs to Horizon and to the real Minecraft 26.3, then compares the results. There are 326 of them (25 October 2026), from world generation to mobs, redstone and commands. The [status table](https://playhorizon.dev/#parity) shows what they cover. Passing them all does not prove that nothing else differs.
|
||||
- **Checks on every pull request.** `verify` runs on GitHub's machines for every pull request and every change to main: formatting, lints with warnings treated as errors, the tests, and the check that no Minecraft files are committed. Main takes no change without it. `parity` runs the harnesses a change can affect, on a machine that holds a copy of Minecraft. For a pull request from a fork, it runs once a maintainer has read the change.
|
||||
- **Outside contributions are checked again.** Before a contributor's pull request merges, Ludovic's agents compare what it claims with vanilla's own code, review it line by line, rewrite the weak parts, and test it in single player, on a LAN and on a dedicated server where those apply.
|
||||
- **Releases are tested first.** A release is published only after its smoke test passes (the game starts and draws a world) and while no issue is labelled `release-blocker`.
|
||||
|
||||
## Why it's safe to run
|
||||
|
||||
- **Open source.** All of the code is public on [GitHub](https://github.com/ludovic111/horizon), under the MIT licence.
|
||||
- **Built from the public code.** Releases are built by GitHub Actions, the build service of GitHub, from the public source. Linux and Windows are built on GitHub's machines, and macOS on Ludovic's Mac mini, which runs GitHub Actions jobs. Every build log is [public](https://github.com/ludovic111/horizon/actions/workflows/release.yml).
|
||||
- **Signed checksums.** Every release has a `SHA256SUMS` file, a fingerprint of each download, and `SHA256SUMS.sig`, a signature of that list made with Horizon's release key, which only release builds from main can use. The launcher and `horizon-server update` check both before they install anything, and refuse a file that does not match. The very first server install with `install.sh` checks the fingerprint but not the signature.
|
||||
- **Not yet signed by Apple or Microsoft.** The macOS app is not notarized by Apple, because it is not signed with a paid Apple developer account, so macOS asks you to confirm the first time ([Install](https://playhorizon.dev/docs/install#download-the-launcher) shows how). The Windows programs are not code-signed either, so Windows may warn you too.
|
||||
- **Mods run in a sandbox.** Horizon mods are WebAssembly programs with no access to your files, the network or other programs. A mod lists what it needs, you see that list before you turn it on, and it can do nothing else. See [Mods](mods.md).
|
||||
- **Nothing collected unless you say yes.** Data collection is off until you turn it on, with four separate switches. The one exception is an anonymous "I'm playing" ping for the launcher's player count, which holds nothing about you. See [Opt-in data collection](telemetry.md).
|
||||
|
||||
## What it doesn't contain
|
||||
|
||||
- **No Minecraft files.** Horizon contains no Minecraft code, assets or data, and never downloads them. The launcher builds the game files on your computer from your own copy of Minecraft: Java Edition 26.3. A check that runs on every pull request (`tools/check_public_tree.py`) keeps game files and decompiled code out of the repository and its history.
|
||||
- **No code from other mods.** Since 24 October 2026, Horizon's code may only be written from Minecraft 26.3 itself and public documentation, never from another mod, loader or renderer ([the rule](../CONTRIBUTING.md#only-original-code)). That day shader packs were removed ([#1561](https://github.com/ludovic111/horizon/pull/1561)), after a developer of Iris showed that our shader pack code had been written from Iris's source. They are being written again from a description of the pack format only.
|
||||
|
||||
## Check it yourself
|
||||
|
||||
- **Read the code and its checks.** [The source](https://github.com/ludovic111/horizon), [the checks on every pull request](https://github.com/ludovic111/horizon/actions/workflows/ci.yml) and [the release builds](https://github.com/ludovic111/horizon/actions/workflows/release.yml).
|
||||
- **Compare the fingerprints.** Put a release's files and its `SHA256SUMS` in one folder and run `sha256sum -c SHA256SUMS --ignore-missing` (on macOS `shasum -a 256 -c SHA256SUMS --ignore-missing`, on Windows `Get-FileHash <file>` in PowerShell). Each file should say `OK`.
|
||||
- **Check the signature.** Download a whole release into a folder, then from a clone of the repository run `cargo run -p horizon-release-sign -- verify --tag <tag> <folder>`. The public key is in `crates/horizon-release-sign/release-keys.txt`.
|
||||
- **Build it yourself.** The README explains how to [build from source](../README.md#build-from-source).
|
||||
@@ -1,109 +0,0 @@
|
||||
# Java performance packs (no longer developed)
|
||||
|
||||
Before the Rust rewrite, Horizon was a lab for Minecraft Java client performance: pinned Fabric performance packs, distant terrain, an original frame and tick recorder, and client and server starter downloads (the server starter is gone: [horizon-server](hosting.md) replaces it). This track is **no longer developed**. No release downloads are published; build the packs and starters locally with `python3 tools/build_release.py` (see [Build and run](#build-and-run)). This page keeps its documentation.
|
||||
|
||||
## Java packs: Mac starter (out of scope)
|
||||
|
||||
Build **horizon-mac-starter-0.21.0.zip** with `python3 tools/build_release.py` (it lands in `dist/`), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials.
|
||||
|
||||
Use native **Java 25 ARM64**, maximum heap **6144 MiB**, minimum **512 MiB** on a 16 GB M2 Pro Mac. Prism can download Java automatically. Start at 1280×800 or 1920×1200; full Retina resolution is a larger GPU workload. [START-HERE.txt](../packs/START-HERE.txt) has details. The same `.mrpack` files import into Prism on Windows and Linux.
|
||||
|
||||
Core and balanced passed macOS title and demo-world rendering probes on the hosted
|
||||
ARM64 software renderer, including readback, saves and clean exits. Physical M2
|
||||
GPU performance and macOS 27 were never tested.
|
||||
|
||||
| Profile | Full-detail chunks | Distant LOD radius | Suggested maximum heap |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| baseline | 12 | none | 6144 MiB |
|
||||
| core-performance | 12 | none | 6144 MiB |
|
||||
| m2-balanced | 12 | 128 | 6144 MiB |
|
||||
| adaptive (experiment) | 12 | 128 | 6144 MiB |
|
||||
| worker-pacing (experiment) | 12 | 128 | 6144 MiB |
|
||||
| adaptive-pacing (experiment) | 12 | 128 | 6144 MiB |
|
||||
| queue-wait (experimental) | 12 | 128 | 6144 MiB |
|
||||
| adaptive-queue (experimental) | 12 | 128 | 6144 MiB |
|
||||
| dispatch-retry (experimental) | 12 | 128 | 6144 MiB |
|
||||
| tick-dedup (experimental) | 12 | 128 | 6144 MiB |
|
||||
| culling-empty (experimental) | 12 | 128 | 6144 MiB |
|
||||
| quad-reuse (experimental) | 12 | 128 | 6144 MiB |
|
||||
| terrain-position (experimental) | 12 | 128 | 6144 MiB |
|
||||
| culling-rays (experimental) | 12 | 128 | 6144 MiB |
|
||||
| foreground-first (combined experiment) | 12 | 128 | 6144 MiB |
|
||||
| foreground-vulkan (combined experiment) | 12 | 128 | 6144 MiB |
|
||||
| low-memory | 8 | none | 3072 MiB |
|
||||
| far-distance | 12 | 256 | 8192 MiB, with sufficient physical RAM |
|
||||
| cinematic | 12 | 128 | 6144 MiB |
|
||||
| vulkan | 12 | 128 | 6144 MiB |
|
||||
|
||||
Balanced combines [Sodium](https://modrinth.com/mod/sodium), [Lithium](https://modrinth.com/mod/lithium), [FerriteCore](https://modrinth.com/mod/ferrite-core), [ImmediatelyFast](https://modrinth.com/mod/immediatelyfast), [EntityCulling](https://modrinth.com/mod/entityculling), and [Distant Horizons](https://modrinth.com/mod/distanthorizons). Cinematic adds [Iris](https://modrinth.com/mod/iris) and [Complementary Reimagined](https://modrinth.com/shader/complementary-reimagined), initially disabled. Vulkan independently experiments with the game's own backend and fallback, without Iris.
|
||||
|
||||
Distant LOD is simplified terrain. Nearby blocks retain full detail. Initial generation costs CPU/disk/memory and needs warm-up. DH adjusts clouds, chunk fade and transparency to blend its renderer; assess appearance as well as speed. Shaders cost GPU time and have [Mac-specific limits](https://shaders.properties/current/reference/miscellaneous/macos/). Universal CPU/GPU support and exact vanilla equivalence remain validation goals. Simulation distance stays 12 in every profile; normal 20 TPS rules are retained.
|
||||
|
||||
For the first comparison at the same view distance, use `baseline` versus
|
||||
`core-performance`: both select 12 full-detail chunks and no distant LOD or shaders.
|
||||
The latter adds only the pinned core performance mods and leaves every original
|
||||
controller disabled. Then test balanced separately for its additional distant
|
||||
terrain. Matching captured settings does not prove pixel-identical rendering.
|
||||
|
||||
The profiles marked *experiment* each isolate one change to Distant Horizons,
|
||||
EntityCulling or the JVM (adaptive terrain throttling, precise worker pacing,
|
||||
debounce-queue waits, rejected-dispatch retries, empty culling whitelists,
|
||||
culling ray scratch vectors, terrain quad reuse, terrain position arithmetic,
|
||||
tick membership storage, a smaller heap, compact object headers). Each kept the
|
||||
upstream behaviour it replaced and was measured only on Linux software rendering,
|
||||
where none showed a gain large enough to enable by default; balanced keeps them
|
||||
all off. Their write-ups were removed once the Rust rewrite replaced this track;
|
||||
they remain in Git history. Matched software-rendered pairs showed `core-performance`
|
||||
14–21% faster than `baseline`, and Vulkan about 1.5% more FPS for about 12% more
|
||||
CPU; neither is evidence for a Mac GPU.
|
||||
|
||||
To try the game's own Vulkan backend on a Mac, see [Vulkan on your Mac](vulkan.md);
|
||||
to compare garbage collectors, see [collector comparisons](collectors.md).
|
||||
|
||||
## Measure on your hardware
|
||||
|
||||
Press **F8** during gameplay to start a 120-second recording, or again to stop early. Rebind in Controls if needed. This also works with restricted chat accounts. Alternatively: `/horizon bench <label> 120`, `/horizon stop`, `/horizon status`.
|
||||
|
||||
Use separate identical world copies and the same camera route, resolution, render/simulation distance, heap, VSync and FPS limit. Warm up, then alternate at least three baseline/optimized runs. Test fresh chunk exploration separately. For everyday play cap FPS or enable VSync to reduce power usage.
|
||||
|
||||
The instance's `horizon-benchmarks/` folder receives JSON/CSV frame and integrated-server tick timings: average FPS, slowest-1%-average FPS, p95/p99 durations, stalls, JVM heap/GC, sampled process RSS when available, GPU/backend/driver and render settings. Frames include presentation/limiting waits and exclude menus/pauses/unfocused time. Tick `meanRate` is execution capacity, **not TPS**; observed tick counts are separate. Version 0.20 [captures sampled tick-manager state](tick-state.md), including restored freeze/step/sprint/rate changes; this does not measure completed world work. Resident process memory is sampled on a shared background thread only during recordings; it includes native resident pages, while heap measures JVM objects. Neither is a complete measurement of unified GPU memory. [Memory measurement details](process-memory.md).
|
||||
|
||||
```sh
|
||||
python3 tools/compare_benchmarks.py baseline-frames.json optimized-frames.json --strict
|
||||
```
|
||||
|
||||
Open `Compare-Benchmarks.html` from the starter ZIP or [the source file](../tools/Compare-Benchmarks.html) in your browser to compare without Python. Select each JSON and optionally its matching CSV. It exports summary JSON, flags settings and duration differences, and charts frames by recorded active time or ticks by sample number. It is self-contained and makes no network requests.
|
||||
|
||||
|
||||
|
||||
The comparison flags captured setting differences, but cannot verify route, world, shader state or cache warm-up. Software-renderer test FPS is not evidence of a Mac/GPU speedup.
|
||||
|
||||
For CPU/allocation investigation, [capture and stream a private JFR summary](profiling.md).
|
||||
It distinguishes directly observed allocation counters from sampled hot methods;
|
||||
profiling runs remain separate from normal timing comparisons.
|
||||
|
||||
## Build and run
|
||||
|
||||
Requires Python 3.10+ and JDK 25. No Gradle, Rust or native compilation is required for playable packs.
|
||||
|
||||
```sh
|
||||
python3 tools/build_mod.py
|
||||
python3 tools/build_release.py
|
||||
```
|
||||
|
||||
Gitignored `dist/` contains twenty packs, our original instrumentation JAR, the client starter ZIP and SHA256SUMS. [mods.lock.json](../packs/mods.lock.json) pins mod versions, exact dependency closure, SHA-1/SHA-512 and source/license; [fabric.lock.json](../packs/fabric.lock.json) pins loader/library SHA-256. Packs use the [Modrinth format](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack). They embed only original project code; third-party mods, game and assets download from their publishers.
|
||||
|
||||
The Fabric server starter (Lithium/FerriteCore, `tools/server.py`) was retired on 2026-10-19. To host a server, use [horizon-server](hosting.md) ([playhorizon.dev/server](https://playhorizon.dev/server)); its benchmarks are in [server.md](server.md), section 9.
|
||||
|
||||
Local smoke testing uses the game's built-in limited demo; normal play uses Prism's licensed account authentication:
|
||||
|
||||
```sh
|
||||
python3 tools/build_pack.py --profile m2-balanced --instance .local/runtime/m2-balanced
|
||||
vscreen run python3 tools/runtime.py demo --instance .local/runtime/m2-balanced
|
||||
```
|
||||
|
||||
The standalone demo launcher applies the pinned official manifest's conditional
|
||||
JVM flags, including macOS `-XstartOnFirstThread` and the Windows heap-dump-path
|
||||
option. Prism applies its own official manifest. Server JVM policy is separate;
|
||||
this launcher correction is not a measured graphics performance improvement.
|
||||
|
||||
@@ -3,3 +3,6 @@
|
||||
Every game release lists the bullets below under "Known issues" (tools/release_train.py). Keep them short and
|
||||
written for players; remove a bullet in the pull request that fixes it.
|
||||
|
||||
- Shader packs have been removed for now. They will come back later, written again from scratch. Packs in your
|
||||
`shaderpacks` folder are left where they are.
|
||||
|
||||
|
||||
+24
-14
@@ -130,16 +130,6 @@ Play offline, without an account.
|
||||
|
||||
MCP: `account_offline`.
|
||||
|
||||
## `horizon-launcher update-channel`
|
||||
|
||||
Show or set which Horizon releases install by themselves: stable (a tested build about once a day) or alpha (every release as soon as it is built; can break).
|
||||
|
||||
horizon-launcher update-channel [CHANNEL]
|
||||
|
||||
- `CHANNEL` (stable, alpha): Omit to show the current channel
|
||||
|
||||
MCP: `update_channel`.
|
||||
|
||||
## `horizon-launcher settings`
|
||||
|
||||
Show the launcher's settings, or set one (the Settings page): selected-version TAG, minecraft-dir PATH, server-dir PATH ("default" resets a folder), install-new-versions on|off, opening-animation on|off.
|
||||
@@ -331,9 +321,9 @@ Search for packs Horizon loads.
|
||||
horizon-launcher mods search [TEXT]...
|
||||
|
||||
- `TEXT`
|
||||
- `--kind` (mod, resource, shader, modpack)
|
||||
- `--kind` (mod, resource, modpack)
|
||||
- `--everything`: Also what was made for other versions or runs only partly, each marked
|
||||
- `--source` (modrinth, curseforge)
|
||||
- `--source` (modrinth, curseforge, horizon)
|
||||
|
||||
MCP: `mods_search`.
|
||||
|
||||
@@ -345,7 +335,7 @@ Say how well a Java mod runs in Horizon: its jar is downloaded (checksum checked
|
||||
|
||||
- `PROJECT`
|
||||
- `--everything`: Allow a version made for another Minecraft version (1.21 and later)
|
||||
- `--source` (modrinth, curseforge)
|
||||
- `--source` (modrinth, curseforge, horizon)
|
||||
|
||||
MCP: `mods_check`.
|
||||
|
||||
@@ -357,7 +347,7 @@ Install a pack and what it needs, by its id or slug (checksums checked); a Java
|
||||
|
||||
- `PROJECT`
|
||||
- `--everything`: Allow a version made for another Minecraft version
|
||||
- `--source` (modrinth, curseforge)
|
||||
- `--source` (modrinth, curseforge, horizon)
|
||||
|
||||
MCP: `mods_install`.
|
||||
|
||||
@@ -382,6 +372,26 @@ Remove a pack the browser installed.
|
||||
|
||||
MCP: `mods_remove`, needs `confirm: true`.
|
||||
|
||||
## `horizon-launcher mods enable`
|
||||
|
||||
Turn on a mod the browser installed (horizon-mods.txt, as the game's Options > Mods does).
|
||||
|
||||
horizon-launcher mods enable <PROJECT>
|
||||
|
||||
- `PROJECT`
|
||||
|
||||
MCP: `mods_enable`.
|
||||
|
||||
## `horizon-launcher mods disable`
|
||||
|
||||
Turn off a mod the browser installed; it stays installed.
|
||||
|
||||
horizon-launcher mods disable <PROJECT>
|
||||
|
||||
- `PROJECT`
|
||||
|
||||
MCP: `mods_disable`.
|
||||
|
||||
## `horizon-launcher servers list`
|
||||
|
||||
The servers, their folder and whether they run.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 218 KiB After Width: | Height: | Size: 278 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 40 KiB |
+30
-7
@@ -6,7 +6,7 @@ packs, see how well each one runs before installing it, and install it with its
|
||||
|
||||
## What it offers
|
||||
|
||||
Horizon doesn't run Java code ([research/java-mod-compat.md](research/java-mod-compat.md)). It ports what a Java mod
|
||||
Horizon doesn't run Java code ([mods.md](mods.md)). It ports what a Java mod
|
||||
carries as data (blocks, items, recipes, loot tables, tags, worldgen, textures, names) with `horizon-port-pack`, and
|
||||
says before install which of the mod's features that leaves out. Horizon `.hmod` mods aren't on Modrinth or CurseForge
|
||||
yet (Modrinth has no `horizon` loader).
|
||||
@@ -15,11 +15,9 @@ yet (Modrinth has no `horizon` loader).
|
||||
|---|---|---|
|
||||
| Java mods (Fabric, NeoForge, Forge, Quilt) | ported into `horizon-mods/<mod id>/` and turned on | Checked from its jar before install: **Works**, **Partly** or **Doesn't run** ([below](#java-mods)) |
|
||||
| Resource packs | `resourcepacks/` beside `options.txt` | **Works** when made for 26.3 ([resource-packs.md](resource-packs.md) lists what Horizon reads). Older packs are **Partly**: they load with vanilla's compatibility warning |
|
||||
| Shader packs (Iris, OptiFine) | `shaderpacks/` | **Partly**: translated to WGSL, the full-screen passes draw and the world and shadow passes don't yet ([shader-packs.md](shader-packs.md)). Packs for other loaders (Canvas, core-shader packs) **don't run** and can't be installed |
|
||||
| Modpacks (`.mrpack`, CurseForge zip) | the Modpacks page's import | **Partly**: Horizon runs the mods it can port, from the player's own downloads ([modpacks.md](modpacks.md)) |
|
||||
|
||||
By default a search shows only what runs: Java mods made for 26.3, resource packs made for 26.3, shader packs for Iris
|
||||
or OptiFine, and every modpack. **Show everything** lists the rest of the kind too, each marked with how well it runs; what doesn't run is
|
||||
By default a search shows only what runs: Java mods made for 26.3, resource packs made for 26.3, and every modpack. **Show everything** lists the rest of the kind too, each marked with how well it runs; what doesn't run is
|
||||
never offered for install.
|
||||
|
||||
## Java mods
|
||||
@@ -76,7 +74,7 @@ start); the hedge places and its recipe crafts 4.
|
||||
|
||||
## The Mods page
|
||||
|
||||
The launcher's **Mods** page has the four kinds as tabs (Mods, Modpacks, Resource packs, Shader packs), a search field (Enter searches), **Show everything** and
|
||||
The launcher's **Mods** page has the three kinds as tabs (Mods, Modpacks, Resource packs), a search field (Enter searches), **Show everything** and
|
||||
the source: Modrinth, with **CurseForge (coming soon)** beside it, disabled. Each result is an index row: its summary, author,
|
||||
downloads, source and licence, how well it runs (and why), **Page** (the project's page on its source) and
|
||||
**Install** (**Import** for a modpack). The Modpacks tab lists the imported packs first, with their coverage
|
||||
@@ -127,8 +125,7 @@ same name the player put there is never overwritten.
|
||||
|
||||
- **Install** picks the newest version that runs, then its required dependencies, checked before any download: a
|
||||
dependency that isn't a pack Horizon loads (a Java mod) stops the install. Dependencies go in first. A resource
|
||||
pack still has to be turned on in the game's Resource Packs screen, and a shader pack in Video Settings > Shader
|
||||
Packs, as in vanilla and Iris.
|
||||
pack still has to be turned on in the game's Resource Packs screen, as in vanilla.
|
||||
- **Update** installs the newer version and removes the old file.
|
||||
- **Remove** deletes the file and its entry. Packs installed as dependencies stay.
|
||||
- **A modpack** is downloaded (checked the same way) into `ports/downloads/`, imported, and ported straight away
|
||||
@@ -152,6 +149,32 @@ horizon-launcher mods remove faithful-32x
|
||||
|
||||
## Sources
|
||||
|
||||
**Horizon's registry.** Mods (`.hmod`) and resource packs made for Horizon, reviewed as pull requests in
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods) ([api/mod-index.md](api/mod-index.md)). The
|
||||
launcher reads its `index.json` (`browser/horizon.rs`; `HORIZON_MOD_INDEX=<file or https address>` reads a test
|
||||
registry instead, whose files may then be on disk) at most every ten minutes, and keeps the last copy in
|
||||
`mod-browser/horizon-index.json`. Before a result is installed it shows whether its files are signed and, for a mod,
|
||||
what it may do, in the words of the game's Options > Mods. A download goes to `mod-browser/downloads/` and is moved
|
||||
into place only after `horizon_mods::index::check_file` passes (size, SHA-256, the author's signature when the project
|
||||
has a key, the file's own manifest against the index). A mod becomes `horizon-mods/<id>.hmod`, turned on;
|
||||
`mods disable` and `mods enable` switch it in `horizon-mods.txt`. When the index takes a file down, the launcher turns
|
||||
it off the next time it reads the index or starts the game, says why, and refuses to install it or turn it back on.
|
||||
A Horizon modpack (`.hpack`) installs as its own profile (`browser/horizon/pack.rs`): `horizon-packs/<id>/` holds the
|
||||
checked pack, `pack.json` and `home/`, the profile's game folder, where each of the pack's mods is downloaded and checked
|
||||
like any registry mod and turned on or off as the pack says; its overrides (settings, resource packs, a mod's saved
|
||||
settings) are copied in on the first install only, so the player's changes survive updates. A pack whose mod was taken
|
||||
down installs nothing. It is listed on the Modpacks tab with **Play** and **Remove**, and plays like an imported pack
|
||||
(`modpacks::apply_profile`). Shader packs are listed by the index but not installed by this launcher yet.
|
||||
|
||||
```sh
|
||||
horizon-launcher mods search --source horizon --kind mod coords # with whether it is signed and what it may do
|
||||
horizon-launcher mods install --source horizon coords_hud
|
||||
horizon-launcher mods disable coords_hud
|
||||
horizon-launcher mods install --source horizon cozy # a modpack: its own profile
|
||||
horizon-launcher modpack play cozy
|
||||
```
|
||||
|
||||
|
||||
**Modrinth.** The public API (`api.modrinth.com/v2`) needs no key. The launcher names itself in its user agent, as
|
||||
Modrinth asks.
|
||||
|
||||
|
||||
+13
-13
@@ -7,9 +7,8 @@ pipeline, not a list of hand ports. It takes a pack as players download it and p
|
||||
Horizon mods. The pipeline is AI agents in dependency order, each port checked against the
|
||||
original mod running in a dev-only Java instance.
|
||||
|
||||
This page is the design. It builds on [mods.md](mods.md) (the mod API, WASM in wasmtime) and
|
||||
[research/java-mod-compat.md](research/java-mod-compat.md) (why Java jars and Mixins cannot
|
||||
run in Horizon, so we port instead). The ATM10 inventory behind the numbers below is
|
||||
This page is the design. It builds on [mods.md](mods.md) (the mod API, WASM in wasmtime, and
|
||||
why Java jars cannot run in Horizon, so we port instead). The ATM10 inventory behind the numbers below is
|
||||
[modpacks/atm10-mods.csv](modpacks/atm10-mods.csv).
|
||||
|
||||
## In one picture
|
||||
@@ -60,7 +59,7 @@ was downloaded.
|
||||
| **library** | APIs and code shared by other mods (Architectury, Curios, GeckoLib, Kotlin for Forge, Balm...) | no: maps to the Horizon API or the SDK | **80** |
|
||||
| **integration** | glue between two other mods (JEI plugins, AE2 ↔ Mekanism, Create add-on wiring) | after both sides are ported | **44** |
|
||||
| **client-ui** | client-only screens, HUDs, tooltips, maps, recipe viewers | yes: client API, or built in | **32** |
|
||||
| **other** | pack tooling and engine features: KubeJS, Almost Unified, Iris/shaders, CTM, crash/version tools | no: folded into the pipeline or the engine | **25** |
|
||||
| **other** | pack tooling and engine features: KubeJS, Almost Unified, shader mods, CTM, crash/version tools | no: folded into the pipeline or the engine | **25** |
|
||||
| **performance** | Sodium, FerriteCore, ModernFix, ImmediatelyFast, spark, AI and recipe speed-ups | no: Horizon is the replacement | **16** |
|
||||
| **server-only** | admin and server features: ranks, essentials, backups, claims, spawn control | yes: server API | **11** |
|
||||
| | | | **495** |
|
||||
@@ -141,12 +140,13 @@ derivative work. These rules are part of the pipeline, not advice to users:
|
||||
has given written permission, recorded in the index entry. The tooling refuses to package
|
||||
anything else. No-derivatives and non-commercial licences (14 in ATM10) are never published.
|
||||
For them, even a local port gets a warning that the licence may not allow it.
|
||||
4. **Mod code never enters this repository.** Mod jars, decompiled sources, Java oracle builds
|
||||
4. **Mod code never enters this repository, and nobody reads it.** Mod jars, Java oracle builds
|
||||
with mod code, and ports of mods we have no permission to publish all live outside the
|
||||
repo: in the user's pipeline work directory, or for our own development in
|
||||
`~/code/horizon-parity/modports/` (dev-only, never pushed). Ports are written from
|
||||
observed behaviour and the harness, with decompiled code as a local reference only. The
|
||||
repository holds the pipeline, the API, metadata (ids, names, versions, licences, counts)
|
||||
`~/code/horizon-parity/modports/` (dev-only, never pushed). A mod's code is never
|
||||
decompiled, read, quoted or paraphrased, by people or agents. Ports are written only from
|
||||
the mod's observed behaviour (the oracle and the harness), its own data files and its
|
||||
public documentation. The repository holds the pipeline, the API, metadata (ids, names, versions, licences, counts)
|
||||
and test fixtures we write ourselves.
|
||||
5. **Contacting authors or publishing any port is Ludovic's call.** Agents ask first.
|
||||
|
||||
@@ -177,7 +177,7 @@ frame, chat and command hooks. Server mods do not run yet. What a content pack n
|
||||
| Entities: types, attributes, AI goals and brains, spawning | — | deep (87) | 0.5 | `entity` interface, AI in the mod with vanilla goals reusable |
|
||||
| Custom renderers and animated models (block-entity, entity, item; GeckoLib's format) | — | deep | 0.5 | data models (Bedrock geometry + animations), plus a budgeted draw-list interface for the rest |
|
||||
| Dimensions: dimension types, levels, chunk generators | — | about 10 (Twilight Forest, Aether, Ad Astra, Undergarden, ...) | 0.5 | JSON part with worldgen; custom generators as mod code |
|
||||
| New hooks into vanilla behaviour (what Mixins do) | — | deep | as asked | each becomes a named hook, added for everyone ([java-mod-compat.md](research/java-mod-compat.md#3-a-porting-guide-outline)) |
|
||||
| New hooks into vanilla behaviour (what Mixins do) | — | deep | as asked | each becomes a named hook, added for everyone |
|
||||
| Client interfaces: `keys`, `target`, `inventory-read`, `ui`, `render`, `world-read` | planned | client tier (38) | 0.2–0.4 | as in [mods.md](mods.md#planned-interfaces) |
|
||||
|
||||
Two rules from mods.md stay: **the sandbox** (no files, sockets or processes; memory cap; fuel
|
||||
@@ -711,16 +711,16 @@ For tiers logic, machines and deep, in dependency order, as many agents at once
|
||||
budget allows:
|
||||
|
||||
- **Input:** the inventory record, the carried-over data, the oracle's exports and traces, the
|
||||
harness, the Horizon mod API docs, the ports of its dependencies, and the mod's decompiled
|
||||
code as a local reference (dev-only, in the work directory).
|
||||
harness, the Horizon mod API docs, the ports of its dependencies, and the mod's public
|
||||
documentation. Never its code: the agent doesn't decompile, read or quote it.
|
||||
- **Output:** a Rust crate in `mods/<id>/port/` built with `cargo horizon-mod build`, and its
|
||||
`.hmod`.
|
||||
- **Loop:** write → build → run the harness → read the differences → fix, until the harness
|
||||
passes or the agent reports what blocks it. Usually that is an API gap, which becomes an
|
||||
issue against the mod API ("needs a scheduled-tick hook"), the way version ports turn
|
||||
differences into work items.
|
||||
- **Rules:** the agent writes the port from observed behaviour and the harness, not by
|
||||
transliterating decompiled Java; ports follow the mod's licence ([Licences](#licences)).
|
||||
- **Rules:** the agent writes the port from observed behaviour, the harness and the mod's
|
||||
own data files only; ports follow the mod's licence ([Licences](#licences)).
|
||||
Players without an AI agent get the carry-over tiers. A port the licence lets us publish can
|
||||
be downloaded instead of regenerated.
|
||||
|
||||
|
||||
+70
-19
@@ -3,22 +3,24 @@
|
||||
Horizon gets its own mod system, written in Rust and run in a sandbox, plus
|
||||
two ways to bring over what Java players use: native Horizon ports of popular
|
||||
mods and the data-driven parts of packs and mods. Fabric and NeoForge jars do
|
||||
**not** run as they are: [research/java-mod-compat.md](research/java-mod-compat.md)
|
||||
explains why and what we do instead.
|
||||
**not** run as they are: their code calls and patches Minecraft's Java classes, and
|
||||
Horizon has none. What carries over is the data and assets inside a jar
|
||||
([modpacks.md](modpacks.md)).
|
||||
|
||||
Mods are **off and absent by default**. A fresh install has no `horizon-mods`
|
||||
folder, loads no runtime and plays exactly like vanilla 26.3.
|
||||
|
||||
| Part | Where | State |
|
||||
|---|---|---|
|
||||
| The contract (WIT) | `crates/horizon-mod-sdk/wit/horizon.wit` | 0.1: log, game-read, chat, hud, storage; tick, frame, chat and command hooks |
|
||||
| The contract (WIT) | `crates/horizon-mod-sdk/wit/horizon.wit` | 0.1: log, game-read, chat, hud, storage, command, ui; tick, frame, chat and command hooks |
|
||||
| SDK for mod authors | `crates/horizon-mod-sdk` | 0.1 |
|
||||
| Example mod | `crates/horizon-mod-sdk/examples/coords-hud` | coordinates, facing and time HUD, `/where`, `/coords` |
|
||||
| Example mods | `crates/horizon-mod-sdk/examples/coords-hud`, `examples/predator-missile` | coordinates, facing and time HUD, `/where`, `/coords`; `/missile`, a guided missile from vanilla commands |
|
||||
| Runtime | `crates/horizon-mods` | wasmtime 48 LTS, component model |
|
||||
| Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new / build / run` |
|
||||
| Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new [--template code\|content] / build / run / check`, and the registry's CI (`registry build / review / list`) |
|
||||
| In the game | `crates/horizon-client/src/game/mods.rs`, Options > Mods | client mods |
|
||||
| Launcher mod browser (Modrinth, CurseForge with a key) | [mod-browser.md](mod-browser.md) | resource packs, shader packs, modpacks |
|
||||
| `.hmod` index, signing, server mods, registries | this page, [Roadmap](#roadmap) | planned |
|
||||
| Launcher mod browser (Modrinth, CurseForge with a key) | [mod-browser.md](mod-browser.md) | resource packs, modpacks |
|
||||
| Registry index (`index.json`, `.hpack`), signatures | `horizon_mods::index`, [api/mod-index.md](api/mod-index.md) | schema 1; launcher and website next |
|
||||
| Server mods, registries | this page, [Roadmap](#roadmap) | planned |
|
||||
|
||||
## Design goals
|
||||
|
||||
@@ -84,6 +86,8 @@ folder, loads no runtime and plays exactly like vanilla 26.3.
|
||||
| `chat` | `chat` | `show(text)`: a line only the local player sees, after the mod's name (8 per call) |
|
||||
| `hud` | `hud` | `set-panel(corner, lines)`, `clear()`: up to 16 lines of 256 characters |
|
||||
| `storage` | `storage` | `get(key)`, `set(key, value)`, `delete(key)`: a per-mod folder of up to 64 files, 4 MiB total, at most 1 MiB written per call |
|
||||
| `command` | `command` | `run(line)`: a vanilla command run as the player, with the player's permissions, after the hook returns (8 per call); mods' own commands are not run |
|
||||
| `ui` | `ui` | `open-screen`, `close-screen`, `set-settings`: a screen the mod owns and a page in Options > Mods, of text, item and list widgets the game lays out and draws with its own menus' code. **Experimental:** the manifest needs `experimental = ["ui"]` |
|
||||
|
||||
| Hook (export) | When |
|
||||
|---|---|
|
||||
@@ -102,7 +106,7 @@ name (the mod reads it as `args`; API 0.1 has no way to declare argument types).
|
||||
### Planned interfaces
|
||||
|
||||
Each is a new capability, added in a 0.x minor version so older mods keep
|
||||
loading. Ordered by what the first native ports need ([research](research/java-mod-compat.md#port-first)):
|
||||
loading. Ordered by what the first native ports need:
|
||||
|
||||
| Interface | For | Notes |
|
||||
|---|---|---|
|
||||
@@ -110,7 +114,6 @@ loading. Ordered by what the first native ports need ([research](research/java-m
|
||||
| `target` | the crosshair's block or entity, with its state and NBT summary | Jade/WTHIT-style tooltips |
|
||||
| `inventory-read` | the player's inventory, held item, open container | AppleSkin, recipe viewers |
|
||||
| `recipes` | the recipe registry and lookups | JEI/EMI-style viewers |
|
||||
| `ui` | widgets: text, item icons, lists, a screen the mod owns, a settings page in Options > Mods | built from vanilla's widgets (`ui`) so it matches the menus |
|
||||
| `world-read` | blocks and biomes around the player, within the render distance | minimaps, schematics |
|
||||
| `render` | world-space lines, boxes and ghost blocks in a per-frame budget | Litematica-style placement, waypoints |
|
||||
| `registries` | new blocks, items, entities and recipes, mostly data: JSON models, textures, loot and recipes in the `.hmod`'s `assets/` and `data/` | server side; see [Multiplayer](#multiplayer) |
|
||||
@@ -139,10 +142,17 @@ proposal, no profiling. Its cranelift backend generates native code for x86-64
|
||||
and ARM64 on Windows, macOS and Linux, which is why one `.hmod` serves them
|
||||
all.
|
||||
|
||||
The game links it only with its `mods` feature: every release build turns it
|
||||
on (`release.yml`), and a build from source needs
|
||||
`cargo build --release -p horizon-client --features mods` to run code mods.
|
||||
Without it (the tests and probes) wasmtime and cranelift aren't built, a
|
||||
quarter of a clean build; content mods still load, and the game logs why the
|
||||
code mods don't start.
|
||||
|
||||
### Performance
|
||||
|
||||
Measured on the Mac mini (M4 Pro), release build, `cargo test -p
|
||||
horizon-mods --release --test sandbox -- --ignored --nocapture`:
|
||||
horizon-mods --features runtime,pack --release --test sandbox -- --ignored --nocapture`:
|
||||
|
||||
| | per call |
|
||||
|---|---|
|
||||
@@ -182,7 +192,8 @@ chat (`Mod Test Guest stopped: it took too long (an endless loop?)`), marks it
|
||||
on the Mods page and carries on; the other mods keep running. Host functions
|
||||
clip what a mod hands back (chat lines per call, HUD lines and lengths). Tests:
|
||||
`crates/horizon-mods/tests/sandbox.rs` (an endless loop, a panic and a 1 GiB
|
||||
allocation, next to a healthy mod).
|
||||
allocation, next to a healthy mod; `cargo test -p horizon-mods --features
|
||||
runtime,pack`).
|
||||
|
||||
## Playing with mods
|
||||
|
||||
@@ -207,6 +218,7 @@ Benchmarks (`--benchmark`) never load mods.
|
||||
rustup target add wasm32-unknown-unknown
|
||||
cargo install --git https://github.com/ludovic111/horizon cargo-horizon-mod
|
||||
cargo horizon-mod new my-mod # Cargo.toml, horizon-mod.toml, src/lib.rs
|
||||
# (--template content: a content mod, no code)
|
||||
cd my-mod
|
||||
cargo horizon-mod run # build, then start the game with it
|
||||
cargo horizon-mod build # again after an edit: the running game reloads it
|
||||
@@ -218,6 +230,18 @@ always on, and the game checks its file once a second: rebuild and it restarts
|
||||
with "Mods reloaded" in chat. Its in-memory state starts over; whatever it
|
||||
saved with capability `storage` survives the reload.
|
||||
|
||||
Before you submit it to the registry, run what its CI runs:
|
||||
|
||||
```sh
|
||||
cargo horizon-mod check target/horizon-mod/my_mod.hmod # --json for the report as JSON
|
||||
```
|
||||
|
||||
It reads the manifest and content, refuses imports the capabilities don't
|
||||
cover, then plays the mod in the sandbox for 40 ticks, 120 frames, a chat line
|
||||
and each of its commands: it must start and never trap or overrun. It checks a
|
||||
`.hpack` and a resource pack `.zip` too, and a signature with `--key <public
|
||||
key> --signature <file>.minisig`.
|
||||
|
||||
### Template layout
|
||||
|
||||
```
|
||||
@@ -264,15 +288,21 @@ authors = ["..."]
|
||||
api = "0.1" # the API the SDK targets
|
||||
side = "client" # client | server | both
|
||||
capabilities = ["game-read", "hud", "chat"]
|
||||
experimental = [] # experimental capabilities it uses, e.g. ["ui"]
|
||||
```
|
||||
|
||||
Unknown keys are refused, so a typo is an error, not a silently ignored
|
||||
permission.
|
||||
permission. An experimental capability (today `ui`) may change in any release
|
||||
([stability](api/stability.md)): a mod uses it only by naming it in
|
||||
`experimental` as well, so nobody depends on it by accident.
|
||||
|
||||
### Content mods (API 0.2)
|
||||
|
||||
A mod with `api = "0.2"` and capability `registries` may carry `assets/` and
|
||||
`data/` in the `.hmod`, and needs no `mod.wasm` if it has no code. It adds
|
||||
`data/` in the `.hmod`, and needs no `mod.wasm` if it has no code
|
||||
(`cargo horizon-mod new --template content` starts one; `build` in a folder
|
||||
with no `Cargo.toml` packs the manifest, `assets/` and `data/`, and `check`
|
||||
reads it without a trial run). It adds
|
||||
blocks and items by declaring them in `data/<id>/horizon/block/*.json` and
|
||||
`data/<id>/horizon/item/*.json`, each copying a vanilla template
|
||||
([modpacks.md](modpacks.md#registries-02-data-driven-blocks-and-items)):
|
||||
@@ -358,6 +388,29 @@ none.
|
||||
"top": "carve", "bottom": "none", "rigid_junctions": true, "inflate": true } }
|
||||
```
|
||||
|
||||
## Publish your mod
|
||||
|
||||
Horizon's registry lists mods, modpacks (`.hpack`) and resource packs made for Horizon, each reviewed before it is
|
||||
published. Players find them at [playhorizon.dev/mods](https://playhorizon.dev/mods) and in the launcher (Mods, then
|
||||
**Horizon** beside Modrinth), which checks every file before it installs it.
|
||||
|
||||
1. Run `cargo horizon-mod check` on the file (above): the registry runs the same checks.
|
||||
2. Put the source somewhere public, under a licence that lets players run it: reviewers read it, and the file must be
|
||||
built from it.
|
||||
3. Open [playhorizon.dev/mods/submit](https://playhorizon.dev/mods/submit), sign in with GitHub (it reads only your
|
||||
public profile) and fill in the page: the file, its name and summary, licence, source address, and optionally a
|
||||
minisign public key with the file's `.minisig`.
|
||||
4. The form checks the file again and opens a pull request in
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods) that adds `mods/<id>.toml`, with you as its
|
||||
owner. That repository's checks run the file in the sandbox and post their report on the pull request; answer the
|
||||
reviewers there.
|
||||
5. A reviewer merges it: within minutes the file is a release of horizon-mods, and the project is on the site and in
|
||||
the launcher.
|
||||
|
||||
An update is the same form with a new version; only the project's `owners` can publish one, signed with its key if it
|
||||
has one. A published file never changes. Without the form, open the pull request by hand (the repository's README
|
||||
says how). The formats: [api/mod-index.md](api/mod-index.md).
|
||||
|
||||
## Versions and compatibility
|
||||
|
||||
- The API is the WIT package `horizon:mods@0.1.0`. New functions and
|
||||
@@ -400,12 +453,10 @@ none.
|
||||
format: a `.hmod.minisig` beside it); the index pins each project's public
|
||||
key, so an update signed by another key is refused. Unsigned local files
|
||||
stay allowed, with an "unsigned" mark on the Mods page.
|
||||
- **Where mods come from.** Modrinth is where players already look and it
|
||||
stores files with hashes, but its loader list is Modrinth's to extend: we ask
|
||||
Modrinth to add a `horizon` loader. Until then (and as a fallback), the
|
||||
launcher reads a small index of approved mods: a JSON file in a public Git
|
||||
repository (id, versions, file URLs as GitHub release assets, SHA-256,
|
||||
signing key). No server of our own is needed.
|
||||
- **Where mods come from.** Horizon's registry ([Publish your mod](#publish-your-mod)): reviewed pull requests in
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods), files as its release assets, and an
|
||||
`index.json` on GitHub Pages that the launcher and the website read. A file the registry takes down
|
||||
(`revoked.toml`) is refused by the launcher and turned off where installed.
|
||||
- **The launcher.** A Mods tab per installation: browse and search the index,
|
||||
install, update, turn on and off (it writes the same `horizon-mods.txt`),
|
||||
see capabilities before installing. The launcher's CLI and MCP tools gain
|
||||
|
||||
@@ -208,6 +208,28 @@ p50/p95/p99/max frame times), plus CPU and GPU time per frame; [the graphics
|
||||
benchmark](graphics.md#benchmark) is built on it. Frame times include waits for
|
||||
presentation, so `bench` reports what is on screen.
|
||||
|
||||
### Discord Rich Presence
|
||||
|
||||
While Discord runs on the same computer, the player's Discord profile shows
|
||||
"Playing Horizon" and what they are doing: "In the menus", "Singleplayer",
|
||||
"Multiplayer" or "Hosting a world" (with the party size, of 8), the dimension
|
||||
("In the Nether") and the time since they entered the world. It never shows a
|
||||
world's name or a server's address. Horizon Settings has the switch
|
||||
(**Discord Rich Presence**, on by default; `discordPresence` in
|
||||
`horizon-extras.txt`), and `HORIZON_NO_DISCORD=1` turns it off for one run.
|
||||
|
||||
`crates/horizon-client/src/discord_presence.rs` speaks Discord's local IPC
|
||||
itself (the `discord-ipc-N` socket or named pipe, no SDK) from a thread of its
|
||||
own: the frame only hands it a status when it changes. It retries every 15 s
|
||||
while Discord isn't running and stays within Discord's 5 updates per 20 s.
|
||||
Dedicated servers never start it, and automated runs (offscreen, benchmarks)
|
||||
only talk to a fake Discord: `lab.game_env` sets `HORIZON_NO_DISCORD=1`, and
|
||||
`tools/discord_presence_e2e.py` points games at a fake server with
|
||||
`HORIZON_DISCORD_IPC_DIR` (title, world, Nether and quit on both single-player
|
||||
paths; a LAN host and guest; the switch; a Discord started after the game).
|
||||
`DISCORD_APP_ID` is Discord's "Horizon" application, whose `horizon` image is
|
||||
the large one; there are no game-mode images yet.
|
||||
|
||||
### Play on another of your machines
|
||||
|
||||
Horizon targets Linux on x86-64 with an NVIDIA GPU (Vulkan); macOS and Windows
|
||||
|
||||
@@ -20,16 +20,24 @@ python3 tools/parity.py --changed origin/main # those a branch's changes ca
|
||||
python3 tools/parity.py --changed-files paths.txt # the same for listed paths, in a copy without Git (tools/pr_ready.py)
|
||||
```
|
||||
|
||||
On CI, a pull request runs the parity job only when it changes a harness, an oracle, a probe or the runner; everything else is checked on main by `parity-main`, a batch of merges at a time, which bisects a failure to the merge that caused it (`tools/parity_main.py`; [release-flow.md](release-flow.md#parity-on-main)). Game releases wait for it.
|
||||
|
||||
Each harness runs unmodified under a tracer that records the files it depended on: its Python modules, its Java oracle and the oracle sources javac pulled in, other repository files it read, and the Rust sources of the probes it ran (from Cargo's `.d` dep-info files). A pass stands until one of those files, the pinned vanilla artifacts, `Cargo.lock` or the Rust/Java toolchains change. State and logs are in `.local/parity-runner/`; each harness's own outputs stay in its `.local/<name>/` directory.
|
||||
|
||||
Vanilla oracle runs are reused as well. `tools/parity_shim.py` stands in for `java` and `javac`: it records each oracle run's outputs and the content of every file under the paths its arguments name, and replays the run while those are unchanged. After a Rust-only change a harness pays only for its Rust side (`block_update`: 53 s to 5 s). Files an oracle writes outside its named paths aren't tracked, so a harness that fails while reusing oracle results is rerun fresh, and stops reusing them if it then passes. `--all` and `--fresh` never reuse them.
|
||||
|
||||
Probes build into `.local/parity-target/` with release optimisation but no LTO and 16 codegen units. On ludodesktop that rebuilds every `horizon-world` probe in 3 seconds after a one-line change, against 122 seconds with the release profile. Rust gives these settings identical results (no fast-math; overflow checks as in release), and the full harness suite passes under them. Probes that harnesses build in the dev profile get `opt-level = 3` too, keeping their overflow checks and debug assertions. Harnesses must locate binaries through `cargo metadata` or `lab.cargo_target()`, never a hard-coded `target/`.
|
||||
|
||||
The probes of `horizon-world` and of `horizon-client` are one binary per crate, `world_probe` and `client_probe` (`cargo build --release -p horizon-world --example world_probe`): a harness runs `world_probe <name> [arguments]`, and `<name>` is a module in `crates/<crate>/examples/probe/` (add it to the `mod` list and the `probes!` list in its `main.rs`; read arguments with `crate::args()` or `crate::args_os()`, which drop the name). Code several probes share goes in `examples/probe/support/` or a module of its own. Linking one binary instead of ~250 examples is most of what a probe build used to cost. Each crate's probe has its own target name (set in its `Cargo.toml`, `protocol_probe` too): Cargo copies every crate's examples into one `<profile>/examples/` directory, and with one shared name a harness could run the binary another harness had just copied there. The runner counts only the probes a harness ran, the probes and support modules they name, their own subdirectories and `dispatch.rs` as its dependencies, not `main.rs`, which only lists the probes: editing one probe reruns only its harnesses, and adding one reruns none.
|
||||
|
||||
Passes are shared between worktrees. A harness's key depends only on the content of its dependencies, not on where they are, so every pass is also written to `parity-shared/` beside the shared vanilla data (`PARITY_SHARED` overrides it). A worktree whose files match those a harness passed with, in any worktree, counts that pass without running the harness: after merging the integration branch, an agent's gate only runs the harnesses its own changes affect.
|
||||
|
||||
Every runner on the machine shares `PARITY_MACHINE_JOBS` slots (default: half the CPU threads), so several agents' runs together can't overload it. Parallel harnesses are also admitted by memory: each harness's recorded peak is reserved, within three quarters of the memory available at the start, and a harness starts only if the memory free at that moment still leaves 2 GB. `-j` caps the count here (default: `PARITY_LOCAL_JOBS`, else 3 while other machines help or a third of the CPU threads alone, within `$FLEET_LOAD_JOBS`).
|
||||
|
||||
### Harnesses that start the game
|
||||
|
||||
The game logs into `HORIZON_HOME` and falls back to the player's own game folder when it is unset, so a harness that starts the game, `horizon-ctl`, the launcher or the dedicated server builds the environment with `lab.game_env(**extra)`: no audio, and fresh scratch folders for `HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_DATA_HOME` and `XDG_CONFIG_HOME`, removed when the harness exits (a folder you pass, or that the environment already has, is kept). The runner also gives each harness its own `HORIZON_HOME` under `.local/parity-runner/game-home/`. `tests/test_game_home.py` fails for a script in `tools/` that starts the game without it.
|
||||
|
||||
### Other machines
|
||||
|
||||
Harnesses can also run on the Mac mini and the ThinkPad (`tools/parity_hosts.json` describes them; its `default` list is empty, so pass `--hosts macmini,thinkpad` or set `PARITY_HOSTS`, after copying `shared-local/` to `~/code/horizon-parity/shared-local` on each host). The runner mirrors the worktree there with rsync (not `.git`, `.local`, `target` or ignored files) into `~/code/horizon-parity/remote/<host><path>`, whose `.local` links to the vanilla data in `~/code/horizon-parity/shared-local`, and starts `tools/parity.py --worker` over ssh. The worker builds the probes (about 80 s the first time) and runs what it is sent under the same tracer, admitting harnesses against its own free memory. One queue, longest first, feeds every machine, remote ones first: the Mac takes up to 14 harnesses, the desktop 3 and only those under 800 MB. Each pass comes back with the content hash of every file it depended on, so it is keyed on exactly what ran, and logs come back to `.local/parity-runner/logs/`; state, sharing and `gate.py` work as before. If a host can't be reached, or drops out, its harnesses run here.
|
||||
@@ -43,6 +51,10 @@ A harness can declare, at the top level of its script:
|
||||
- `PARITY_SHARDS = N`: it runs as `NAME#1` to `NAME#N`, in parallel, each told its share in `PARITY_SHARD=i/N` (`test_datafix_parity.py` upgrades every sixth world). `NAME` on the command line or in `--known-failures` means all of them.
|
||||
- `PARITY_RUST_SCOPE = [...]`: the Rust sources its probes can reach, as path prefixes. Cargo's dep-info names every file of every crate a probe links, so without it a probe of `horizon-world` depends on all 350 of its files. The runner keeps only the scope's files if the scope is closed: nothing in it names a module, crate-root re-export or macro outside it (`crate::`, `super::`, other workspace crates; comments and strings ignored), declares a module it doesn't cover, or includes source, and nothing outside it implements anything for a type it defines. Crate roots then count without their declarations of other modules, so adding a module elsewhere doesn't rerun the harness. If the scope isn't closed the runner says why and keeps every file. `datafix` depends on 41 files this way, not 354.
|
||||
|
||||
### Which harnesses a change affects
|
||||
|
||||
`--changed` and `--changed-files` narrow each harness's Rust sources to those its probes can reach (`tools/parity_reach.py`), so a change to one module of `horizon-client` no longer reruns every harness whose probe links the crate. The narrowing works on items, not files: from the probe modules a harness ran (or the binary it built), a free item (fn, type, const, static) is reached when a reached item names it in its own module, through a path or an import of a module that is named, or through a glob import; an inherent impl's methods count one by one once their type is reached and their name is mentioned; a trait impl counts once its trait and its type are reached (std's traits and types always are); a macro counts once invoked. Names match by spelling, so the result only over-approximates. A reached file's parent modules count through their `mod` declarations of it, compared with the merge base; Rust files a change adds take part, a dependency that was deleted counts as changed, code under `#[cfg(test)]` never counts, and a harness whose probe can't be found keeps every source. Parses are cached by content in `.local/parity-runner/reach-cache.json`. `--by-crate` turns the narrowing off. On the last 20 pull requests merged on 2026-10-25, the harnesses picked went from 2255 to 1061 (2384 to 1592 harness-minutes; game-binary harnesses, which link all of `game/`, set the floor), and every harness a CI parity run failed in the week before was still picked; every source file a sample of probes executed (LLVM `-C instrument-coverage`) is among those kept. Building the graph takes 15 s cold, under a second warm, and up to a minute and a half on a change that reaches many harnesses.
|
||||
|
||||
## The gate
|
||||
|
||||
`tools/gate.py` is what a branch must pass before it is integrated: the public-tree check, rustfmt, clippy with warnings denied, the Rust and Python tests, then the harnesses whose inputs changed. It stops at the first failure and writes `.local/gate.json`. `--known-failures a,b` lets harnesses that already fail on the integration branch keep failing. `--quick` checks formatting, lints and Python tests only; `--no-parity` skips the harnesses.
|
||||
|
||||
@@ -20,7 +20,7 @@ emit for the same scenes.
|
||||
`FluidRenderer.tesselate`, then `RenderShape.MODEL` blocks through
|
||||
`ModelBlockRenderer.tesselateBlock` with smooth lighting on, culling on,
|
||||
cutout leaves, `BlockColors.createDefault()` and `state.getSeed(pos)`.
|
||||
- **Horizon side**: `crates/horizon-client/examples/section_mesh_fixture.rs`
|
||||
- **Horizon side**: `crates/horizon-client/examples/probe/section_mesh_fixture.rs`
|
||||
loads the prepared resources (`Assets`, `BlockFacts`, `Biomes`,
|
||||
`load_visibility`, `MeshTables`), builds the same blocks and light in real
|
||||
client `Chunk`s (a 3x3 chunk region), sets every biome's colours to the
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
# Java performance mods: which of their techniques apply to Horizon
|
||||
|
||||
A survey of the techniques used by eight Java Edition performance mods. Asked for in #991, from famescare on Discord. For each technique it gives the vanilla cost it targets, whether Horizon already avoids that cost, and whether it is worth measuring here.
|
||||
|
||||
**Rules.** Techniques only, taken from each mod's public description, documentation and changelogs (linked below). No mod code was read or copied. Several of these mods are LGPL-3.0, and Horizon's code stays its own. Anything Horizon adopts is reimplemented against vanilla 26.3's behaviour. It keeps parity, so the harnesses stay unchanged, and it needs before/after numbers like any other perf PR (`docs/benchmark.md`, `docs/profiling.md`).
|
||||
|
||||
**Why many don't apply.** A large share of these techniques work around costs of the JVM, OpenGL or GLFW rather than costs of the game's rules. Examples are object headers and duplicate objects, boxing, lambdas and Streams, garbage collection, JNI upcalls, immediate-mode GL draws and GL error checks. Horizon is Rust on wgpu and winit, so it never pays those costs. The techniques that do carry over remove work the game's rules don't need: sleeping block entities, skipped searches, and cheaper geometry tests.
|
||||
|
||||
Verdicts:
|
||||
- **has**: Horizon already avoids the cost, by its design or with a merged change.
|
||||
- **n/a**: the cost comes from the JVM, OpenGL or GLFW, and Horizon doesn't have it.
|
||||
- **later**: missing, and worth measuring. These are listed in "Worth measuring" below and in the LATER list.
|
||||
- **no**: missing, but it would change vanilla's behaviour or look, or the gain here is too small to pay for itself.
|
||||
|
||||
## Lithium (server and shared game logic)
|
||||
|
||||
Source: [Lithium's mixin configuration](https://github.com/CaffeineMC/lithium/blob/develop/lithium-fabric-mixin-config.md). Lithium keeps vanilla's behaviour, which is the same rule Horizon follows.
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| Hopper caching, inventory change listeners and hopper sleeping | Every hopper looks up its source and target containers and tries a transfer every tick, even when nothing can move | `game/machines.rs` ticks every hopper on each tick. It checks the block's name and cooldown, then runs the transfer attempt. Nothing is cached or put to sleep | **later** |
|
||||
| Block entity sleeping (furnaces, brewing stands, campfires, crafters, shulker boxes, sculk) | Idle block entities still tick | `game/block_entity_ticks.rs` ticks every ticker each tick, as vanilla does | **later** |
|
||||
| Entity collisions: faster block access, chunk caching, the supporting block first | Collision scans read blocks through generic level lookups | Collision scans already run over Horizon's own section arrays (`horizon-world` `block_collision_scan`). A counting cursor that does fewer lookups is open as #659 | **has** (more in #659) |
|
||||
| Specialised cuboid and empty `VoxelShape`s, precomputed shape arrays | Generic voxel shape intersection and merging | `horizon-core::geometry` has its own immutable shapes and box lists (`docs/collision-geometry.md`) | **has** |
|
||||
| POI search and portal search | POI lookups go through vanilla's stream-heavy search | Section-indexed POIs (`poi_sections.rs`), searched in vanilla's order | **has** |
|
||||
| Pathfinding: cached node types per block | Node evaluation reads the same blocks over and over | Not measured. Mob pathfinding costs haven't been profiled against vanilla yet | **later** (profile first) |
|
||||
| Explosions: one access per block on a ray, skip air, skip exposure work | Each ray step reads the block and the fluid again | `game/explosion.rs` follows vanilla's loop. It hasn't been profiled, and TNT chains are the case to measure | **later** (profile first) |
|
||||
| Random ticks: roll the chance early, fast block search | Sections with nothing that ticks randomly are still walked | Sections with nothing random-tickable are skipped (`docs/random-tick-eligibility-benchmark.md`) | **has** |
|
||||
| Tick scheduler: faster collections, packed scheduled ticks | Boxed `ScheduledTick` objects in hash sets | Horizon's own tick heap and index (`horizon-core::ticks`, `docs/scheduled-ticks.md`) | **has** |
|
||||
| Collections and allocation (fastutil maps, cached `values()`, fewer `BlockPos`, no Streams) | JVM allocation, boxing, GC | Rust value types, no GC | **n/a** |
|
||||
| Math inlining, a smaller sine table | JIT inlining limits | Compiled and inlined by rustc. Horizon keeps vanilla's `Mth.sin` table where results depend on it | **n/a** |
|
||||
| Chunk access without debug locks or bounds validation | `PalettedContainer`'s thread-check lock | Horizon doesn't have that lock (`docs/performance/paletted-container-access-results.md`) | **n/a** |
|
||||
| Palette replacement and compaction | Hash palette resizing on the JVM | Horizon's own paletted containers (`horizon-core::paletted`) | **has** |
|
||||
| Game event dispatchers made only for sections with a listener | Every section holds a dispatcher | Not checked. This is small next to the items above | **no** (until a profile shows it) |
|
||||
| Item entity merging grouped by item type (experimental) | Each item entity checks every nearby item to merge with | Not present. It matters only with thousands of dropped items (see #996: fresh worlds drop about twice as many items as vanilla) | **later**, after #996 |
|
||||
| World border cache, redstone wire double reads, fluid flow reads, framed-map scans | Small repeated reads | Each is minor. Fix them where a profile points at them | **no** |
|
||||
|
||||
## FerriteCore (memory)
|
||||
|
||||
Source: [FerriteCore's summary of its changes](https://github.com/malte0811/FerriteCore/blob/main/summary.md).
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| One `FastMap` of neighbour states per block instead of a table per state | About 600 MB of per-state neighbour tables in large packs | Block states are numeric ids with flat tables, with no object per state | **n/a** |
|
||||
| Compact property storage per state | A per-state `ImmutableMap` | Same as above | **n/a** |
|
||||
| Cached multipart predicates, shared multipart models | Hundreds of thousands of model and predicate objects | Models are baked once into a shared library (`docs/shared-model-library-benchmark.md`) | **has** |
|
||||
| Deduplicated baked-quad vertex arrays | Identical `int[]` per quad | Section meshes are built per section from the shared baked models, and no per-quad arrays are kept | **has** |
|
||||
| Deduplicated shape caches | Duplicate cached `VoxelShape`s per state | One table of distinct shapes, indexed per state (`horizon-world` `CachedCollisionRegistry`) | **has** |
|
||||
| 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`.
|
||||
|
||||
## ImmediatelyFast (client draw submission)
|
||||
|
||||
Source: [ImmediatelyFast on Modrinth](https://modrinth.com/mod/immediatelyfast). Its gains show only when the CPU is the bottleneck.
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| A batching buffer for immediate-mode draws (entities, block entities, particles, text, GUI) | Many small draw calls and uploads | The HUD is one atlas and one batch of quads (`hud.rs`). Entities are grouped by material (`gfx/entity_batch.rs`). Terrain uses indirect multi-draws (`gfx.rs`, `gfx/flat.rs`) | **has** |
|
||||
| HUD batching, fewer GUI draw calls | One draw per GUI element | Same batch (`hud.rs`) | **has** |
|
||||
| Fast text lookup, a bigger font atlas | Per-character lookups, atlas thrash with large fonts | Glyphs live in maps in `font.rs`, drawn into the same HUD atlas | **has** |
|
||||
| One texture for all map item textures | One texture per visible map | Not measured. It matters only with walls of maps in item frames | **later** (with a map-wall scene) |
|
||||
| Cached closed-chest geometry | Re-tessellating chests each frame | Merged in #728 (Online5277) | **has** |
|
||||
| Buffered sign text instead of redrawing it each frame | Text redrawn every frame | Sign text is recorded as text calls in the batch. Not measured with sign-heavy scenes | **later** (with a sign-heavy scene) |
|
||||
| Fewer framebuffer switches | GL state changes between render types | wgpu render passes are fixed by Horizon's pipeline | **n/a** |
|
||||
| GL error checking off | `glGetError` overhead | No GL. Release builds run without wgpu's backend validation and, outside DirectX 12, without its indirect-draw validation (`gfx.rs` `instance_descriptor`) | **n/a** |
|
||||
|
||||
## Gnetum (HUD rendering)
|
||||
|
||||
Source: [Gnetum on Modrinth](https://modrinth.com/mod/gnetum).
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| Draw the HUD into an offscreen buffer in several passes, one pass per frame, and show the last complete buffer | The HUD is redrawn every frame | Horizon redraws its one HUD batch every frame | **no**. The HUD would then update at a lower rate than vanilla's, which changes what players see. Horizon's HUD is already one batch. |
|
||||
| Adaptive distribution and a separate HUD FPS cap | Same | Same | **no**, for the same reason |
|
||||
|
||||
## ScalableLux (lighting, from Starlight)
|
||||
|
||||
Source: [ScalableLux on Modrinth](https://modrinth.com/mod/scalablelux).
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| Starlight's light engine: per-section light arrays and direct propagation queues | Vanilla's light engine is a bottleneck in fast chunk generation | Horizon has its own engine with vanilla's rules (`light.rs`). New chunks are lit on the streaming worker pool, and edits are relit incrementally (`relight_block`). See `docs/performance/lighting-worker-results.md` | **has** |
|
||||
| Parallel light updates | One light thread | Chunk lighting already runs on several workers during streaming | **has**. Measure the light share of fresh-chunk generation before doing more. |
|
||||
|
||||
## Structure Layout Optimizer (jigsaw structures)
|
||||
|
||||
Source: [Structure Layout Optimizer on Modrinth](https://modrinth.com/mod/structure-layout-optimizer).
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| An octree of piece boxes instead of a `VoxelShape` for free space | Voxel shape boolean ops slow down as pieces add up | Free space is a container box minus a list of placed boxes (`worldgen/structure/jigsaw.rs` `Free`). That avoids the voxel shapes, but the scan is linear per test | **has**. An octree pays only for structures with hundreds of pieces. |
|
||||
| Skip jigsaw blocks that face the structure boundary or another piece | Every parent jigsaw is matched against every child | Not present | **later** (time trial chambers and ancient cities first) |
|
||||
| Skip pool elements already found not to fit at this spot | Weighted pools repeat an element once per weight point, and it is re-tested each time | Not present. Only the variant that keeps the result identical applies (no deduplication of the list, which changes layouts) | **later** |
|
||||
| Cull positions outside the chunk before processors run | Whole templates are processed and then mostly discarded | Not checked | **later** (same measurement) |
|
||||
| Palette-based template storage | Templates keep every block and NBT object | Templates are Horizon's own structures. Memory isn't measured | **no** (until memory shows it) |
|
||||
|
||||
## AsyncParticles (particles)
|
||||
|
||||
Source: [AsyncParticles on Modrinth](https://modrinth.com/mod/asyncparticles).
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| Particle culling | Off-screen particles are built anyway | Vanilla already skips quad particles whose position is outside the frustum (`QuadParticleGroup.extractRenderState`, `Frustum.pointInFrustum`). Horizon builds every particle's quad (`particles.rs` `render`). This is a parity gap as well as a cost | **later** (vanilla's frustum point test) |
|
||||
| Vertex transformation on the GPU | Every particle's quad is built on the CPU and uploaded every frame | Same in Horizon (`particles.rs` `render`). Instancing would upload one record per particle | **later** (measure with 10k+ particles) |
|
||||
| Particle ticks on another thread | Particle ticks on the client thread | Horizon ticks particles on the game thread | **no**. Vanilla's particle ticks read the level, and racing them against block changes risks parity. Revisit only if a profile shows particle ticks are big. |
|
||||
| Asynchronous light cache for particles | A light lookup per particle per frame | `particles.rs` looks light up per particle | **later**, with the item above |
|
||||
| Texture animation one frame late | Animated textures tick on the client tick | Not adopted | **no**, because it changes timing |
|
||||
|
||||
## Ixeris (input and the render thread)
|
||||
|
||||
Source: [Ixeris on Modrinth](https://modrinth.com/project/p8RJPJIC).
|
||||
|
||||
| Technique | Vanilla cost | Horizon | Verdict |
|
||||
| --- | --- | --- | --- |
|
||||
| Event polling on the main thread, rendering on its own thread | GLFW event polling and JNI upcalls take time from rendering | winit, without JNI. Input and rendering share the event loop (`game.rs`, `ApplicationHandler`) | **n/a** for the JNI part |
|
||||
| Buffered raw input (`GetRawInputBuffer`) | One `GetRawInputData` call per event. An 8000 Hz mouse costs a lot on Windows | winit reads `WM_INPUT` one message at a time | **later**. Measure on Windows with a high-polling-rate mouse before changing it. |
|
||||
| Cached GLFW state | Round trips to the main thread | No GLFW | **n/a** |
|
||||
| A frame limiter that sleeps, then spins | Imprecise sleeps | Horizon has its own limiter | **no** (no reported problem) |
|
||||
|
||||
## Worth measuring
|
||||
|
||||
Each of these needs a profile or a benchmark first. They are ordered by the expected gain. They are in the LATER list in `~/code/horizon-parity/FEATURES.md`, not filed as issues:
|
||||
|
||||
1. Hopper and block-entity sleeping, with vanilla-identical results (Lithium). Benchmark: a hopper and furnace array.
|
||||
2. Particles: vanilla's frustum point test (a parity fix too), then GPU-built quads (AsyncParticles). Benchmark: 1,000+ campfires.
|
||||
3. Jigsaw placement: skip blocked connectors and already-failed elements without changing the layout (Structure Layout Optimizer). Benchmark: trial chambers and ancient cities in fresh worlds, `docs/generation-scan-benchmark.md`.
|
||||
4. Windows raw input in batches for high-polling-rate mice (Ixeris). Benchmark: an 8000 Hz mouse on Windows.
|
||||
5. Profile before choosing a technique: mob pathfinding, TNT explosions, item merging after #996, map walls and sign-heavy scenes.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Pregeneration: `/pregen`
|
||||
|
||||
`/pregen` generates every chunk of a square or a circle ahead of the players, lights it and saves it, as
|
||||
Chunky does on a Java server. It is Horizon's own command (vanilla has none), available in single player
|
||||
with cheats on and to operators (level 2) on a server, from the chat or the server console
|
||||
(`horizon-server cmd pregen start 2500`).
|
||||
|
||||
It is off until you turn it on, so `/help` and the command tree stay vanilla's:
|
||||
|
||||
- a server: `horizon-pregen = true` under `[properties]` in `server.toml` (or `horizon-pregen=true` in a
|
||||
vanilla folder's `server.properties`), then restart it;
|
||||
- single player and LAN: start the game with `--pregen`.
|
||||
|
||||
```text
|
||||
/pregen start <radius> [square|circle] [<x> <z>] radius in blocks; the centre defaults to where you
|
||||
stand (the world spawn from the console)
|
||||
/pregen status chunks done, chunks per second, time left
|
||||
/pregen pause | continue stop scheduling new chunks, and go on
|
||||
/pregen cancel stop; what is done stays saved
|
||||
```
|
||||
|
||||
The area is the chunks within `radius / 16` chunks of the centre chunk: a square of side
|
||||
`2 * (radius / 16) + 1` (radius 2500 is 313 x 313 = 97,969 chunks), or the chunks whose distance from the
|
||||
centre chunk is at most `radius / 16`. It runs in the dimension the command was run in; that level keeps
|
||||
ticking while the task runs, whoever is in it. The progress goes to the server log every five seconds
|
||||
and to the player who started it, and once more when it is done. A task is not kept across a restart:
|
||||
start it again and the chunks already saved load instead of generating.
|
||||
|
||||
## How it works
|
||||
|
||||
- `horizon_client::pregen::Pregen` cuts the area into strips at most 256 chunks wide and sweeps each
|
||||
north to south with a band of rows (`streaming::Band`) holding about a thousand chunks.
|
||||
- Streaming treats the band like a player's area: it generates its chunks and the rings around them that
|
||||
decoration and light need, and lights its own chunks. Once every chunk of the band's first row is lit
|
||||
and post-processed (`LevelChunk.postProcessGeneration`, which vanilla runs before a chunk is FULL), the
|
||||
band moves down a row; the rows that fall out of its reach unload and are saved like any chunk the
|
||||
players leave, so memory holds only the rows in flight.
|
||||
- The chunks a band reaches are ranked for decoration row by row as they come within its reach
|
||||
(`Streaming::set_band`). Decoration is order dependent where neighbours' writes overlap
|
||||
(`DecorationOrder`), and this makes a task decorate in the same order however its jobs are timed and
|
||||
shared among the workers: the same seed gives the same chunks.
|
||||
- Between server ticks the server waits for the workers' results and hands out the next jobs at once
|
||||
(`Streaming::wait`, `pump_pregen`), instead of once a tick: a chunk passes through five jobs
|
||||
(generate, decorate, finish, light, save), each needing its neighbours' earlier ones.
|
||||
|
||||
The chunks of the band's outer ring are finished (FULL) but not lit, as at the edge of what a player has
|
||||
loaded; they light when their neighbours load later.
|
||||
@@ -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.
|
||||
+4
-12
@@ -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.
|
||||
|
||||
+87
-73
@@ -2,9 +2,8 @@
|
||||
|
||||
How a change gets from a pull request to players: the checks a pull request passes, how it merges, and the
|
||||
automatic releases that follow. Releases are automatic and frequent so the latest Horizon is always playable.
|
||||
Each one goes out as an **alpha** build, which launchers on the **Alpha** channel install at once, and becomes **stable** in
|
||||
the next daily promotion unless something holds it back ([Channels](#channels)): launchers and servers install
|
||||
stable builds unless their owner picks Alpha.
|
||||
There is one channel ([One channel](#one-channel)): each release is published as the release and GitHub's *latest*
|
||||
once its smoke test passed and no `release-blocker` is open, and launchers and servers install it at once.
|
||||
|
||||
## Pull request checks
|
||||
|
||||
@@ -14,7 +13,7 @@ reopened; labels never start it):
|
||||
| Job | Runs on | What | Time |
|
||||
| --- | --- | --- | --- |
|
||||
| `verify` | GitHub `ubuntu-latest` | Public-tree check, Python tests, rustfmt, clippy with warnings denied, Rust tests. Dependencies and the workspace build come from a cache saved by main's runs | ~4 min cold, less warm |
|
||||
| `parity / parity` | The Mac mini's runner (`ludovics-mac-mini`, label `horizon-game`) | The vanilla harnesses the change can affect (`tools/parity.py --changed <base>`) | seconds when nothing is affected; minutes per affected harness |
|
||||
| `parity / parity` | The Mac mini's runner (`ludovics-mac-mini`, label `horizon-game`) | Only for a change to a harness, an oracle, a probe or the runner (or the `run-parity` label): the vanilla harnesses the change can affect (`tools/parity.py --changed <base>`). Other pull requests skip it: [parity-main](#parity-on-main) checks them on main | seconds when nothing is affected; minutes per affected harness |
|
||||
|
||||
Pushes to main run `verify` only; the nightly audit covers main's harnesses.
|
||||
|
||||
@@ -40,10 +39,17 @@ copy is: the Mac mini. Its runner runs as the maintainer's account and keeps its
|
||||
depend only on the Minecraft version, are kept once in `shared-local/sounds/<version>/` (copied from a folder
|
||||
`horizon-prepare sounds` made from the maintainer's own game; the Mac mini has no official launcher of its own)
|
||||
and cloned into each preparation (not linked: vanilla's packs refuse symbolic links), for the audio harnesses.
|
||||
`tools/prepare_output.py check` then compares what was prepared with `crates/horizon-prepare/output-versions.txt`:
|
||||
launchers keep a player's prepared resources across releases whose preparer declares the same `OUTPUT_VERSION`
|
||||
(`crates/horizon-prepare/src/lib.rs`), so a change to the prepared files fails here until it bumps the number
|
||||
and appends the new digest (the error gives both lines).
|
||||
3. `tools/parity.py --changed <base sha>` picks the harnesses whose traced dependencies (their script, Python
|
||||
modules, Java oracles and every Rust source their probes compile) changed since the merge base, plus any
|
||||
harness nothing is recorded about yet, and runs those that have no pass for their current inputs. A change to
|
||||
`Cargo.lock` or `research-lock.json` affects every harness. Each harness has 25 minutes, the job 45.
|
||||
The selection runs with main's `tools/parity.py` and `tools/parity_reach.py` (`--changed <base> --list`), so a
|
||||
branch made before a better selection landed gets it too, and the head's own `parity.py` then runs the named
|
||||
harnesses. A branch that changes either file selects with its own code.
|
||||
|
||||
Failed harnesses' logs are uploaded as the `parity-logs` artifact.
|
||||
|
||||
@@ -81,10 +87,34 @@ gh api -X POST repos/ludovic111/horizon/branches/main/protection/required_status
|
||||
A skipped `parity` (a fork's pull request without the label) counts as passed, so requiring it never blocks a
|
||||
fork's pull request; the maintainer decides whether to run it.
|
||||
|
||||
## Parity on main
|
||||
|
||||
Most pull requests merge on `verify` alone and leave the vanilla harnesses to `.github/workflows/parity-main.yml`,
|
||||
which runs them on main a batch of merges at a time, on the Mac mini's runner:
|
||||
|
||||
- It starts on every push to main, one run at a time (`concurrency: parity-main`). Merges that land while a run
|
||||
goes on wait in one pending run: GitHub keeps only the newest and cancels the others, so the next run takes them
|
||||
all.
|
||||
- `tools/parity_main.py base` gives the newest commit main contains whose parity-main passed (else the last
|
||||
merge's parent), and the run is `tools/parity.py --changed <that commit>`: the union of the harnesses every merge
|
||||
since then can affect, once, with every earlier pass reused.
|
||||
- On a failure, `tools/parity_main.py bisect` checks out the batch's first-parent merges by halves and runs only
|
||||
the failing harnesses, names the first merge they fail on in the run's summary and comments on its pull request
|
||||
(`🤖 Agent: parity-main found that this merge breaks ...`). Fix it with a pull request as usual; the next
|
||||
run checks from the last green commit again.
|
||||
- Game releases ship only a commit both `checks` and `parity-main` passed on (`tools/release_train.py`, see
|
||||
below), so a broken merge holds releases instead of reaching players. `release.yml` also starts when a
|
||||
parity-main run finishes. A forced release (`force=true`) doesn't wait for parity-main.
|
||||
|
||||
A pull request still runs its own parity job when it changes a harness script, an oracle
|
||||
(`mods/horizon/src/test/`), a probe (`crates/*/examples/`, `game/*_fixture.rs`, `game/*_harness.rs`), the runner
|
||||
(`tools/parity*.py`, `tools/lab.py`, `tools/parity_hosts.json`, `parity*.yml`), or carries the `run-parity` label
|
||||
(`run-parity.yml` runs it when the label is added).
|
||||
|
||||
## Game releases
|
||||
|
||||
`.github/workflows/release.yml` releases the game by itself. It starts after every green `checks` run of a push
|
||||
to main, every 10 minutes (so a release waiting for merges to settle goes out without another merge), and by hand.
|
||||
`.github/workflows/release.yml` releases the game by itself. It starts after every green `checks` or `parity-main`
|
||||
run of a push to main (it releases a commit only once both passed on it), every 10 minutes (so a release waiting for merges to settle goes out without another merge), and by hand.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
@@ -101,12 +131,11 @@ flowchart LR
|
||||
windows["Windows x64<br/>GitHub windows-latest"]
|
||||
mac["macOS arm64<br/>Mac mini runner<br/>+ offscreen game run"]
|
||||
end
|
||||
build --> publish["publish vX.Y.Z as an alpha<br/>notes from the merged PRs"]
|
||||
publish --> alpha(["launchers on Alpha install it"])
|
||||
publish --> promote{"promote.yml, daily at 20:00 UTC:<br/>6 h old by then, smoke test, no release-blocker"}
|
||||
promote --> stable["stable and latest<br/>notes since the last stable"]
|
||||
stable --> launcher(["every launcher and server installs it"])
|
||||
stable --> kira(["Kira posts it;<br/>pings only with ### New"])
|
||||
build --> gate{"gate: the smoke test drew a world,<br/>no release-blocker is open"}
|
||||
gate -- no --> nothing(["nothing is published"])
|
||||
gate -- yes --> publish["publish vX.Y.Z as the release and latest<br/>notes from the merged PRs"]
|
||||
publish --> launcher(["every launcher and server installs it"])
|
||||
publish --> kira(["Kira posts it; the first release<br/>after 20:00 UTC pings, once a day"])
|
||||
```
|
||||
|
||||
### When it releases
|
||||
@@ -118,12 +147,12 @@ commits) since the last **published** game release:
|
||||
`xtask/`, `packaging/`, `Cargo.toml`, `Cargo.lock`, `research-lock.json`, or an exporter `horizon-prepare`
|
||||
compiles (the `mods/horizon/src/test/java/dev/horizonlab/parity/*.java` files its sources name). Markdown never
|
||||
counts.
|
||||
- It releases when at least one pull request counts and the newest of them merged at least 5 minutes ago, so a wave
|
||||
of merges becomes one release; if merges never pause, it releases once the oldest has waited 20 minutes. There is
|
||||
no minimum time between releases: every settled player-facing change ships, limited only by the release already
|
||||
building. That is the Alpha channel, many releases a day.
|
||||
- It releases in batches, so players get a few releases a day rather than one per merge: once 5 pull requests count
|
||||
and the newest of them merged at least 5 minutes ago (a wave of merges becomes one release), or once the oldest has
|
||||
waited 6 hours, however few they are.
|
||||
- A pull request labelled `release-now` (a crash or a blocker) releases at once.
|
||||
- A pull request labelled `skip-release` (work players don't see) doesn't count and isn't listed in the notes.
|
||||
- An open issue labelled `release-blocker` holds every game release, forced ones too (`held by release-blocker #N`).
|
||||
- One release at a time (concurrency group `game-release`); a run that finds nothing new does nothing.
|
||||
- A scheduled or hand-started run releases main's newest commit whose `checks` passed; after `checks`, the commit
|
||||
they passed on.
|
||||
@@ -137,7 +166,7 @@ How releases are numbered, and how installs from before 0.2 reach it: [versionin
|
||||
the patch after the newest release tagged on that line (`v0.2.0` first). A `feature` label doesn't change the line:
|
||||
only that file does, by pull request.
|
||||
- Without the file (every release before 0.2), `vYYYY.MM.DD`, then `.01`, `.02`… the same UTC day.
|
||||
- Every reader (`release_train.py`, `release_channels.py`, the launcher, `horizon-server update`, the website) ranks
|
||||
- Every reader (`release_train.py`, the launcher, `horizon-server update`, the website) ranks
|
||||
every `vX.Y.Z` tag above every dated one.
|
||||
|
||||
### Labels
|
||||
@@ -149,7 +178,7 @@ How releases are numbered, and how installs from before 0.2 reach it: [versionin
|
||||
| `skip-release` | Doesn't trigger a release and isn't listed in the notes |
|
||||
| `run-parity` | Runs the parity job once on a fork's pull request |
|
||||
| `parity-regression` | Opened by the nightly audit for a harness that fails on main |
|
||||
| `release-blocker` | On an issue: holds every beta back from stable while it is open ([Channels](#channels)) |
|
||||
| `release-blocker` | On an issue: no game release is published while it is open ([One channel](#one-channel)) |
|
||||
|
||||
Pull requests without `feature` are listed under **Fixed**. Titles are written for players, since they become
|
||||
the notes.
|
||||
@@ -180,63 +209,38 @@ runs the game: GitHub's runners have neither a GPU worth the name nor the game f
|
||||
- `### Known issues`: the bullets of [docs/known-issues.md](known-issues.md);
|
||||
- thanks to outside contributors, how to install, the disclaimer.
|
||||
|
||||
Kira posts every release in Discord's #releases. An Alpha build (a game pre-release) is posted silently: no ping and
|
||||
Discord's @silent flag, so nobody gets a notification. When the same release becomes Stable it is posted again, and
|
||||
that post pings the releases role when the notes have a `### New` section (at most once every 6 hours). Launcher
|
||||
releases post without a ping.
|
||||
Kira posts every release once in Discord's #releases. It pings the releases role at most once a day: the first game
|
||||
release published after 20:00 UTC, with a short list of what came out since its last ping. Every other post is
|
||||
silent (no ping and Discord's @silent flag). Launcher releases post without a ping.
|
||||
|
||||
### Channels
|
||||
### One channel
|
||||
|
||||
Every game release is published as an **alpha** build, a GitHub pre-release (the workflows, tools and labels
|
||||
call it a *beta*: `release-blocker` holds every beta), so GitHub's *latest* release stays the last
|
||||
**stable** one. The launcher's Settings has an **Updates** choice of two channels (`update_channel` in its
|
||||
`settings.json`, `horizon-launcher update-channel`):
|
||||
Since 2026-10-23 there is one channel. Every game release is published as the release, never a pre-release, and
|
||||
marked GitHub's *latest*: the launcher, `horizon-server update` and `install.sh` take it at once. Because nothing
|
||||
promotes it later, the checks that used to gate a promotion run in the release itself, and the publish job
|
||||
(`tools/release_train.py gate`) publishes nothing unless both pass:
|
||||
|
||||
- **Stable**, the default: a tested build about once a day, the alpha builds promoted below.
|
||||
- **Alpha**: every alpha build as soon as it is built, many times a day; it can break. "Alpha" is the project's
|
||||
word for builds that are still being tested (the whole of Horizon is in beta); Stable is the tested ones. An open
|
||||
launcher looks for releases every 30 minutes on Alpha (4 hours on Stable). Launchers from before 0.2 had a "Beta
|
||||
builds" switch instead; on, it reads as Alpha.
|
||||
- the release smoke test: the macOS build runs the game offscreen on the Mac mini and keeps its report,
|
||||
`smoke-test.json`, only when the game drew a world. The gate reads the report again before publishing, and the
|
||||
release carries it. A run whose macOS build went to GitHub (`MAC_RUNNER=macos-latest`) has no report, so it
|
||||
publishes nothing;
|
||||
- no open issue labelled `release-blocker`. `decide` checks first, so a blocked train builds nothing; the gate checks
|
||||
again right before publishing, so an issue labelled while the builds ran still holds the release. Only the label
|
||||
and the issue's state count, never its text: whoever opened the issue can edit the text after a maintainer
|
||||
labels it. Close the issue (or remove the label) and the next run releases everything waiting, with notes
|
||||
covering all of it.
|
||||
|
||||
`horizon-server update` installs stable builds (`--version <tag>` takes an alpha build by name). In Discord's #releases every
|
||||
Alpha is posted silently and only Stable posts notify (above).
|
||||
A failed gate fails the run; the next run (10 minutes later) decides again. Nothing older than the latest release is
|
||||
ever published: tags only count up.
|
||||
|
||||
`.github/workflows/promote.yml` runs `tools/release_channels.py promote` once a day at 20:00 UTC (21:00 in Paris in
|
||||
winter time, 22:00 in summer), with retries until 21:37 for a run GitHub starts late or skips. It promotes the newest
|
||||
beta that
|
||||
The launcher has no channel setting any more and looks for releases every 30 minutes. The game pre-releases of the
|
||||
old Alpha channel (v0.2.1 on, published before this change) stay listed for anyone who wants one by hand, but no
|
||||
launcher installs them as an update, and `release_train.py` ignores them: the first release of the single channel
|
||||
lists everything since the last release that was not a pre-release (v0.2.0). Launchers from before this change keep
|
||||
updating either way: with Alpha (or 0.17's "Beta builds") on they take every release, pre-release or not; with it
|
||||
off, every release that is not a pre-release, which is now every new one.
|
||||
|
||||
- is newer than the stable release,
|
||||
- had been out 6 hours at 20:00 UTC (published by 14:00 UTC that day; one published later waits for the next day),
|
||||
so every run of the evening picks the same beta and stable moves once a day,
|
||||
- passed its release smoke test: the macOS build attaches `smoke-test.json` (the offscreen game run's report) only
|
||||
when the game drew a world on the Mac mini, so a release built while `MAC_RUNNER` sends macOS to GitHub waits
|
||||
for a hand,
|
||||
- and isn't covered by an issue labelled `release-blocker`. An open blocker holds every beta; closed as completed
|
||||
it still holds the betas published before it closed (they have the bug); closed as not planned it holds
|
||||
nothing. Only the label and the issue's state count, never its text: whoever opened the issue can edit the
|
||||
text after a maintainer labels it, so it can't pick which betas go out.
|
||||
|
||||
Nothing older than the stable release is ever promoted, not even with `force`: GitHub's latest release is what
|
||||
`horizon-server update` and `install.sh` download, so it only moves forward.
|
||||
|
||||
When the oldest beta newer than the stable release has waited 30 hours (it missed a daily promotion it was due for;
|
||||
on a normal day a beta waits at most that long and is promoted), promote.yml opens an issue titled
|
||||
"Promotion to stable has stalled" with the reason from the last check (a blocker left open, smoke tests not
|
||||
running). It closes itself after the next promotion.
|
||||
|
||||
Promoting marks the beta stable and latest and rewrites its notes to list everything since the previous stable
|
||||
release (`release_train.py notes --stable`), so players who skipped the betas see all of it. Older betas stay
|
||||
betas. By hand, from a phone too (GitHub app: Actions, promote, Run workflow):
|
||||
|
||||
```sh
|
||||
gh workflow run promote -f tag=v0.2.3 # that beta now: no wait for 20:00, still no blocker
|
||||
gh workflow run promote -f tag=v0.2.3 -f force=true # even blocked or without a smoke test
|
||||
gh workflow run promote -f dry_run=true # what would be promoted now
|
||||
```
|
||||
|
||||
An alpha build's notes cover only what changed since the release before it (alpha or stable), and say it is an alpha build.
|
||||
`release_train.py decide` counts pull requests from the newest release of either channel, so betas don't
|
||||
release the same changes again.
|
||||
`promote.yml` and `tools/release_channels.py` (the daily promotion at 20:00 UTC) are gone.
|
||||
|
||||
### Signed checksums
|
||||
|
||||
@@ -298,7 +302,8 @@ gh variable set RELEASES_PAUSED --body 1 # no automatic game or launcher rel
|
||||
gh variable delete RELEASES_PAUSED # back on; the next hourly run catches up
|
||||
```
|
||||
|
||||
While paused, runs still decide and say why in their summary; `force=true` still releases.
|
||||
While paused, runs still decide and say why in their summary; `force=true` still releases, but never past an open
|
||||
`release-blocker`.
|
||||
|
||||
### Rolling back
|
||||
|
||||
@@ -308,8 +313,8 @@ A bad release is withdrawn by turning it back into a draft:
|
||||
gh release edit v0.2.3 --draft
|
||||
```
|
||||
|
||||
A beta that is not promoted yet needs no rollback: label an issue about it `release-blocker`. For a stable
|
||||
release: launchers list only published releases, so the previous version becomes the newest one again, launchers that
|
||||
To stop the next releases while a problem is fixed, label an issue about it `release-blocker`. For the bad
|
||||
release itself: launchers list only published releases, so the previous version becomes the newest one again, launchers that
|
||||
didn't install the bad one won't, and players who did can pick the previous version in the launcher's version
|
||||
list (`launcher/src/backend.rs` tests `withdrawn_release_is_never_offered`). The tag stays, so the next release
|
||||
that day takes the next number, and its notes start from the last *published* release, so they list the
|
||||
@@ -324,7 +329,7 @@ and by hand; pushes to `launcher` and `launcher-*` branches only build.
|
||||
|
||||
- `tools/release_train.py decide --kind launcher` counts the pull requests merged since the last published
|
||||
launcher release that changed those paths (not `launcher/links.json`, which the launcher reads from main, nor
|
||||
tests or Markdown), with the same settling rule (5 minutes, at most 20), `release-now`, `skip-release` and `RELEASES_PAUSED`.
|
||||
tests or Markdown), with the same batching rule (5 pull requests settled 5 minutes, or the oldest 6 hours), `release-now`, `skip-release` and `RELEASES_PAUSED`.
|
||||
- The tag is `launcher@X.Y.Z` on the release line (`launcher@0.2.0` first; the game and the launcher count their
|
||||
patches separately). Without `.github/release-line.txt`, `launcher-vX.Y.Z`: the patch after the last launcher tag,
|
||||
or the next minor (`X.Y+1.0`) when one of those pull requests is labelled `feature`. `launcher-v0.2.0` was taken
|
||||
@@ -338,6 +343,15 @@ and by hand; pushes to `launcher` and `launcher-*` branches only build.
|
||||
- Published with `--latest=false`: the repository's latest release stays a game release. Notes list the pull
|
||||
requests under New and Fixed; Kira posts launcher releases without pinging.
|
||||
|
||||
Making a launcher release GitHub's latest instead would break servers: every `horizon-server` already installed,
|
||||
`install.sh` and `install.ps1` ask for `releases/latest` and expect the game's archives there, and a server that
|
||||
can't update can't fetch the fix either. So the game release stays the latest, and it sends people to the launcher
|
||||
(#1647): its notes open with a "Want to play? Download the Horizon launcher" block (`PLAYERS` in
|
||||
`tools/release_train.py`: raw HTML, which GitHub shows and launchers' notes skip; the site's Releases page leaves
|
||||
it out too), and its archives carry labels ("Game files the
|
||||
launcher installs: Linux (…)") that GitHub shows in place of the file names. Everything that downloads matches
|
||||
the asset's name, which is unchanged.
|
||||
|
||||
Starting by hand, pausing and rolling back work as for the game (`gh workflow run launcher …`,
|
||||
`RELEASES_PAUSED`, `gh release edit launcher@X.Y.Z --draft`). Launchers older than the withdrawn release then
|
||||
see the previous one as the newest; launchers that already updated keep running.
|
||||
|
||||
@@ -75,11 +75,8 @@ separate implementation. [Geometry and collision scope](collision-geometry.md).
|
||||
|
||||
```sh
|
||||
cargo test --workspace
|
||||
cargo run --release --bin voxel-bench -- 100 > .local/voxel-benchmark.csv
|
||||
```
|
||||
|
||||
The dependency-free occupancy experiment compares scalar and bitset exposed-face counting for synthetic 16³ sections. It has no real mesh, material/AO/light work, neighboring-section context, JNI bridge or game integration. Speedups are kernel-only, not Minecraft FPS.
|
||||
|
||||
Public branding and new mod downloads use **Horizon**. The existing Fabric mod
|
||||
ID and `dev.horizonlab` namespace remain stable for installed instances and
|
||||
measurement compatibility. The installer backs up both old `horizon-lab-*.jar`
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
# Java mods and Horizon: what can carry over
|
||||
|
||||
Players ask "will my mods work?". Short answer: **Fabric and NeoForge jars
|
||||
will not run in Horizon as they are**, and no bridge we could build would
|
||||
change that for more than a handful of mods. What carries over is the
|
||||
*content* (data packs, resource packs, the data and assets inside mod jars)
|
||||
and the *ideas* (native Horizon ports of the mods people use most, written
|
||||
with [Horizon's own mod system](../mods.md)). This page is the reasoning.
|
||||
|
||||
## How Java mods work
|
||||
|
||||
### Fabric
|
||||
|
||||
- **Fabric Loader** finds jars in `mods/`, reads `fabric.mod.json`
|
||||
(entrypoints, dependencies, mixin configs, access wideners), and starts the
|
||||
game through a class loader that can rewrite classes as they load.
|
||||
- **Mixin** (SpongePowered) is how nearly every mod changes the game: a mixin
|
||||
class names a Minecraft class (`net.minecraft.client.gui.hud.InGameHud`) and
|
||||
injects code at points inside its methods (`@Inject(method = "render", at =
|
||||
@At("TAIL"))`, `@Redirect`, `@ModifyVariable`, `@Overwrite`...). The bytecode
|
||||
of the vanilla class is rewritten at load time. Access wideners make private
|
||||
fields and methods public for the same purpose.
|
||||
- **Fabric API** is a set of modules that give mods events and registries
|
||||
instead of raw mixins: `fabric-lifecycle-events` (`ClientTickEvents`,
|
||||
`ServerTickEvents`), `fabric-rendering` (`HudRenderCallback`,
|
||||
`WorldRenderEvents`), `fabric-command-api`, `fabric-key-binding-api`,
|
||||
`fabric-networking-api` (custom payloads), `fabric-registry-sync`,
|
||||
`fabric-resource-loader`, `fabric-screen-api`, `fabric-item-group`,
|
||||
`fabric-events-interaction` and about forty more. **Fabric API itself is
|
||||
implemented with mixins** into the same vanilla classes.
|
||||
- Mods mix the two freely: a mod using Fabric API events still calls
|
||||
`MinecraftClient.getInstance().player.getBlockPos()`,
|
||||
`world.getBlockState(pos)`, `DrawContext.drawText(...)`: direct calls into
|
||||
vanilla's classes, by their mapped names.
|
||||
|
||||
### NeoForge (and Forge)
|
||||
|
||||
- An event bus (`NeoForge.EVENT_BUS`, mod buses) with hundreds of events,
|
||||
`DeferredRegister` for registries, data attachments and capabilities,
|
||||
networking payloads, config specs. NeoForge patches vanilla's source
|
||||
directly (binary patches) to fire its events.
|
||||
- Mods also use mixins and access transformers, and call vanilla classes
|
||||
directly, as on Fabric.
|
||||
|
||||
### Data and assets in a jar
|
||||
|
||||
Besides code, a mod jar carries the same folders as packs:
|
||||
`assets/<namespace>/` (models, blockstates, textures, sounds, language files,
|
||||
shaders) and `data/<namespace>/` (recipes, loot tables, tags, advancements,
|
||||
predicates, functions, worldgen: biomes, features, structures). These are
|
||||
**vanilla formats**, read by vanilla's own code.
|
||||
|
||||
## Why a Java bridge cannot run them
|
||||
|
||||
Horizon is a reimplementation in Rust: there are no `net.minecraft` classes
|
||||
at runtime, no `InGameHud`, no `ClientPlayerEntity`, no bytecode to rewrite.
|
||||
|
||||
1. **Mixins have nothing to bind to.** A mixin is a patch against a specific
|
||||
method's bytecode. Without vanilla's classes there is no method, no
|
||||
injection point and no local variable to modify. This is not a missing
|
||||
feature we could add: it is the mechanism itself.
|
||||
2. **Fabric API is mixins too.** A shim Fabric API would have to be
|
||||
re-implemented from scratch as Java classes calling into Horizon. That part
|
||||
alone is possible for the event modules.
|
||||
3. **Mods call vanilla directly.** Even "pure Fabric API" mods use vanilla's
|
||||
classes for everything else: the player, the world, the block states, the
|
||||
renderer, the text drawing. Running them means providing Java classes with
|
||||
vanilla's names and behaviour, backed by Horizon's state: in effect a
|
||||
second Minecraft, in Java, on top of Horizon. Thousands of classes, in the
|
||||
mapped names of every mapping set (Yarn, Mojang, intermediary), version by
|
||||
version.
|
||||
4. **The JVM itself** would ship with every install (a trimmed JRE is still
|
||||
40-60 MB, the full one 150+ MB), start in a second or more, hold a few
|
||||
hundred MB of heap before any mod loads, and bring garbage-collector pauses
|
||||
back into the frame: the costs Horizon exists to remove. JNI calls cost
|
||||
tens to hundreds of nanoseconds each and every one crosses with copies.
|
||||
5. **No sandbox.** Java mods are fully trusted native-speed code with file
|
||||
and network access. Horizon's mods are sandboxed and their permissions are
|
||||
shown; a Java bridge would be the one hole in that.
|
||||
|
||||
**What a bridge could support**, if we ever built one: a stable subset of
|
||||
Fabric API events (client and server tick, HUD render callback, client
|
||||
commands, key bindings, custom payloads), with a tiny "vanilla view" API
|
||||
(player position, held item, chat), for mods written only against that
|
||||
subset. Surveying the most-downloaded Fabric mods, nearly none qualify: the
|
||||
popular ones are popular precisely because they reach into rendering, the
|
||||
world or the UI. The cost (a JVM in the game, a second API surface to keep
|
||||
stable) is far above the benefit. **We do not build it.** If that changes,
|
||||
the bridge would sit on top of the WIT API like any other mod runtime, so the
|
||||
sandbox would still hold.
|
||||
|
||||
## What we do instead
|
||||
|
||||
### 1. Data-driven content (packs and the data in mod jars)
|
||||
|
||||
Horizon already reads vanilla resource packs and data packs (functions,
|
||||
function tags, predicates today). Extending data-pack coverage to recipes,
|
||||
loot tables, tags, advancements and worldgen JSON brings most "content"
|
||||
packs over with no mod code at all, and it is vanilla behaviour, so the parity
|
||||
harnesses check it.
|
||||
|
||||
For **Fabric/NeoForge jars**, the launcher can offer "import the data": read
|
||||
`data/` and `assets/` from the jar and load them as a data pack plus a
|
||||
resource pack. What works: new recipes, loot changes, tags, advancements,
|
||||
functions, worldgen tweaks that only use vanilla blocks, retextures, language
|
||||
files. What does not: anything referring to a block, item or entity the jar
|
||||
registers in Java code (the ids do not exist); the import skips those files and
|
||||
lists them. With Horizon's planned `registries` interface, a native port can
|
||||
register those ids and reuse the jar's JSON models, textures, recipes and loot
|
||||
as they are.
|
||||
|
||||
### 2. Native Horizon ports of popular mods
|
||||
|
||||
Horizon itself covers the performance mods: Sodium, Lithium, FerriteCore,
|
||||
ModernFix, EntityCulling and ImmediatelyFast exist because vanilla Java is
|
||||
slow, and Horizon's renderer and simulation are the replacement (see
|
||||
[benchmark](../benchmark.md)). Zoom (OK Zoomer, Zoomify), FPS and keystroke
|
||||
overlays, a minimap and auto-reconnect are already built in as
|
||||
[extras](../extras.md).
|
||||
|
||||
#### Port first
|
||||
|
||||
Ranked by players reached per unit of API work. Each needs the planned
|
||||
interfaces listed in [mods.md](../mods.md#planned-interfaces).
|
||||
|
||||
| Mod (Java) | What it does | Horizon port | Needs |
|
||||
|---|---|---|---|
|
||||
| **Mod Menu** | list mods, open their settings | built in: Options > Mods (done), settings pages next | `ui` |
|
||||
| **AppleSkin** | food saturation and exhaustion on the HUD and tooltips | SDK mod | `inventory-read`, `ui` |
|
||||
| **Jade / WTHIT** | what the crosshair points at: block, entity, harvest tool, container contents | SDK mod | `target`, `ui` |
|
||||
| **JEI / EMI / REI** | browse items, recipes and uses | SDK mod (or built in: Horizon already has the recipe book's data) | `recipes`, `inventory-read`, `ui` |
|
||||
| **Xaero's Minimap / JourneyMap** | minimap, world map, waypoints | the minimap is an extra; a world map and waypoints as an SDK mod | `world-read`, `render`, `storage` |
|
||||
| **Litematica** | schematic overlay to build from | SDK mod | `world-read`, `render`, `storage`, `ui` |
|
||||
| **Mouse Tweaks / Inventory Profiles Next** | drag and sort inventory | built in or SDK mod | `inventory-read` + a sanctioned click API |
|
||||
| **Continuity / CIT** | connected and custom item textures | built into the renderer (pack formats) | none: resource-pack features |
|
||||
| **Distant Horizons** | low-detail far terrain | a Horizon renderer feature, not a mod | none |
|
||||
| **Iris + shader packs** | shaders | a Horizon renderer feature (wgpu shader pipeline), later | none |
|
||||
| **Simple Voice Chat** | proximity voice | server + client mod | `server`, `net`, audio (later) |
|
||||
|
||||
### 3. A porting guide (outline)
|
||||
|
||||
To be written as `docs/porting-from-fabric.md` once API 0.2 lands:
|
||||
|
||||
1. **Separate logic from glue.** Most of a mod is plain logic (maths,
|
||||
formatting, data structures): port it to Rust once, unit-test it on the
|
||||
host.
|
||||
2. **Map events.**
|
||||
|
||||
| Fabric | Horizon |
|
||||
|---|---|
|
||||
| `ClientModInitializer.onInitializeClient` | `Mod::init`, returning a `Registration` |
|
||||
| `ClientTickEvents.END_CLIENT_TICK` | `Registration::on_tick`, `Mod::tick` |
|
||||
| `HudRenderCallback` | `hud::set_panel` when the content changes (retained), or `on_frame` |
|
||||
| `ClientCommandRegistrationCallback` | `Registration::command`, `Mod::command` |
|
||||
| `ClientReceiveMessageEvents` | `Registration::on_chat`, `Mod::chat` |
|
||||
| `KeyBindingHelper.registerKeyBinding` | `keys` (planned) |
|
||||
| `Registry.register(Registries.ITEM, ...)` | `registries` (planned) with JSON in `data/` |
|
||||
| `ServerPlayNetworking` payloads | `net` (planned) |
|
||||
| config libraries (Cloth Config, YACL) | `storage` + a `ui` settings page (planned) |
|
||||
|
||||
3. **Replace mixins with hooks.** For each mixin, write down what it observes
|
||||
or changes. If a WIT hook covers it, use the hook. If not, open an issue
|
||||
asking for the hook ("I need X before/after Y"): hooks are added to the API
|
||||
for everyone instead of each mod patching the game.
|
||||
4. **Declare capabilities** in `horizon-mod.toml`, the least the mod needs.
|
||||
5. **Reuse assets**: textures, models, language files and recipes move as
|
||||
they are into the `.hmod`'s `assets/` and `data/` (with `registries`).
|
||||
6. **Test** with `cargo horizon-mod run` and hot reload; add unit tests for the
|
||||
logic; publish with a signed `.hmod`.
|
||||
|
||||
## Sources
|
||||
|
||||
- Fabric documentation (`docs.fabricmc.net`): mod structure, Mixin
|
||||
introduction, Fabric API modules and events.
|
||||
- SpongePowered Mixin wiki: injection points and how class transformation
|
||||
works.
|
||||
- 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.
|
||||
@@ -7,7 +7,8 @@ screen (the same screen as vanilla's) or in game, and every loader reloads from
|
||||
## How it works
|
||||
|
||||
`packs.rs` finds the packs (`FolderRepositorySource`: folders and zips, plus the built-in Programmer Art and High
|
||||
Contrast), reads `pack.mcmeta` (format range, overlays, filters) and builds one overlay directory that layers the
|
||||
Contrast, which only the asset index holds: preparation copies them, `horizon-prepare packs` repairs older resources),
|
||||
reads `pack.mcmeta` (format range, overlays, filters) and builds one overlay directory that layers the
|
||||
selected packs over the prepared vanilla resources, later packs winning. Files vanilla reads as a resource *stack*
|
||||
(language files, `sounds.json`, font definitions, atlas definitions) are merged layer by layer as vanilla merges them.
|
||||
Every loader then reads that one tree; `game/packs.rs` (`reload_packs`) reloads all of them in game, as
|
||||
@@ -32,6 +33,7 @@ harness named checks that loader against vanilla).
|
||||
| Overlays per format | `pack.mcmeta` `overlays` | works | `test_resource_pack_parity` (an overlay for 26.3 applied, an older one not) |
|
||||
| Filters | `pack.mcmeta` `filter` | works | `test_resource_pack_parity` (`packs/pattern.rs` regex subset) |
|
||||
| Folder and zip packs, order, built-in packs | `resourcepacks/` | works | `test_resource_pack_parity`, `test_pack_selection_parity` |
|
||||
| Server resource packs: the prompt, the server list's Server Resource Packs setting, download (250 MiB, SHA-1, `downloads/` keeps 20), applied on top of the player's packs, removed on leaving | the server's `resource_pack_push`/`_pop` | works, no download toasts | `tools/server_pack_e2e.py` (against vanilla's server and Horizon's), unit tests in `server_packs.rs`; `test_server_resource_pack_parity` for Horizon's server |
|
||||
| Other namespaces | `assets/<namespace>/` | works | `test_resource_pack_parity` |
|
||||
| Block states: variants, multipart, weights, rotations, uvlock | `blockstates/` | works | `test_blockstate_model_parity`, `test_model_choice_parity`, `test_blockstate_transform_parity` |
|
||||
| Block models: parents, elements, rotations, faces, cullface, tint, shade, light emission, ambient occlusion | `models/block/` | works | `test_model_resolution_parity`, `test_model_baking_parity`, `test_section_mesh_parity` |
|
||||
@@ -70,10 +72,10 @@ harness named checks that loader against vanilla).
|
||||
| Paintings, mob effect icons | `atlases/paintings.json`, `textures/mob_effect/` | works | loaded from the overlay |
|
||||
| Locator bar styles | `waypoint_style/` | **no** | the locator bar isn't drawn yet |
|
||||
| Post effects (spectating a creeper, spider or enderman; glowing outlines) | `post_effect/`, `shaders/post/` | **no** | Horizon's effects are WGSL; a pack's GLSL post chain isn't run |
|
||||
| Core shaders | `shaders/core/`, `shaders/include/` | **no** | Horizon draws with WGSL; packs that replace core shaders need the GLSL translation of [shader-packs.md](shader-packs.md) |
|
||||
| Core shaders | `shaders/core/`, `shaders/include/` | **no** | Horizon draws with WGSL; a pack's GLSL core shaders aren't run |
|
||||
| GPU warn list, regional compliance | `gpu_warnlist.json`, `regional_compliancies.json` | n/a | OpenGL driver warnings and play-time notices for some regions; not used |
|
||||
|
||||
Summary: 44 rows; 31 work, 3 partly, 8 don't (interpolated animation, TrueType fonts, credits and end poem,
|
||||
Summary: 45 rows; 32 work, 3 partly, 8 don't (interpolated animation, TrueType fonts, credits and end poem,
|
||||
villager hats, trims on worn armour, locator bar styles, post effects, core shaders), 2 don't apply. Except the
|
||||
shaders, the missing pieces are missing vanilla features too, and each vanilla parity fix covers the pack case as well.
|
||||
|
||||
@@ -82,6 +84,7 @@ shaders, the missing pieces are missing vanilla features too, and each vanilla p
|
||||
| Gap | Size | Where |
|
||||
| --- | --- | --- |
|
||||
| Animation `interpolate` | small | fix PR (`gfx.rs` `animate_sprites`) |
|
||||
| Server pack download toasts (`download.pack.*`) | small | `game/server_packs.rs` |
|
||||
| GUI scaling `width`/`height`, `stretch_inner`, `tile`, `stretch` | small | next fix PR (`ui.rs`) |
|
||||
| Villager hats | small | [#334](https://github.com/ludovic111/horizon/issues/334) |
|
||||
| `blur`/`clamp` from packs | small | [#335](https://github.com/ludovic111/horizon/issues/335) |
|
||||
@@ -89,7 +92,7 @@ shaders, the missing pieces are missing vanilla features too, and each vanilla p
|
||||
| Trims on worn armour (paletted textures) | medium | [#337](https://github.com/ludovic111/horizon/issues/337) |
|
||||
| Credits and end poem screen | medium | [#338](https://github.com/ludovic111/horizon/issues/338) |
|
||||
| Locator bar | medium | [#339](https://github.com/ludovic111/horizon/issues/339) |
|
||||
| Post effects and core shaders | large | [shader-packs.md](shader-packs.md) |
|
||||
| Post effects and core shaders | large | none yet |
|
||||
|
||||
## Testing a pack
|
||||
|
||||
|
||||
+2
-3
@@ -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
|
||||
|
||||
@@ -1471,7 +1470,7 @@ the `hp` text when they no longer fit; and the header and footer wrapped by
|
||||
the list in single player unless a `list` objective is set.
|
||||
`tools/test_tab_list_parity.py` runs vanilla's own `extractRenderState` frame
|
||||
after frame (`VanillaTabListOracle`: stand-in connection, level and options,
|
||||
real `Scoreboard`) against `examples/tab_list_fixture` and compares every fill,
|
||||
real `Scoreboard`) against `examples/probe/tab_list_fixture.rs` and compares every fill,
|
||||
styled text run, sprite and face blit (as `hud_layout::GuiDraw` calls, painted
|
||||
like the rest of the HUD): **1,000 cases, 3,476 frames and 844,758
|
||||
calls match**. The game draws the same layout while the player-list key is
|
||||
@@ -1492,7 +1491,7 @@ nearest first. `WorldBorder::warning_strength` feeds `hud_overlays::vignette`
|
||||
the border's warning strength at the camera. `tools/test_world_border_render_parity.py` drives vanilla's border,
|
||||
renderer and vignette (`VanillaWorldBorderRenderOracle`, with a stand-in GPU
|
||||
device, dynamic-uniform writer and render pass) against
|
||||
`examples/world_border_render_fixture`: **1,500 cases and 16,859 frames match
|
||||
`examples/probe/world_border_render_fixture.rs`: **1,500 cases and 16,859 frames match
|
||||
bit for bit** (8,513 with the wall drawn). The game draws the wall with
|
||||
`RenderPipelines.WORLD_BORDER`'s overlay blend and the mipmapped forcefield
|
||||
texture, and follows the server's border packets. One border is kept for all
|
||||
|
||||
+10
-11
@@ -38,7 +38,7 @@ and some are waiting for Ludovic:
|
||||
| Private vulnerability reporting | **Live** (see the end of this page). |
|
||||
| Signed checksums on releases | **Live** for new releases (#1011): the `release` environment holds the key, and its public half is in `release-keys.txt` (#1023). Releases from before then are unsigned. |
|
||||
| Launchers and servers checking signatures | **Not yet**: #1014 waits as a draft until a signed stable game release and a signed launcher release exist. Until then they trust GitHub's checksum, as before. |
|
||||
| Alpha, then stable | **Live** (#1012): every release is first an alpha build. The launcher's Updates setting picks Stable (the default) or Alpha (the pre-releases). |
|
||||
| Smoke test and release-blocker before publishing | **Live**: since 2026-10-23 every release is the latest at once (one channel, Ludovic's decision), so it is published only after its smoke test passed and while no `release-blocker` is open. The 6-hour beta of the old Alpha, then stable flow (#1012) is gone. |
|
||||
| Reports marked suspicious | **Partly**: the scan of Discord for agents does it. Kira's issues do it once its pull request merges. |
|
||||
| Code owners' review of the pipeline | **Not yet**: `.github/CODEOWNERS` and its protection (#1015) wait for the App, below. Until then pipeline changes merge like any other once `verify` passes. |
|
||||
| Agents on their own GitHub App | **Not yet**: prepared, waiting for Ludovic to create it. Agents still use his account. |
|
||||
@@ -53,11 +53,10 @@ and some are waiting for Ludovic:
|
||||
- **`verify` always runs.** Labels no longer start the checks, and the required `verify` job has no condition, so
|
||||
the only `verify` a change can have is one that ran. Main requires it, from GitHub Actions only, for everyone,
|
||||
admins included.
|
||||
- **Alpha, then stable.** Every release is first an **alpha** build (a GitHub pre-release). It becomes **stable**, the version launchers and
|
||||
servers install by themselves, in the daily promotion (20:00 UTC), only after it has been out 6 hours and passed its
|
||||
smoke test (the game started and drew a world on the Mac mini), and only while no issue labelled `release-blocker`
|
||||
is open. If a beta misses a promotion it was due for, an issue says so. Players who want the newest builds at once
|
||||
pick **Alpha** under Updates in the launcher's Settings. Discord announces stable releases only.
|
||||
- **Checked before it is published.** Every release is published as the latest, which launchers and servers
|
||||
install by themselves, so the release run publishes it only after its smoke test passed (the game started and
|
||||
drew a world on the Mac mini) and only while no issue labelled `release-blocker` is open; otherwise nothing is
|
||||
published.
|
||||
- **Signed updates.** Each release carries a list of its files' checksums, signed with Horizon's release key. The
|
||||
launcher (for the game and for itself) and `horizon-server update` check that signature against the public key
|
||||
built into them, then check the download against the list. Anything unsigned, signed with another key, signed
|
||||
@@ -78,9 +77,8 @@ and some are waiting for Ludovic:
|
||||
## What still needs Ludovic
|
||||
|
||||
- **Approving pipeline changes** (rare): a pull request touching a file in `.github/CODEOWNERS`.
|
||||
- **Holding a release back or speeding one up**, from his phone if he likes. Label an issue `release-blocker` to
|
||||
hold every beta until it is closed. Run the `promote` workflow (GitHub app: Actions,
|
||||
promote, Run workflow) to make a beta stable at once.
|
||||
- **Holding releases back or speeding one up**, from his phone if he likes. Label an issue `release-blocker` to
|
||||
hold every release until it is closed; label a pull request `release-now` to release it as soon as it merges.
|
||||
- **Creating the GitHub App**: one link, "Create GitHub App", then "Install". His login, his clicks.
|
||||
- **Fork pull requests**: their checks run only after a maintainer approves them, and they run on the Mac mini only
|
||||
after a maintainer has read them and added `run-parity`.
|
||||
@@ -90,8 +88,9 @@ and some are waiting for Ludovic:
|
||||
## What this doesn't solve
|
||||
|
||||
- **Code that merges is code that ships.** Signing proves a build came from Horizon's pipeline, not that the code
|
||||
is good. Against a bad change, the safety nets are the checks and harnesses, review, the 6-hour beta and the
|
||||
release-blocker label.
|
||||
is good. Against a bad change, the safety nets are the checks and harnesses, review, the release smoke test and
|
||||
the release-blocker label. Since the single channel there is no 6-hour beta: a change reaches every player
|
||||
within minutes of merging.
|
||||
- **Until agents switch to the App**, they still work with Ludovic's own account, so nothing technical tells his
|
||||
actions from theirs. Code owners' reviews are switched on together with the App.
|
||||
- **The Mac mini** builds the macOS release and also runs pull requests' parity checks: a pull request from this
|
||||
|
||||
+14
-9
@@ -26,18 +26,23 @@ the other dimensions' levels as `Parked` values and swaps one into place (`enter
|
||||
The packets of a guest are read in its own level's pass (`Hub::tick_level`), so its actions and
|
||||
commands run with its level in place.
|
||||
|
||||
The window's own game (single player's default, `--no-server-thread`, `HORIZON_SERVER_THREAD=0`, and the
|
||||
command harness) keeps one level, which follows its player (`enter_dimension`). LAN guests of a world run
|
||||
that way stay in the host's dimension. It is the default again only until the server thread reaches parity
|
||||
(`--server-thread` or `HORIZON_SERVER_THREAD=1` opts in), so it gets no multi-level work.
|
||||
The window's own game (`--in-frame`, `--no-server-thread`, `HORIZON_SERVER_THREAD=0`, and the command
|
||||
harness) keeps one level, which follows its player (`enter_dimension`). LAN guests of a world run that way
|
||||
stay in the host's dimension. That mode is the escape hatch, so it gets no multi-level work.
|
||||
|
||||
## One code path for both
|
||||
|
||||
The dedicated server and the server thread are the same code. The server thread runs a `Game` with
|
||||
`options.dedicated` set and a hub without a host player. The window joins it through memory as one
|
||||
more player. Everything above serves both, and `server_dimension_players` (vanilla clients on Horizon's
|
||||
dedicated server) and `lan_e2e --server-thread` (Horizon clients on the server thread) check it from
|
||||
the two sides.
|
||||
The dedicated server and the server thread are the same code. Each `Game` has an explicit
|
||||
`ExecutionRole`: `Client`, `IntegratedServer` or `DedicatedServer`, selected before construction in
|
||||
`Options.execution_role`. Startup, world loading and opening other dimensions use that role. Only
|
||||
clients mesh chunks and show loading progress; a client can still run its simulation in-frame.
|
||||
Connecting or disconnecting changes `remote`, independently of the execution role.
|
||||
|
||||
The server thread has a hub without a host player. The window joins it through memory as one
|
||||
more player. It still sets `options.dedicated` for gameplay checks outside the role migration's
|
||||
startup/world-loading scope. Everything above serves both servers, and `server_dimension_players`
|
||||
(vanilla clients on Horizon's dedicated server) and `lan_e2e --server-thread` (Horizon clients on the
|
||||
server thread) check it from the two sides.
|
||||
|
||||
## Cost of an extra level
|
||||
|
||||
|
||||
+2
-3
@@ -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.
|
||||
|
||||
@@ -1,493 +0,0 @@
|
||||
# Shader packs
|
||||
|
||||
Horizon will run two kinds of shader packs:
|
||||
|
||||
- **Horizon shader packs**: WGSL, a `pack.toml` manifest and documented stages. Horizon's own format, made for wgpu,
|
||||
with hot reload while you edit.
|
||||
- **Java shader packs** (OptiFine/Iris): the `shaders/` packs players already have, translated from GLSL to WGSL
|
||||
when they load.
|
||||
|
||||
Both are off by default. With no pack selected the renderer draws exactly what it draws today, which is vanilla
|
||||
26.3's picture: no extra pass, no extra target, the same pixels.
|
||||
|
||||
| Part | State |
|
||||
| --- | --- |
|
||||
| Renderer layout (below) | today's code |
|
||||
| Horizon shader packs: `composite` stage, uniforms, hot reload, Shader Packs page | done (the page: list, pick, open the folder, drop a pack on it) |
|
||||
| Horizon shader packs, api 2: stage `format`s, `[profiles]`, option descriptions, a `noise` texture, the opaque depth, a G-buffer reconstructed from depth, a sun/moon shadow map (Stages, below) | first slice: `examples/shaderpacks/horizon-ultra` |
|
||||
| Horizon shader packs: `deferred`, `gbuffer`, `shadow` stages (the pack's own code in the world pass) | planned |
|
||||
| Shader Pack Settings page: a pack's options, sub-screens, sliders, profiles and Reset, Horizon and Java packs alike; applied once on Done, as Iris does | done |
|
||||
| Java shader packs: preprocessing + GLSL parse coverage | spike done: 450 of 470 programs reach valid WGSL (below) |
|
||||
| Java shader packs: preprocessor (`crates/horizon-shaderpack`: includes, options, Iris's macros, JCPP's `#if` and `#define` rules, `.lang` files) | done: every program of the three test packs preprocesses; ten packs tested (Compatibility, below) |
|
||||
| Java shader packs: GLSL → WGSL (`horizon_shaderpack::translate`: syntax-tree legaliser, naga; struct and nested-array varyings, vertex `texture`, `mat2(vec4)`, `1 << 31`) | done: the 464 programs the three test packs enable by default translate (below) |
|
||||
| Java shader packs: `shaders.properties` (`horizon_shaderpack::properties`: screens, sliders, profiles, `program.*.enabled`, image formats, blend modes, `texture.*`) | done: read like Iris for the three test packs |
|
||||
| Java shader packs: full-screen pass plan (`horizon_shaderpack::pipeline`: `DRAWBUFFERS`/`RENDERTARGETS`, `colortexN` formats and clearing, buffer flips, `blend.*`) | done: planned for the three test packs |
|
||||
| Java shader packs: full-screen passes drawn (`java_pack.rs`, `gfx/java_stages.rs`: `begin`, `prepare`, `deferred*`, `composite*`, `final` over Horizon's world) | first slice: BSL and Complementary run (below); `depthtex1`/`depthtex2` before translucent geometry, `blend.*`, PNG `texture.<stage>.*` and `texture.noise` |
|
||||
| Java shader packs: custom uniforms (`horizon_shaderpack::uniforms`), `sunPathRotation`, `clouds`/`sun`/`moon`, eye light, `wetness` | done for the full-screen passes (below) |
|
||||
| Java shader packs: `gbuffers_*`, `shadow`, `.dat` and resource-location textures, images, compute | planned |
|
||||
|
||||
## How the renderer draws a frame today
|
||||
|
||||
Everything is in `crates/horizon-client/src/gfx.rs`, `Renderer::render`, one command encoder per frame:
|
||||
|
||||
1. **World pass** (`"Horizon world"`): clears colour to the fog colour (black on the title screen and in the End)
|
||||
and depth to 0 (reversed depth, `Depth32Float`, `GreaterEqual`; `camera::perspective`). In order: the sky
|
||||
(`sky` pipeline, `terrain.wgsl`), the title panorama (`gfx/panorama.rs`) or the sun, moon and stars
|
||||
(`celestial_pipeline`), the dark disc; solid and cutout terrain (`solid`, one indirect multi-draw over the
|
||||
section arena, `gfx/arena.rs`); entities and block entities (`entity_pipeline`, `entity.wgsl`, batched by
|
||||
`gfx/entity_batch.rs`); block breaking (`crumbling_pipeline`); additive geometry (lightning, dragon beams);
|
||||
the block outline and debug lines; translucent terrain (`translucent`); the world border (`border.wgsl`);
|
||||
translucent crumbling; clouds (`cloud_pipeline`). Weather and particles are entity quads. Depth is
|
||||
discarded at the end of the pass.
|
||||
2. **World resolve** (`gfx/world_post.rs`, `world_post.wgsl`): only when resolution scale isn't 100% or FXAA is
|
||||
on, the world pass draws into its own colour and depth targets, and one full-screen pass copies or
|
||||
anti-aliases them onto the screen.
|
||||
3. **Hand** (`"First-person hand"`): the first-person hand and held item, with depth cleared, at the hand FOV.
|
||||
4. **Screen effects** (`screen_effects.rs`): pumpkin blur, portal, powder snow, vignette, nausea, as
|
||||
full-screen quads.
|
||||
5. **Menu blur** (`menu_blur.rs`, `menu_blur.wgsl`): vanilla's `menuBackgroundBlurriness` behind screens.
|
||||
6. **HUD** (`hud.rs`, `hud.wgsl`): GUI, text, items in slots.
|
||||
|
||||
All world shaders share one uniform block, `Globals` in `gfx.rs` (`struct Globals` in `terrain.wgsl`):
|
||||
view-projection, inverse view, fog colour and distances, sky colour, sun direction, sunrise colour, game time.
|
||||
The lightmap, fog and sky colours are computed on the CPU (`environment.rs`, `fog.rs`) as vanilla does.
|
||||
|
||||
## Horizon shader packs
|
||||
|
||||
### Where packs live and how one is picked
|
||||
|
||||
- Packs go in `shaderpacks/` beside `options.txt` in the game folder (the same folder Iris uses, so one folder
|
||||
holds both kinds). That is the game home the launcher starts the game in (`%APPDATA%\horizon` on Windows,
|
||||
`~/Library/Application Support/horizon` on macOS, `~/.local/share/horizon` on Linux), not the launcher's version
|
||||
folder. A pack with a `pack.toml` at its root is a Horizon pack; a folder with `shaders/`, or a `.zip`, is a Java
|
||||
pack.
|
||||
- The **Shader Packs** page lists them: **Video Settings → Shader Packs...** (where Iris puts its button), **Options →
|
||||
Horizon Settings... → Shader Packs...**, and the Shader Pack row of the graphics settings lead to it. It shows the folder's full path
|
||||
and an *Open Folder* button (the folder is made if it is missing), then one switch per pack: turning one on picks
|
||||
it, turning it off is the vanilla picture. With no pack, it says so under the path. The list is read again every
|
||||
second while the page is open, so a pack dropped into the folder shows up. A `.zip` or pack folder dropped on the
|
||||
window while the page shows is copied into the folder and picked (Iris's `ShaderPackScreen.onFilesDrop`); one of
|
||||
that name already there is left alone.
|
||||
- With a pack on that has options, **Shader Pack Settings...** opens them: Horizon packs' `[options]` and
|
||||
`[profiles]`, Java packs' `#define`/`const` options laid out by `shaders.properties` (`screen`, `screen.<name>`,
|
||||
`sliders`, `profile.*`) and named by `lang/en_us.lang` (`option.*`, `value.*`, `screen.*`, `profile.*`, as Iris;
|
||||
without one, the option's own name). The values are saved and the pack built again once, when the page closes
|
||||
(Iris applies on Done), not on every click or slider step. A saved value an option doesn't list is ignored.
|
||||
- The choice is kept in `horizon-graphics.txt` (`shaderPack:<folder or zip name>`, empty = off). A pack's option
|
||||
values are kept in `shaderpacks/<pack>.txt`, as Iris does.
|
||||
- A pack that fails to load or compile leaves the vanilla picture (or the last pack that worked) on and says why on
|
||||
its row ("Failed", with the error), in chat and in the log. Nothing a pack does can stop the game from starting.
|
||||
- Benchmarks (`--benchmark`) and the parity harnesses never load a pack.
|
||||
|
||||
### Layout
|
||||
|
||||
```
|
||||
my-pack/
|
||||
pack.toml
|
||||
shaders/
|
||||
composite.wgsl
|
||||
bloom.wgsl
|
||||
textures/
|
||||
noise.png # api 2: [textures] noise
|
||||
LICENSE
|
||||
```
|
||||
|
||||
```toml
|
||||
[pack]
|
||||
name = "Warm evenings"
|
||||
description = "A gentle grade and a soft vignette."
|
||||
authors = ["you"]
|
||||
version = "1.0.0"
|
||||
license = "MIT"
|
||||
api = 1 # the stage and uniform contract below
|
||||
|
||||
[[stage]]
|
||||
kind = "composite" # see Stages
|
||||
shader = "shaders/composite.wgsl"
|
||||
entry = "fs_main" # optional, default fs_main
|
||||
|
||||
[[stage]]
|
||||
kind = "composite" # stages of one kind run in file order
|
||||
shader = "shaders/bloom.wgsl"
|
||||
scale = 0.5 # optional: this stage's target size relative to the screen
|
||||
|
||||
[options.saturation]
|
||||
label = "Saturation"
|
||||
default = 1.15
|
||||
min = 0.0
|
||||
max = 2.0
|
||||
step = 0.05
|
||||
|
||||
[options.vignette]
|
||||
label = "Vignette"
|
||||
default = true
|
||||
description = "Darkens the corners." # optional: the button's tooltip
|
||||
```
|
||||
|
||||
Api 2 (`api = 2`) adds:
|
||||
|
||||
```toml
|
||||
[[stage]]
|
||||
kind = "composite"
|
||||
shader = "shaders/lighting.wgsl"
|
||||
format = "rgba16float" # this stage's target: rgba8unorm, rgba16float or rgb10a2unorm; the last stage
|
||||
# always writes the screen's format, so earlier ones can keep HDR colour
|
||||
|
||||
[profiles.low] # the Profile button cycles these; "Custom" when the values match none
|
||||
vignette = false
|
||||
saturation = 1.0
|
||||
|
||||
[textures]
|
||||
noise = "textures/noise.png" # replaces the prelude's noise_texture (256x256 random RGB without it)
|
||||
```
|
||||
|
||||
Options become WGSL [pipeline-overridable constants](https://www.w3.org/TR/WGSL/#override-decls): the shader
|
||||
declares `override saturation: f32 = 1.15;` and `override vignette: bool = true;`, and the settings screen sets
|
||||
them. Numbers are `f32` (with `min`/`max`/`step`, a slider) or `i32` (`values = [...]`, a cycle button); `true`/`false`
|
||||
are `bool` (an on/off button). Changing an option rebuilds that stage's pipeline (milliseconds), which is the job
|
||||
OptiFine's `#define` options do, without text substitution.
|
||||
|
||||
### Stages
|
||||
|
||||
A stage is one full-screen fragment shader. Horizon supplies the vertex shader (one triangle) and, before the
|
||||
pack's source, a prelude with the bindings, the `Frame` uniform and helper functions, so a pack's file holds only
|
||||
its own code.
|
||||
|
||||
| Stage | Runs | Reads | Writes | State |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `composite` | after the world pass, before the hand | scene colour and depth, previous stage | the next scene colour | first slice |
|
||||
| `final` | after the hand and screen effects, before menus and HUD | colour with hand, depth | the screen | planned |
|
||||
| `deferred` | after opaque terrain and entities, before translucent ones | opaque colour, depth, G-buffers | opaque colour | planned |
|
||||
| `gbuffer` | terrain, entities, water, sky: a WGSL `material` function called by Horizon's shaders | vertex data, atlas | colour + G-buffers (normal, material) | planned |
|
||||
| `shadow` | the world from the sun, into a shadow map | vertex data | shadow depth | planned |
|
||||
|
||||
The first slice has `composite` only. A `composite` stage reads the scene, not the HUD, the hand or the menus,
|
||||
so a pack can't make text unreadable. Every stage after the first also reads the previous stage's output.
|
||||
|
||||
Bindings in group 0 (the prelude declares them):
|
||||
|
||||
| Binding | WGSL | What |
|
||||
| --- | --- | --- |
|
||||
| 0 | `scene_color: texture_2d<f32>` | the world's colour (sRGB-encoded, as on screen) |
|
||||
| 1 | `scene_depth: texture_depth_2d` | the world's depth (reversed: 1 near, 0 sky) |
|
||||
| 2 | `previous: texture_2d<f32>` | the previous `composite` stage's output; `scene_color` for the first |
|
||||
| 3 | `linear_sampler: sampler` | linear, clamp to edge |
|
||||
| 4 | `nearest_sampler: sampler` | nearest, clamp to edge |
|
||||
| 5 | `frame: Frame` (uniform) | below |
|
||||
|
||||
```wgsl
|
||||
struct Frame {
|
||||
view: mat4x4<f32>, // world (camera-relative) to view
|
||||
projection: mat4x4<f32>, // view to clip, reversed depth
|
||||
inverse_view: mat4x4<f32>,
|
||||
inverse_projection: mat4x4<f32>,
|
||||
camera_position: vec4<f32>, // xyz: world position of the eye (f32, so ~1 mm precision at 30 000 blocks)
|
||||
resolution: vec4<f32>, // width, height, 1/width, 1/height of this stage's target
|
||||
time: vec4<f32>, // seconds since the pack loaded, frame counter, day fraction (0 = sunrise), partial tick
|
||||
sun: vec4<f32>, // xyz: direction to the sun (world space), w: sun angle in radians (0 at noon)
|
||||
moon: vec4<f32>, // xyz: direction to the moon, w: moon phase (0..7)
|
||||
sky_color: vec4<f32>, // vanilla's sky colour this frame
|
||||
fog_color: vec4<f32>, // vanilla's fog colour this frame (what the world pass clears to)
|
||||
fog: vec4<f32>, // environmental fog start, end; sky fog end; cloud fog end (blocks)
|
||||
weather: vec4<f32>, // rain level, thunder level, 0, 0 (smoothed as vanilla does)
|
||||
camera_state: vec4<f32>, // submerged in: 0 air, 1 water, 2 lava, 3 powder snow; night vision; darkness; blindness (0 for now)
|
||||
view_params: vec4<f32>, // near, far (Camera.depthFar), render distance (blocks), vertical FOV (radians)
|
||||
dimension: vec4<f32>, // 0 overworld, -1 nether, 1 end; has sky light; 0, 0
|
||||
}
|
||||
```
|
||||
|
||||
Prelude helpers: `linear_depth(depth) -> f32` (blocks from the eye), `view_position(uv, depth) -> vec3`,
|
||||
`world_offset(uv, depth) -> vec3` (camera-relative world position), `is_sky(depth) -> bool`, `luminance(rgb)`,
|
||||
`srgb_to_linear` / `linear_to_srgb`. They hide reversed depth, so a pack doesn't depend on it.
|
||||
|
||||
The uniform layout only grows: a new field goes at the end and the `api` number goes up; a pack that declares an
|
||||
older `api` still loads.
|
||||
|
||||
An `api = 2` pack's stages get a second prelude after the first (`shader_pack_prelude_api2.wgsl`; api 1 packs don't,
|
||||
so names they declare themselves can't clash):
|
||||
|
||||
| Binding | WGSL | What |
|
||||
| --- | --- | --- |
|
||||
| 6 | `frame_ext: FrameExt` (uniform) | last frame's view and projection and camera, the shadow map's matrices, resolution and distance, eye light, smoothed rain |
|
||||
| 7, 8 | `scene_normal`, `scene_material: texture_2d<f32>` | the G-buffer (below) |
|
||||
| 9 | `opaque_depth: texture_depth_2d` | the world's depth before translucent geometry (water, glass, ice) |
|
||||
| 10, 11 | `shadow_depth: texture_depth_2d`, `shadow_sampler: sampler_comparison` | the sun's (the moon's at night) shadow map |
|
||||
| 12, 13 | `noise_texture: texture_2d<f32>`, `repeat_sampler: sampler` | `[textures] noise`, linear, repeat |
|
||||
|
||||
Helpers: `opaque_depth_at(uv)`, `world_normal_at(uv)`, `material_at(uv)` (block light, sky light, translucent mask,
|
||||
roughness), `reproject_uv(world_offset)` (last frame's uv and depth), `sample_shadow(world_offset, normal)` (5-tap
|
||||
PCF, 1 lit .. 0 shadowed), `aces_tonemap(rgb)`.
|
||||
|
||||
What each costs, only while a stage reads it (naga reports the bindings each entry point uses): the opaque depth, a
|
||||
depth copy between the opaque and translucent halves of the world pass; the G-buffer, one full-screen pass after
|
||||
the world; the shadow map, a depth pass of the terrain and entities from the light. Limits of this first slice: the
|
||||
G-buffer is reconstructed from depth and colour (normals from neighbouring depths, block light estimated from
|
||||
brightness, sky light the camera's), not written by the world's shaders; the shadow map holds the sections the
|
||||
camera draws, so casters outside the view throw no shadow, and none of the terrain where Metal draws sections as one
|
||||
list (`gfx/flat.rs`, more than 4096 of them). The `deferred`, `gbuffer` and `shadow` stages above replace these.
|
||||
|
||||
### How it renders
|
||||
|
||||
With a pack on, the world pass draws into the world target of `gfx/world_post.rs` (it exists already for resolution
|
||||
scale and FXAA), with its depth stored and bindable. Then each `composite` stage draws into a ping-pong colour
|
||||
target, and the last output goes through the usual copy or FXAA onto the screen, under the hand, screen effects,
|
||||
menus and HUD. Without a pack none of this exists, and the frame is today's frame.
|
||||
|
||||
### Hot reload
|
||||
|
||||
While a pack is selected Horizon checks its files' modification times twice a second (a folder pack; a zip reloads
|
||||
when the zip changes). A change reparses `pack.toml`, compiles every stage with naga first (parse and validate, with
|
||||
the prelude), and swaps the pipelines only if all of them compiled; otherwise the last good pipelines stay on and the
|
||||
error (file, line, column, message) goes to chat and the log. F3 + T (vanilla's resource reload) reloads the pack
|
||||
too.
|
||||
|
||||
### Safety
|
||||
|
||||
A Horizon shader pack is WGSL only: it runs on the GPU, can't read files, the network or game memory, and naga
|
||||
validates it before wgpu sees it. A shader can still be slow or loop for long enough to make the GPU driver reset;
|
||||
that costs a frame or a device loss, which the renderer already handles. Limits: 16 stages, 64 options, stage
|
||||
targets at most the screen size times 2.
|
||||
|
||||
## Java shader packs (OptiFine/Iris)
|
||||
|
||||
### What a Java pack is
|
||||
|
||||
A `shaders/` folder of GLSL programs, named by where Iris (and OptiFine before it) runs them, plus
|
||||
`shaders.properties`:
|
||||
|
||||
- `shadow*`: the world from the sun into `shadowtex0/1` and `shadowcolor0/1`.
|
||||
- `gbuffers_*`: every kind of geometry (`basic`, `textured`, `textured_lit`, `skybasic`, `skytextured`, `clouds`,
|
||||
`terrain` (+ `_solid`, `_cutout`), `damagedblock`, `block`, `beaconbeam`, `item`, `entities`,
|
||||
`entities_glowing`, `armor_glint`, `spidereyes`, `hand`, `weather`, `water`, `hand_water`, `line`), with a
|
||||
fallback chain (a missing `gbuffers_terrain` uses `gbuffers_textured_lit`, then `gbuffers_textured`, then
|
||||
`gbuffers_basic`). They write up to 16 colour targets (`colortex0..15`, older names `gcolor`, `gdepth`,
|
||||
`gnormal`, `composite`, `gaux1..4`).
|
||||
- `deferred*` (after opaque geometry), `composite*` (after translucent), `final` (to the screen), and the
|
||||
compute programs `prepare`, `begin`, `setup` (`.csh`), all full-screen.
|
||||
- In the source: `/* DRAWBUFFERS:024 */` or `/* RENDERTARGETS: 0,2,4 */`, `const int colortex0Format = RGBA16F;`,
|
||||
`const int shadowMapResolution = 2048;`, `const float sunPathRotation = -40.0;` and many more constants Iris reads.
|
||||
- `shaders.properties`: the option screens and profiles, `program.<name>.enabled`, blend modes, custom textures
|
||||
(`texture.composite.colortex4 = ...`), custom uniforms (`uniform.float.x = <expression>`), per-dimension folders
|
||||
(`world0`, `world-1`, `world1`); `block.properties`, `item.properties` and `entity.properties` map block, item
|
||||
and entity ids to the numbers the shaders see in `mc_Entity`.
|
||||
- Options are `#define`s in the source (`#define SHADOW_QUALITY 2 // [1 2 3]`, `//#define BLOOM`), found by
|
||||
scanning the files.
|
||||
|
||||
### Translation
|
||||
|
||||
1. **Preprocess like Iris.** Resolve `#include` (absolute from `shaders/`, or relative), apply the user's option
|
||||
values to the `#define` lines, and define what Iris defines (`MC_VERSION`, `IS_IRIS`, `MC_GL_VERSION`,
|
||||
`MC_GLSL_VERSION`, `MC_OS_*`, `MC_GL_VENDOR_*`, `MC_GL_RENDERER_*`, `MC_RENDER_QUALITY`,
|
||||
`MC_SHADOW_QUALITY`, `MC_HAND_DEPTH`, the `DH_*`/feature flags as unsupported).
|
||||
2. **Legalise to GLSL 450 core.** Packs are written for `#version 120`..`460 compatibility` and use the
|
||||
compatibility profile: `gl_FragData`/`gl_FragColor`, `varying`/`attribute`, `texture2D`/`shadow2D`/
|
||||
`texture2DLod`, `gl_Vertex`, `gl_MultiTexCoord*`, `gl_Color`, `gl_Normal`, `gl_ModelViewMatrix`, `ftransform()`,
|
||||
loose `uniform float x;`. Iris rewrites the same things for the core profile (glsl-transformer). The legaliser
|
||||
turns them into explicit `layout(location)` inputs and outputs, one uniform block per stage, and
|
||||
separate texture + sampler bindings, which naga's GLSL front end (`naga::front::glsl`, Vulkan-style GLSL 440+)
|
||||
accepts.
|
||||
3. **naga GLSL → IR → WGSL**, validated, cached per pack, options and Horizon version under the game folder (only
|
||||
the translation, never the pack's files).
|
||||
4. **Emulate the pipeline.** Allocate the colour targets with the formats the pack asks for, run the programs in
|
||||
Iris's order with its blend and clear rules, feed the uniforms Iris provides (about a hundred:
|
||||
`gbufferModelView`, `gbufferProjection`, their inverses and previous-frame versions, `shadowModelView`,
|
||||
`shadowProjection`, `cameraPosition`, `previousCameraPosition`, `sunPosition`, `moonPosition`,
|
||||
`shadowLightPosition`, `sunAngle`, `worldTime`, `worldDay`, `moonPhase`, `frameTimeCounter`, `frameCounter`,
|
||||
`viewWidth`, `viewHeight`, `aspectRatio`, `near`, `far`, `rainStrength`, `wetness`, `eyeBrightness(Smooth)`,
|
||||
`isEyeInWater`, `nightVision`, `blindness`, `darknessFactor`, `fogColor`, `skyColor`, `heldItemId`,
|
||||
`heldBlockLightValue`, `biome`, ...), and give `gbuffers_*` the vertex attributes they read (`mc_Entity`,
|
||||
`mc_midTexCoord`, `at_tangent`, `at_midBlock`, lightmap coordinates, normals).
|
||||
|
||||
### What comes first, what is hard
|
||||
|
||||
| Piece | Difficulty | Why |
|
||||
| --- | --- | --- |
|
||||
| Preprocessor, options, `shaders.properties` screens | easy | text; no GPU |
|
||||
| Legaliser + naga parse | medium | many legacy built-ins and implicit conversions; the spike measures it |
|
||||
| `composite*` / `final` / `deferred*` | medium | full-screen passes, like Horizon's `composite`; need the colour targets and uniforms |
|
||||
| Uniforms | medium | most exist on the CPU already; previous-frame matrices, `eyeBrightnessSmooth`, `wetness` need tracking |
|
||||
| `gbuffers_*` for terrain | hard | Horizon's packed terrain vertices and arena multi-draw must also feed Iris's attributes and up to 8 render targets; `block.properties` ids per block state |
|
||||
| `gbuffers_*` for entities, hand, weather, sky, clouds | hard | each is its own Horizon pipeline today; each needs an Iris-shaped twin |
|
||||
| `shadow` | hard | a second world pass from the sun with its own culling (Horizon culls from the camera) and the pack's distortion in its vertex shader |
|
||||
| Custom textures, `noisetex` | easy | image loads |
|
||||
| Custom uniforms (`uniform.*` expressions) | medium | a small expression evaluator per frame |
|
||||
| Compute (`.csh`), `image2D` load/store | medium | wgpu has compute; storage formats are more limited than OpenGL's |
|
||||
| Distant Horizons, Voxy hooks, `DH_*` | not planned | Horizon's native LOD terrain shares world colour/depth; it does not expose these mods' APIs |
|
||||
|
||||
Order: preprocessor and legaliser until the three test packs parse; then `composite`/`final`/`deferred` with the
|
||||
uniforms; then `gbuffers_terrain`, `gbuffers_water` and `gbuffers_skybasic`/`skytextured` (the packs' look comes
|
||||
from these); then entities, hand, weather, clouds; then `shadow`; then custom textures, compute. Custom uniforms
|
||||
are done (below).
|
||||
|
||||
The test set is Complementary Reimagined, BSL and Sildur's Vibrant. Their licences don't allow redistribution, so
|
||||
they are downloaded for development only, outside the repository (never committed, never shipped, never uploaded);
|
||||
players bring their own, as with Iris.
|
||||
|
||||
## Spike results
|
||||
|
||||
Run on 2026-10-15 with naga 30.0.1 over Complementary Reimagined r5.9.3, BSL v10.1.8 and Sildur's Vibrant v2.02
|
||||
Extreme (the 26.3 builds from Modrinth, kept outside the repository). Every program of the overworld, Nether and End
|
||||
folders and the shared root was counted; the `dh_*`, `clrwl_*` and `voxy*` programs, which Iris only loads with
|
||||
Distant Horizons, Colorwheel or Voxy installed, were left out.
|
||||
|
||||
| Pack | Programs | naga as is | Preprocessed + legalised: parse | validate | WGSL written |
|
||||
| --- | ---: | ---: | ---: | ---: | ---: |
|
||||
| Complementary Reimagined | 183 | 0 | 180 | 180 | 180 |
|
||||
| BSL | 173 | 0 | 170 | 165 | 165 |
|
||||
| Sildur's Vibrant | 114 | 0 | 114 | 105 | 105 |
|
||||
| **Total** | **470** | **0** | **464** | **450** | **450 (96%)** |
|
||||
|
||||
"As is" is naga's GLSL front end on the files with `#include` inlined and Iris's macros defined: it accepts only
|
||||
`#version 440`–`460` with Vulkan-style bindings, and every pack is written for `#version 120`–`330` compatibility
|
||||
profiles. "Preprocessed + legalised" is the translation of steps 1–3 above, done by a throwaway token-level tool:
|
||||
Iris's `#include`, its macros (`MC_VERSION`, `MC_RENDER_STAGE_*`, ...) and the packs' `#if`s expanded with naga's own
|
||||
preprocessor (`pp-rs`), then:
|
||||
|
||||
- `#version 450 core`; `attribute`/`varying` to `in`/`out` with locations, one per declarator;
|
||||
- loose uniforms into one `std140` block (`bool`s stored as `int`);
|
||||
- `sampler2D` & co. split into texture + sampler bindings, uses rebuilt as `sampler2D(t, s)`, also through function
|
||||
parameters, and not where a local of the same name hides the uniform;
|
||||
- compatibility built-ins (`gl_Vertex`, `gl_MultiTexCoord*`, `gl_Color`, `gl_ModelViewMatrix`, `gl_Fog`, `ftransform()`,
|
||||
`gl_FragColor`, `gl_FragData[n]`) and Iris's core-profile names (`vaPosition`, `modelViewMatrix`, ...) declared;
|
||||
`texture2D`, `shadow2D`, `texture2DLod`, ... renamed;
|
||||
- global variables with non-constant initialisers (accepted by NVIDIA and AMD drivers, used throughout
|
||||
Complementary) declared at global scope and assigned at the start of `main`; unsized global arrays sized from
|
||||
their initialiser;
|
||||
- `texture(shadowSampler, ..).x`: the float widened to `vec4` first (naga has no scalar swizzle);
|
||||
- `isnan`, `isinf` and `modf` replaced by helper functions (WGSL has no `isnan`/`isinf`).
|
||||
|
||||
What is left, by cause:
|
||||
|
||||
| Programs | Cause | Fix |
|
||||
| ---: | --- | --- |
|
||||
| 9 | Sildur's passes a `mat3` between stages (`tbnMatrix`); WGSL can't | split matrix varyings into columns |
|
||||
| 6 | `writeonly image2D` without a format (`shadowcomp.csh` in Complementary and BSL) | take the format from the pack's image declaration (`shaders.properties` / `const int` format) |
|
||||
| 5 | naga GLSL front-end bug: a call result inside a constructor (`vec3(TAAJitter(..), z)`) leaves an unvisited expression (BSL) | spill call results to temporaries; report to naga |
|
||||
|
||||
The translator in `crates/horizon-shaderpack` now passes all of them that the packs enable by default (464 of 464,
|
||||
the WGSL read back and validated): matrix varyings are split into columns; the five BSL failures were not a naga bug
|
||||
but dead code after a `discard;` (how BSL turns its clouds and weather off), which the legaliser drops; the six
|
||||
`shadowcomp.csh` are off by default (`program.*/shadowcomp.enabled` in `shaders.properties`) and use images and arrays
|
||||
that only exist with their options on, so they wait for `shaders.properties`.
|
||||
|
||||
With `shaders.properties` read (`program.*.enabled` evaluated like Iris, image formats taken from `image.*`), the
|
||||
programs the packs enable translate: 180 of 180 for Complementary, 114 of 114 for Sildur's and 154 of 154 for BSL with
|
||||
its profile (it turns `composite2`/`composite3` off). With their colored lighting on, BSL's `shadowcomp.csh` translates
|
||||
too, and so do all 183 of Complementary's on Linux once `IRIS_FEATURE_CUSTOM_IMAGES` is defined: without it, the pack
|
||||
declares no voxel images but its `shaders.properties` still turns `shadowcomp` on. Which `IRIS_FEATURE_*` Horizon
|
||||
defines is decided when the stage that backs them exists.
|
||||
|
||||
So the GLSL side is feasible: naga's front end plus a legaliser reaches 96% on the three packs, and every remaining
|
||||
failure has a mechanical fix. Valid WGSL isn't a working pack yet: the output still has to be bound to Horizon's
|
||||
pipeline (render targets, the uniforms' values, vertex attributes for `gbuffers_*`), which is the emulation work.
|
||||
The spike also showed what the real translator needs that a token rewriter does badly: scopes (a local named like a
|
||||
uniform), types (which `texture` call returns a float) and declarations split across `#if`s, so it should rewrite a
|
||||
GLSL syntax tree after preprocessing, not tokens.
|
||||
|
||||
### Running a Java pack's full-screen passes
|
||||
|
||||
A folder holding `shaders/`, or a `.zip`, in `shaderpacks/` shows in the Shader Packs screen next to Horizon packs.
|
||||
Picking one translates every planned pass of each dimension folder (`java_pack.rs`) and runs them each frame
|
||||
(`gfx/java_stages.rs`):
|
||||
|
||||
1. the targets the pack clears are cleared;
|
||||
2. `begin*` and `prepare*` run, then Horizon's world enters `colortex0` and `depthtex0..2` on the side the flips give;
|
||||
3. `deferred*` and `composite*` run in order, each reading the side its plan gives and writing the other;
|
||||
4. `final` draws into a target that replaces the world's picture, where Horizon packs' `composite` output goes: the
|
||||
hand, menus and HUD are drawn over it.
|
||||
|
||||
What makes Horizon look like OpenGL to the pack:
|
||||
|
||||
- **Layout.** The translator ends every vertex shader by flipping `gl_Position.y` and moving depth from `[-w, w]` to
|
||||
`[0, w]`, so the targets keep OpenGL's layout (row 0 at the bottom). The world is flipped going in, `final` coming out.
|
||||
- **Depth.** Horizon's depth is reversed (1 near, 0 sky); the world goes in as `1 - depth`, and the matrices the pack
|
||||
gets (`gbufferProjection` and its inverse, previous frame too) are OpenGL's, rebuilt from Horizon's.
|
||||
- **Formats.** Iris formats become renderable wgpu formats: 8-bit unorm ones and `RGB10_A2` stay, `*32F` stay (sampled
|
||||
unfiltered), integer formats become 32-bit, the rest (`R11F_G11F_B10F`, `*16F`, `*16`) 16-bit float, with the
|
||||
channel count of the name.
|
||||
- **Samplers.** Metal allows 16 samplers per stage and Complementary binds 23 textures, so textures share four
|
||||
samplers by kind (`iris_linear`, `iris_nearest` for depth and 32-bit or integer targets, `iris_repeat` for
|
||||
`noisetex`, `iris_compare` for shadow lookups) instead of one each.
|
||||
- **`isnan`/`isinf`** test the float's bits: Metal compiles with fast math, which folds `x != x` to false, and a NaN
|
||||
then stays forever in Complementary's TAA history (the picture turns black).
|
||||
- **Uniforms.** Matrices, camera, view size, time, weather, fog and sky colour, eye state come from the frame;
|
||||
`eyeBrightness` is the block and sky light (× 16) of the camera entity's eye block, and `eyeBrightnessSmooth` follows
|
||||
it with the pack's `eyeBrightnessHalflife` (Iris's `SmoothedFloat`); `sunPosition`, `moonPosition`,
|
||||
`shadowLightPosition`, `sunAngle` and `shadowAngle` are `CelestialUniforms`' (the sky's `sun_angle` and `moon_angle`
|
||||
turned by Y -90, the pack's `sunPathRotation` about Z, then the angle about X); `noisetex` is a fixed 256² noise.
|
||||
- **Custom uniforms.** `uniform.<type>.<name>` and `variable.<type>.<name>` in `shaders.properties` are evaluated
|
||||
each frame (`horizon-shaderpack`'s `uniforms.rs`: Iris's operators and priorities, its functions, `smooth` with
|
||||
`SmoothFloat`'s half-lives). A definition naming something Horizon doesn't provide (`biome`, `blindness`...) is left
|
||||
out with everything that uses it, as Iris leaves out the ones it can't resolve: the uniform stays 0.
|
||||
- **The vanilla sky.** While the pack runs, `sunPathRotation` tilts Horizon's sun, moon and stars as Iris tilts
|
||||
vanilla's, `clouds = off | fast | fancy` replaces the cloud option, and `sun = false` / `moon = false` hide those.
|
||||
Complementary and Sildur's turn the vanilla clouds off: drawn anyway, they wrote depth the packs' light shafts and
|
||||
fog took for terrain.
|
||||
|
||||
Measured on the Mac mini (M4 Pro) with the packs' default options: BSL v10.1.8 and Complementary Reimagined r5.9.3
|
||||
grade and light Horizon's world as their post-processing would. Sildur's Vibrant v2.02 draws only its sky: its
|
||||
`deferred` reads the albedo `gbuffers_*` write to `colortex4`. Without `gbuffers_*` and `shadow`, no pack has its
|
||||
shadows, water or sky look yet; Distant Horizons' and Voxy's depth read as far. Horizon's world goes into the target
|
||||
the pack's `gbuffers_terrain` (or the program Iris falls back to) draws to first: `colortex0` for most packs,
|
||||
`colortex1` for MakeUp. Not supported yet: images and compute (`.csh`; a pack that needs them doesn't load),
|
||||
mipmapped targets (`colortexNMipmapEnabled` is read but ignored), `.dat` and resource-location custom textures (PNG
|
||||
files in the pack only); shadow matrices are identity.
|
||||
|
||||
### Compatibility
|
||||
|
||||
Tested on 2026-10-22 on the Mac mini (M4 Pro, Metal) with each pack's default options, the 26.3 builds from Modrinth or
|
||||
the authors' pages (dev-only test inputs, kept outside the repository). "Loads" means every pass the pack enables for
|
||||
the overworld, Nether and End is preprocessed, translated and validated, as the game does when the pack is picked
|
||||
(`java_pack::tests::real_packs_load` with `HORIZON_TEST_SHADERPACKS`); "drawn" means it was also picked in the game
|
||||
and screenshotted. Only full-screen passes run (above), so no pack has its own terrain, water, shadows or sky yet.
|
||||
The MakeUp, Chocapic13' and Photon rows are from 2026-10-23, on Metal and on Vulkan (RTX 4080).
|
||||
|
||||
| Pack | Version | Result | First thing that stops it |
|
||||
| --- | --- | --- | --- |
|
||||
| BSL | v10.1.8 | drawn: 26 passes | |
|
||||
| Complementary Reimagined | r5.9.3 | drawn: 27 passes | |
|
||||
| Complementary Unbound | r5.8 | loads: 27 passes | |
|
||||
| Sildur's Vibrant Extreme | 2.02 | drawn: 18 passes, only its sky (above) | |
|
||||
| Steadfast | 0.8.0 | drawn: 3 passes | |
|
||||
| MakeUp Ultra Fast | 9.6 | drawn: 6 passes, its fog, light shafts and grade over Horizon's world | |
|
||||
| Chocapic13' | V9 High | drawn: 16 passes; its default TAA upscaling shrinks the world in its `gbuffers_*` vertex programs, which don't run, so the picture is magnified 1/0.7: turn TAA Upscaling off in its settings | |
|
||||
| Bliss | 2.1.2 | fails | `world0/deferred.vsh`: an operation naga forbids in a vertex shader |
|
||||
| Bloop | 1.8.0-Alpha-3 | fails | `world0/prepare1.fsh`: `mat2(vec4)` and other constructors naga's GLSL front end refuses |
|
||||
| Noble | v1.9.9 | fails (Apple and NVIDIA) | `world0/deferred4.vsh`: a `vec3[9][9]` varying (nested arrays between stages) |
|
||||
| Photon | v1.4 | fails | `world0/deferred1.fsh`: `textureGather` |
|
||||
| Rethinking Voxels | r0.1-beta9 | fails | `world0/prepare.fsh`: `1 << 31` overflows naga's constant folding; it also needs images |
|
||||
|
||||
What the translator does for these packs, as Iris (JCPP and its GLSL transformer) does:
|
||||
|
||||
- **`#if` reads floats as JCPP does**: a float in a condition, written there or through a macro, counts as its
|
||||
integer part, and an empty operand as 0. The same holds in `shaders.properties`, where Steadfast's
|
||||
`#elif ATMOSPHERE_FOG_STRENGTH_NOON == 0.5` stopped the pack (`UnexpectedToken(Float(0.5))`).
|
||||
- **A later `#define` replaces an earlier one** instead of failing (Bloop's `DefineRedefined`), and an unterminated
|
||||
`#if` runs to the end of the file.
|
||||
- **`shaders.properties`** keeps its empty lines and backslashes through the preprocessor, as Iris's does, so a
|
||||
continued line doesn't swallow the next one.
|
||||
- **16-bit and 8-bit types** (`float16_t`, `u16vec2`, `packFloat2x16`...), which Noble uses when the GPU reports
|
||||
NVIDIA (`NV_gpu_shader5`), become their 32-bit types: WGSL has none.
|
||||
- **What naga refuses**: `%` with a scalar and a vector operand goes through overloads, a `const` naga can't fold
|
||||
(`mix`, `?:`, `smoothstep`) becomes a global set at the start of `main`, `sqrt` of a negative constant is
|
||||
evaluated at run time, and a fragment output narrower than four channels (`out vec3`, Steadfast's `final`) is
|
||||
written through a `vec4` with alpha 1 as OpenGL fills it.
|
||||
|
||||
### Order to implement
|
||||
|
||||
1. **Translator crate** (`horizon-shaderpack`): the preprocessor (includes, option `#define`s with the player's
|
||||
values, Iris macros) and a syntax-tree legaliser covering every rewrite above plus the three fixes in the table;
|
||||
a test running it over the user's own copies of the three packs when they're present (never committed), and
|
||||
small hand-written GLSL fixtures in the repo.
|
||||
2. **`shaders.properties`** and option screens: the option list, sliders, profiles, `program.*.enabled`, blend modes.
|
||||
3. **Full-screen programs**: `deferred*`, `composite*`, `final` with `colortex0..15` (formats from the pack),
|
||||
`depthtex0..2`, `noisetex` and the uniforms (most are already computed for the world shaders). This alone runs
|
||||
Sildur's and BSL post-processing over Horizon's own world.
|
||||
4. **`gbuffers_terrain`, `gbuffers_water`, `gbuffers_sky*`**: Horizon's terrain vertices extended with Iris's
|
||||
attributes (`mc_Entity` from `block.properties`, `mc_midTexCoord`, `at_tangent`, lightmap), a second set of
|
||||
terrain pipelines writing the pack's render targets.
|
||||
5. **Entities, block entities, hand, weather, clouds, particles** `gbuffers_*`.
|
||||
6. **Shadow pass**: terrain and entities from the sun into `shadowtex0/1` and `shadowcolor0/1`, culled from the
|
||||
light's view, with the pack's distortion.
|
||||
7. **The rest**: custom textures, compute programs and images, per-dimension
|
||||
folders, `entity.properties`/`item.properties`.
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
# Horizon shader packs
|
||||
|
||||
Horizon has its own shader packs: WGSL written against stages of Horizon's renderer, checked before they run. This page
|
||||
is the guide for pack authors. The design and the pack format are in [api/shaders.md](api/shaders.md); every stage's
|
||||
signature, input, resource and limit is in the generated [api/shaders-reference.md](api/shaders-reference.md).
|
||||
|
||||
Shader packs in the Iris/OptiFine format are a separate feature with its own loader; this page is only about
|
||||
Horizon's own format.
|
||||
|
||||
| Part | Where | State |
|
||||
|---|---|---|
|
||||
| Format, stages, check | `crates/horizon-shader-api` | API 0.1, experimental |
|
||||
| Authoring tool | `horizon-shader` (same crate) | `new`, `check`, `pack` |
|
||||
| Templates | `crates/horizon-shader-api/templates/` | post, sky, material |
|
||||
| Example pack | `crates/horizon-shader-api/packs/golden_hour` | a warm sky and two post passes |
|
||||
| In the game, the launcher, the registry | | not yet: the renderer hooks come next |
|
||||
|
||||
## Quick start
|
||||
|
||||
```sh
|
||||
cargo install --path crates/horizon-shader-api # or: cargo run -p horizon-shader-api --bin horizon-shader -- <command>
|
||||
horizon-shader new my_pack --template post # also: --template sky, --template material; --name "My Pack"
|
||||
horizon-shader check my_pack # what the game, the launcher and the registry will check
|
||||
horizon-shader pack my_pack # check, then write my_pack-0.1.0.hshader beside the folder
|
||||
```
|
||||
|
||||
`check` prints each stage with its cost, and the pack's SHA-256:
|
||||
|
||||
```
|
||||
golden_hour 1.0.0 (shader API 0.1): ok
|
||||
sky Warm horizon 99 expressions, 0 texture reads
|
||||
post Glow 185 expressions, 3 texture reads
|
||||
post Colour grade 201 expressions, 2 texture reads
|
||||
sha256 fd92a294...
|
||||
```
|
||||
|
||||
or every problem, at its file, line and column:
|
||||
|
||||
```
|
||||
my_pack 0.1.0 (shader API 0.1): FAILED
|
||||
post.wgsl:9:1: expected `;`, found "}"
|
||||
```
|
||||
|
||||
`--json` prints the same for tools (`ok`, `id`, `version`, `api`, `sha256`, `stages`, `problems`).
|
||||
|
||||
## A pack
|
||||
|
||||
A folder (or the same files zipped as a `.hshader`) with `horizon-shaders.toml` and WGSL files:
|
||||
|
||||
```toml
|
||||
schema = 1
|
||||
id = "my_pack"
|
||||
name = "My Pack"
|
||||
version = "0.1.0"
|
||||
api = "0.1"
|
||||
|
||||
[[post]]
|
||||
file = "post.wgsl"
|
||||
|
||||
[[options]]
|
||||
id = "saturation"
|
||||
name = "Saturation"
|
||||
type = "float"
|
||||
default = 1.15
|
||||
min = 0.0
|
||||
max = 2.0
|
||||
```
|
||||
|
||||
Every key is in [api/shaders.md](api/shaders.md#the-pack-format-schema-1).
|
||||
|
||||
## Stages
|
||||
|
||||
A stage is one function your file defines. Horizon puts its prelude (the structs, `frame`, the stage's resources and
|
||||
helpers) before your file and calls the function from its own pass, so the world is still culled, batched and meshed
|
||||
by Horizon: a pack changes how things look, not how they are drawn.
|
||||
|
||||
| Stage | Your function | What it does |
|
||||
| --- | --- | --- |
|
||||
| `[sky]` | `fn sky(input: SkyInput) -> vec4<f32>` | the sky's colour along each view ray; the sun, moon, stars and clouds are drawn over it |
|
||||
| `[material]` | `fn material(input: MaterialInput) -> Surface` | the lit colour of each point of a block's surface, before the alpha test and fog |
|
||||
| `[[post]]` | `fn post(input: PostInput) -> vec4<f32>` | a full-screen pass over the world's picture (up to 8, in order), under the hand and HUD |
|
||||
|
||||
A pack has at least one stage; a stage it leaves out keeps vanilla's look. Each input says what vanilla would draw
|
||||
(`input.color` in the sky and post stages; `albedo * tint * vec4(lightmap, 1.0)` for a material), so a pack can start
|
||||
from vanilla and change only what it means to.
|
||||
|
||||
Every stage can read `frame`: the camera's matrices and position, the sun and moon directions, the time of day,
|
||||
vanilla's sky and fog colours, rain and thunder, fog distances, the light at the camera, effects and the dimension.
|
||||
Post passes also read `scene_color`, `scene_depth`, `previous` (the last pass's output), two samplers and the helpers
|
||||
`depth_at(uv)` and `view_position(uv, depth)`.
|
||||
|
||||
Rules the check enforces: your files declare no bindings (`@group`/`@binding`), no entry points and no names starting
|
||||
with `horizon_`. Code shared by several stages goes in files listed in `shared`, put before every stage.
|
||||
|
||||
## Options
|
||||
|
||||
Each `[[options]]` entry is a WGSL `override` of the same name, set when the game builds the pipeline: no text
|
||||
substitution, no recompiling a different program per value.
|
||||
|
||||
```wgsl
|
||||
override saturation: f32 = 1.15; // type = "float"; bool → bool, int → i32, choice → u32 (the value's index)
|
||||
```
|
||||
|
||||
The game shows the options on the pack's settings screen. Branches on an option are on a constant, so the GPU
|
||||
skips the side that isn't taken.
|
||||
|
||||
## What the check does
|
||||
|
||||
The game runs the same check when it loads a pack (a pack that fails is refused with the message, and the last good
|
||||
one keeps drawing), the launcher before it installs one, and the registry's CI before a pack is listed:
|
||||
|
||||
1. The manifest and the package: known keys, valid ids, every file used, sizes.
|
||||
2. Each stage built as the renderer builds it and validated by naga.
|
||||
3. The stage function's signature, and the rules above.
|
||||
4. Each `override` matches its option's type (or has a default); each option is used.
|
||||
5. Budgets: 20 000 expressions and 64 texture reads per stage.
|
||||
6. Every entry point translated for Vulkan (SPIR-V), Metal and DirectX 12 (HLSL), with the options at their
|
||||
defaults, minimums and maximums.
|
||||
|
||||
`[budget] gpu_ms` is the GPU time your pack aims to add to a frame; the game's overlay will show each pass's time
|
||||
against it.
|
||||
|
||||
## Next
|
||||
|
||||
The renderer hooks (shared with the Iris/OptiFine loader), then the post stage in the game with hot reload and the
|
||||
GPU time per pass, Options > Shader packs listing these packs, then the material and sky stages, and the registry's
|
||||
`shader` kind with installs from the launcher.
|
||||
@@ -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.
|
||||
+8
-8
@@ -22,10 +22,10 @@ game and the launcher of the 0.2 line.
|
||||
0.2. A `feature` label no longer bumps anything: it only lists the change under **New**.
|
||||
- **Patch releases** are every release the train makes: the patch after the newest release tagged on the line, game
|
||||
and launcher counted separately (the game releases more often, so `v0.2.14` can go with `launcher@0.2.3`).
|
||||
- **Alpha builds** are not separate tags. As before, every game release is published as a GitHub pre-release (an alpha build, what
|
||||
the launcher's Alpha channel installs) under its final tag and promoted in place to stable in the daily
|
||||
promotion at 20:00 UTC, once it has been out 6 hours ([Channels](release-flow.md#channels)). `v0.2.4` is the same
|
||||
build whether it is still a beta or already stable.
|
||||
- **One channel** (since 2026-10-23): every game release is published under its final tag as the release and
|
||||
GitHub's latest, once its smoke test passed and no `release-blocker` is open
|
||||
([One channel](release-flow.md#one-channel)). The game pre-releases from before (v0.2.1 on, the old Alpha
|
||||
channel) keep their tags and stay pre-releases.
|
||||
- **Pre-release tags** (`v0.3.0-rc.1`, `v0.3.0-beta.2`) are semver's and are reserved for a hand-made preview of a
|
||||
new line; the train never makes them. Every reader orders them before their release and after the release
|
||||
before (`v0.2.9` < `v0.3.0-beta.1` < `v0.3.0-rc.1` < `v0.3.0`).
|
||||
@@ -43,7 +43,7 @@ Every 0.2 tag is newer than every tag from before 0.2. Within each:
|
||||
A tag is a 0.2 tag when it is `v` or `launcher@` followed by exactly three numbers (and an optional `-PRE`) with a
|
||||
major below 1000; a date's first number is a year, so `v2026.10.21` never is. The rule is written once per
|
||||
language, with the same tests: `crates/horizon-server/src/update.rs` (`newer`), `launcher/src/backend.rs`
|
||||
(`release_order`), `tools/release_train.py` (`tag_key`, also used by `tools/release_channels.py`) and
|
||||
(`release_order`), `tools/release_train.py` (`tag_key`) and
|
||||
`website/src/versions.js`.
|
||||
|
||||
## The workflows
|
||||
@@ -55,9 +55,6 @@ language, with the same tests: `crates/horizon-server/src/update.rs` (`newer`),
|
||||
- **`launcher.yml`**: `decide --kind launcher` picks `launcher@0.2.N`; the build gets `HORIZON_LAUNCHER_VERSION`
|
||||
(`0.2.N`) and `HORIZON_LAUNCHER_TAG` (`launcher@0.2.N`). The tag tells the launcher which line it is on: a release
|
||||
built with only the version (every launcher before 0.2) is a `launcher-v` one.
|
||||
- **`promote.yml`**: `tools/release_channels.py` promotes the newest due beta, never one older than the stable
|
||||
release; with the shared order, `v0.2.0` follows the last dated stable release and no dated beta can follow
|
||||
`v0.2.0`.
|
||||
- **Notes**: a line's first release (`X.Y.0`) opens with a paragraph saying so; `v0.2.0`'s and `launcher@0.2.0`'s say
|
||||
that releases are numbered from now on, and tell server owners to run `horizon-server update` (or, if their server
|
||||
says it is up to date, `horizon-server update --version v0.2.0`).
|
||||
@@ -98,6 +95,9 @@ the fleet's `release-kick` and the orchestrator's heartbeat prompts.
|
||||
|
||||
## The day Ludovic says go
|
||||
|
||||
Done on 2026-10-22; kept as the record of how 0.2 went out. `promote.yml` and `tools/release_channels.py`, which
|
||||
it uses, are gone since the single channel (2026-10-23, [One channel](release-flow.md#one-channel)).
|
||||
|
||||
Run by the orchestrator, in this order. Until step 3, nothing is published.
|
||||
|
||||
1. Merge, in order: this page, the `horizon-server update` order, the launcher order, the release line (train,
|
||||
|
||||
@@ -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 and omits Iris.
|
||||
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 Iris or 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.
|
||||
@@ -195,7 +195,7 @@ above remains a record of its narrower tested source snapshot.
|
||||
|
||||
`tools/test_chunk_generation_parity.py` generates chunks in actual vanilla classes (`VanillaChunkGenerationOracle`: structure starts and
|
||||
references, biomes, noise, surface, carvers, then biome decoration and structure pieces through real `WorldGenRegion`s) and with
|
||||
`crates/horizon-world/examples/chunk_dump.rs`, and compares every block state, quart biome and block entity (canonical NBT) of each target
|
||||
`crates/horizon-world/examples/probe/chunk_dump.rs`, and compares every block state, quart biome and block entity (canonical NBT) of each target
|
||||
chunk, and the scheduled block and fluid ticks each proto chunk carries into the live world. Cases are terrain sites for several seeds
|
||||
across the overworld, Nether and End, plus rectangles around every structure kind found by scanning the seed. `--phase structures`
|
||||
isolates terrain plus structure pieces, `--phase terrain` stops before features. `HORIZON_ORDER` (a file of `x z` lines) makes both sides
|
||||
|
||||
Reference in New Issue
Block a user