Commit Graph

1482 Commits

Author SHA1 Message Date
Ludovic Marie 30d11d6a2e Integrated server: single-player pause menu labels
On its server thread a single-player world is joined like a server, so
the Horizon pause menu named it "Multiplayer" with a "Disconnect" button,
and F3+Escape opened the full menu as on a server. The server thread now
hands the window the world's name with its connection, the pause menu
shows that name and "Save and quit", and `has_singleplayer_server`
(Minecraft.hasSingleplayerServer) covers both ways of running a world for
the pause checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:12:08 +02:00
Ludovic Marie bd0dd979a0 Integrated server: build only the font, not the whole HUD atlas
The integrated server draws nothing, but it built the window's full HUD
atlas (GUI, item, block, entity and particle textures plus the run-time
slots). It now builds an atlas of the font sheets only, reads the glyph
widths from it and drops the pixels: text still measures the same (books
split their pages with it), without holding the textures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:12:08 +02:00
Ludovic Marie 19aac92bb7 Merge pull request #545 from ludovic111/perf/integrated-memory-connection
Integrated server: join through memory instead of a socket
2026-10-17 00:11:50 +02:00
Ludovic Marie 44c3ebb0d8 Merge pull request #544 from ludovic111/perf/integrated-server-thread
Run single player on an integrated server thread (opt-in)
2026-10-17 00:11:47 +02:00
Ludovic Marie 4e9495175c Merge pull request #538 from ludovic111/perf/game-constructor
Build the game in Game::new instead of inside run()
2026-10-17 00:11:42 +02:00
Ludovic Marie 9726af184b Merge pull request #537 from ludovic111/perf/resources-shared-split
Split Resources into shared read-only data and per-game pack state
2026-10-17 00:11:38 +02:00
Ludovic Marie 5dac64f770 Merge pull request #561 from ludovic111/perf/section-culling-columns
Renderer: cull sections by chunk column from a dense list (section walk 5x faster, exact)
2026-10-16 23:04:53 +02:00
Ludovic Marie 89740d39e0 Merge pull request #560 from ludovic111/perf/skip-indirect-validation
Renderer: skip wgpu's indirect-draw validation in release builds (−0.05..0.11 ms/frame of render thread at RD 32)
2026-10-16 23:04:01 +02:00
Ludovic Marie 167339c03c Renderer: cull sections by chunk column, from a dense list
The per-frame section walk iterated a SipHash map of every resident
section, then looked each visible one up twice more by key. Resident
sections now live in a dense list grouped by chunk column: one distance
and frustum test rejects a whole column (exact: a section's box lies in
its column's box and the plane test rounds monotonically), the rest are
reached by slot, and the visible list sorts on integer keys with ties
broken by section key, so the order no longer depends on hash order.
FaceGroups looks its axes up in a table instead of searching for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 22:54:17 +02:00
Ludovic Marie 9b2825df34 Merge pull request #517 from Online5277/fix/world-list-text-details
Correct Classic world-list search hints and text placement
2026-10-16 22:32:01 +02:00
Ludovic Marie 7a27781ab5 Merge pull request #512 from Online5277/fix/classic-graphics-duplicates
Remove duplicated settings from Classic graphics submenus
2026-10-16 22:31:55 +02:00
Ludovic Marie af15fb1a98 Merge pull request #511 from Online5277/fix/cloud-face-alpha
Preserve cloud opacity when shading faces
2026-10-16 22:31:49 +02:00
Ludovic Marie 4ff55f7a99 Merge pull request #510 from Online5277/fix/fullscreen-all-screens
Handle fullscreen shortcut across menus and text fields
2026-10-16 22:31:42 +02:00
Ludovic Marie 36b3fef0ed Merge pull request #533 from ludovic111/feat/port-pack-carry
horizon-port-pack carry: a jar's data and assets as a content mod
2026-10-16 22:13:21 +02:00
Ludovic Marie e21919c114 Merge pull request #532 from ludovic111/feat/port-pack
horizon-port-pack: import a modpack and classify its mods
2026-10-16 22:13:13 +02:00
Ludovic Marie cff7a66881 Merge pull request #531 from ludovic111/feat/mod-content-game
Content mods in the game: loot, recipes, models, names and icons from mod namespaces
2026-10-16 22:13:05 +02:00
Ludovic Marie 0c532fc1b0 Merge pull request #530 from ludovic111/feat/mod-content-root
Content mods in the resource root: template rows appended to every block table
2026-10-16 22:12:57 +02:00
Ludovic Marie cbb8c6a239 Merge pull request #523 from ludovic111/feat/mod-content
Content mods (API 0.2): .hmod assets/ and data/, blocks and items from vanilla templates
2026-10-16 22:12:48 +02:00
Ludovic Marie db45b6f87a Integrated server: join through memory instead of a socket
The window now joins its server thread through an in-memory pipe, as
vanilla's integrated server player does (LocalChannel), rather than a TCP
socket on 127.0.0.1. The server opens no port until it is opened to the LAN.

- horizon-protocol: Connection runs over TCP or one end of a Pipe (a
  blocking byte pipe with read timeouts and shutdown; dropping an end
  closes it).
- Lan: NetConfig.listen false starts no listener; connect_local serves the
  other end of a pipe on its own thread, through the same handshake, login
  and configuration as a socket.
- Session::connect_local joins through a pipe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 22:06:13 +02:00
Ludovic Marie 56dc4352d2 Run single player on an integrated server thread (opt-in)
With --server-thread or HORIZON_SERVER_THREAD=1, opening a single-player
world starts a game of its own on a "Server thread" over the shared
resources, as vanilla's IntegratedServer does, and the window joins it as a
player over a local connection. The world tick then never runs inside a
frame.

- The server listens on 127.0.0.1 only, lets in the window's profile alone,
  without compression, and makes it an operator when the world allows
  commands.
- The window's player is the world's own player: it loads from and saves to
  players/data/<singleplayer_uuid>.dat, so the world opens the same way in
  either mode.
- A pause screen pauses the server (IntegratedServer.tickServer), and
  leaving the world or quitting waits for the server to save.
- The integrated server does not mesh sections it never draws.
- Worlds whose player is outside the Overworld open the usual way for now.
- The bench summary reports the 0.1% low.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 22:06:12 +02:00
Ludovic Marie c2f4ecc188 Build the game in Game::new instead of inside run()
run() loads the shared resources and the pack, then hands them to a
constructor that builds a game with no world open. The same constructor will
build an integrated server's game on its own thread. The struct literal moves
unchanged; Options derives Clone so a server can start from the client's.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 22:06:12 +02:00
Ludovic Marie c57c409f40 Split Resources into shared read-only data and per-game pack state
Resources now holds only what is loaded once and never changes (blocks,
items, recipes, biomes, mobs, collision, motion) and is Send + Sync behind
an Arc, so an integrated server thread can share it with the client.

What a resource pack reload replaces moves to PackResources (assets,
meshing context, item renderer, names, panorama, clouds, forcefield), built
by one loader used at startup and on reload. The client-only mutable state
(the HUD atlas with its font cache and skin slots, fog state, screen effects)
becomes the game's own fields.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 22:06:12 +02:00
Ludovic Marie a08add231a Merge pull request #521 from Online5277/fix/villager-hat-metadata
Honor villager and zombie villager hat metadata
2026-10-16 21:33:06 +02:00
Ludovic Marie c7ee8baa25 Merge pull request #522 from Online5277/fix/classic-option-tooltips
Show translated hover tooltips in Classic options
2026-10-16 21:32:59 +02:00
Ludovic Marie 47182eccbf Merge pull request #546 from Online5277/fix/chest-slot-nine
Show the tenth storage slot in chests
2026-10-16 21:32:52 +02:00
Ludovic Marie 05d1b92d56 Renderer: skip wgpu's indirect-draw validation in release builds
wgpu validates every indirect draw with a compute pass and a per-draw
batcher before the render pass, for untrusted WebGPU content. The section
draws are the only indirect draws and are in bounds by construction; the
validation cost about 0.1 ms of the render thread per frame at render
distance 32 on Metal. Debug builds keep it, and
WGPU_VALIDATION_INDIRECT_CALL=1 turns it back on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:04:17 +02:00
Ludovic Marie cce44ad97d Merge pull request #514 from ludovic111/perf/stronghold-rings-on-all-workers
Stronghold ring searches run on every worker that needs them
2026-10-16 20:44:18 +02:00
Ludovic Marie 24bb3f97aa Stronghold ring test: rustfmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:35:59 +02:00
Cosmic bfb6a0458d Restrict crafter result rendering to crafter menus 2026-10-16 14:33:44 -04:00
Ludovic Marie b4ad65386c Merge pull request #507 from ludovic111/perf/collision-scan-empty
Collision scans: skip blocks with no shape, build the entity shape lazily (−6 % tick time)
2026-10-16 20:01:11 +02:00
Ludovic Marie 9d75d839aa Merge pull request #524 from ludovic111/perf/datapack-walk
Data packs: walk only the folders functions, tags and predicates live in
2026-10-16 20:00:55 +02:00
Ludovic Marie 38640fc845 Merge pull request #509 from ludovic111/perf/poi-state-table
Villagers: each block state's POI type from a table built once (−11 % CPU at world load)
2026-10-16 20:00:49 +02:00
Ludovic Marie 586acadd81 Merge pull request #508 from ludovic111/perf/mob-push-grid
Mobs: find the mobs to push through a grid, not a scan of every mob (−14 % tick time)
2026-10-16 20:00:42 +02:00
Ludovic Marie 72ec93a089 Merge pull request #506 from ludovic111/perf/supporting-block-cells
Mobs: shape only the cells that can support them (−11 % tick time)
2026-10-16 20:00:36 +02:00
Ludovic Marie 020e01746f Merge pull request #516 from ludovic111/perf/streaming-bench
streaming_bench: the chunk pipeline on its worker pool, without a window
2026-10-16 19:32:58 +02:00
Ludovic Marie be6a9d2cb5 Stronghold ring test: wrap the seed + 1 for i64::MAX
The threaded test added seed + 1 for seed = i64::MAX, which overflows in debug
builds (CI's verify).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:32:45 +02:00
Ludovic Marie 6754c52e82 Merge pull request #520 from ludovic111/perf/frame-uploads
Per-frame uploads through the staging belt; skip unchanged lightmaps
2026-10-16 19:27:32 +02:00
Ludovic Marie 673ac84724 horizon-port-pack carry: a jar's data and assets as a content mod
carry <work> [<mod id>...] turns each content mod with a jar into a folder
content mod (API 0.2) in <work>/mods/<id>/carry/, for local use:

- assets/<id>/, data/<id>/ and data/minecraft/tags/ are copied; other
  namespaces and vanilla data go to outside/ for review; no class file is
  copied.
- Vanilla-type recipes get 26.3 ingredients ("id", "#tag", lists);
  custom types and NeoForge conditions are kept and listed.
- Item models get the items/ client definitions 1.21.4 introduced.
- Each block is declared from a vanilla template guessed from its
  blockstate properties; unknown property sets are listed. Items
  without a block are declared from minecraft:stick.

The test builds a small NeoForge jar, carries it over, and reads the
result with horizon-mods' own Content reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:25:28 +02:00
Ludovic Marie 85858610bf horizon-port-pack: import a modpack and classify its mods
A CLI for the first steps of docs/modpacks.md's pipeline:

- import: a Modrinth .mrpack, a CurseForge zip or a Prism / MultiMC
  instance (or a folder of jars) to pack.json: Minecraft and loader
  versions, each file with its hash and sides, and the overrides.
- inventory: Modrinth metadata by SHA-1 (cached in modrinth.json, so
  reruns work offline), and the jars when the user's instance has them
  (neoforge.mods.toml / mods.toml / fabric.mod.json and a file census,
  without decompiling). Each mod gets a class and API tier from the
  reviewed ATM10 table, then rules on categories, sides and the census,
  and a dependency layer. Writes inventory.json and inventory.csv.

Only metadata is downloaded; jars are never fetched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:25:04 +02:00
Ludovic Marie ac7b7f98c0 Content mods in the game: loot, recipes, models, names and icons from mod namespaces
The game builds the content root from the enabled content mods at startup.
Loaders that only read the minecraft namespace now also read the content
mods' namespaces (from the root's marker file): block loot tables, recipes,
blockstates, language files, and the HUD atlas's item sprites. /give and the
command registries know the new items and blocks. A block without a
blockstate of its own takes its template's, so every state has a model.

Adds examples/ruby-content, a folder content mod: a ruby block and a ruby
item with recipes, loot, tags, models, textures and names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:23:35 +02:00
Ludovic Marie 002cfcd859 Content mods in the resource root: template rows appended to every block table
horizon_client::mod_content builds the resource root for content mods as
an overlay over the base root (vanilla, or the resource-pack overlay):
- the base is linked;
- the block and item tables are rewritten, each mod block getting its
  template's rows appended. That covers 13 JSON tables (facts, gameplay,
  behaviours, models, render, landing, items, command registries, mob
  data, worldgen flags, structure, survival) and 6 NBT ones (occlusion,
  collision, support, movement, worldgen block properties). Names,
  translation keys and in-table state ids move over, and the declared
  overrides apply;
- each mod's own assets/ and data/ are copied in;
- tag additions are merged into the tag files and both block-tag bundles.

Vanilla state ids never move: mod states come after them, mods and blocks
in id order. Rewritten JSON keeps its key order. With no content mod the
root is the base itself. The game doesn't call this yet.

Tested over the real prepared resources: every loader reads the overlay
(Assets, BlockFacts, Items, collision, visibility, light, motion, worldgen
GeneratorData). The mod blocks carry their templates' facts with the
overrides applied, and vanilla's rows and ids are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:23:35 +02:00
Ludovic Marie 746c888cd3 horizon-mods: content mods (API 0.2), blocks and items declared from vanilla templates
A .hmod may carry assets/ and data/ beside mod.wasm, or instead of it. The
manifest needs api = "0.2" and the new registries capability ("add blocks
and items to your worlds"). Content mods have no WIT interface: code still
links API 0.1.

horizon_mods::content::Content reads a mod's content and checks it:
- plain resource paths only;
- 65,536 files, 16 MiB each, 512 MiB in all;
- files in the mod's own namespace, plus additions to vanilla tags;
- blocks and items declared in data/<id>/horizon/{block,item}/*.json, each
  copying a vanilla template with typed overrides (hardness, resistance,
  light, tool, friction, map colour, sounds; stack size, rarity), unknown
  keys refused.

Mods::load refuses an enabled mod whose content fails these checks, with
the reason on its row. A content-only mod is on with no engine and no hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:23:35 +02:00
Cosmic 4c3b2b789f Draw translated hover tooltips for Classic options 2026-10-16 12:20:41 -04:00
Ludovic Marie 0981e0abcf Data packs: walk only the folders functions, tags and predicates live in
Loading a world read every file name under a folder pack's data/ to find
functions, function tags, predicates and item modifiers. The built-in pack
holds about 9,900 other data files, so this walk took 190-340 ms on the
render thread at every world load. A folder pack now walks
data/<namespace>/<kind>/ for those four kinds only, in the same order as
before; zip packs keep filtering their index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:19:46 +02:00
Ludovic Marie 0cdcbd17ba Merge pull request #502 from ludovic111/fix/animated-texture-tick-spikes
Animated textures: cache every animation frame's mip chain
2026-10-16 18:16:10 +02:00
Cosmic c47dc83eab Honor villager texture hat metadata in type layers 2026-10-16 12:16:05 -04:00
Cosmic 5bc981e577 Match world-list search hints and detail placement 2026-10-16 12:07:39 -04:00
Ludovic Marie 69b3eb1864 streaming_bench: the chunk pipeline on its worker pool, without a window
Fills an area with N workers, optionally flies the centre along +x, and
reports wall time, chunks generated, sections meshed, how often a column
near the player is still unlit, and what Streaming::update costs the
calling thread. Allocations can be counted with
HORIZON_BENCH_COUNT_ALLOCATIONS=1 at build time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:53:49 +02:00
Ludovic Marie ece9ab2b79 Release smoke run: count frames drawn in the world
The macOS release build has failed since 05:54 UTC on 2026-10-16: on the
self-hosted Mac mini runner the game drew its 1500 frames in about 2.5 s,
before the world had started generating (chunks 0, player null), so no
release has been published since v2026.10.16.03.

--world-frames N exits after N frames drawn with the player in the world.
It is otherwise a frame-limited run (classic menus, --timeout-seconds), and
--frames keeps its meaning for the harnesses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:53:47 +02:00
Ludovic Marie b9d6d1c7d9 Stronghold ring searches run on every worker that needs them
The 128 stronghold ring positions each need a biome search over a 57x57
quart area. The first worker to ask computed all of them inside a OnceLock
while every other worker blocked on it: about 2 s on an M4 Pro with 12 of
13 workers idle, after every world load and every return to the Overworld.

Vanilla's generateRingPositions runs each search as its own task on the
background executor. Now the ring chunks and search randoms are planned
serially (cheap), and every thread that needs the rings takes searches
until none are left, then waits for the rest. Positions are unchanged:
each search only uses its own forked random.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:52:23 +02:00