[PR #7772] [MERGED] Cosmetics: the game draws them on players, behind a flag #7811

Closed
opened 2026-11-03 07:24:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7772
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: feat/cosmetics-draw


📝 Commits (4)

  • ca4435e Cosmetics: the game draws them on players, behind a flag
  • 6a35c8e Cosmetics: reuse the pose buffers and bone matrices between avatars
  • dcf54ab Cosmetics: rustfmt
  • 52d38ca Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

19 files changed (+473 additions, -9 deletions)

View changed files

📝 Cargo.lock (+2 -0)
📝 crates/horizon-client-render/Cargo.toml (+1 -0)
📝 crates/horizon-client-render/src/extras.rs (+42 -4)
📝 crates/horizon-client/Cargo.toml (+1 -0)
📝 crates/horizon-client/assets/horizon/lang/de_de.json (+6 -1)
📝 crates/horizon-client/assets/horizon/lang/en_us.json (+6 -1)
📝 crates/horizon-client/assets/horizon/lang/fr_fr.json (+6 -1)
📝 crates/horizon-client/src/game.rs (+4 -0)
➕ crates/horizon-client/src/game/cosmetics.rs (+255 -0)
📝 crates/horizon-client/src/game/creatures.rs (+19 -0)
📝 crates/horizon-client/src/game/perspective.rs (+8 -0)
📝 crates/horizon-client/src/game/remote.rs (+6 -0)
📝 crates/horizon-client/src/game/scoreboard.rs (+1 -0)
📝 crates/horizon-cosmetics/src/fetch.rs (+68 -0)
📝 crates/horizon-cosmetics/src/lib.rs (+18 -1)
📝 docs/cosmetics.md (+18 -0)
📝 docs/extras.md (+1 -0)
📝 tests/test_perf_bench.py (+2 -1)
📝 tools/stress_scenes.py (+9 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Part of #7722. Stacked on #7762 (retargets to main when it merges).

What

The game draws cosmetics on players, off by default: horizon_cosmetics::ON_BY_DEFAULT = false, so a normal build starts no thread, sends no request, shows no setting and draws nothing. HORIZON_COSMETICS=1 turns them on for one run (development and the bench). Details: docs/cosmetics.md, "In the game".

  • Drawing (game/cosmetics.rs): each item's texture takes one of the skin atlas's 64×64 slots (store_skin, marked drawn like a downloaded skin, so it's freed with them), and its boxes are posed on the wearer's bone each frame through the same GPU skin path as the player model (mobs::skin::Skin::draw), or the CPU path where that is off. They are lit and culled with the player (merged into its skinned bounds). A helmet hides a head item; an elytra or a cape hides a back item.
  • Who: other players by their UUID from the player info the server already sends (remote_player_uuid), and your own model (third person, inventory preview). Nothing new goes to the server; vanilla players and servers see nothing.
  • Settings (Options → Horizon Settings → Extras, a "Cosmetics" header shown only with the flag on): My cosmetics and Other players' cosmetics, both on. Off, the game doesn't ask about those players at all.
  • Local items for art and the bench: HORIZON_COSMETICS_LOCAL=<folder> reads item files from a folder; every player and mannequin then wears the first item of each slot. HORIZON_COSMETICS_API points at another service.
  • Bench scene stress_avatars in tools/stress_scenes.py: 300 mannequins (20×15, 1.5 blocks apart) in front of the camera.

Perf

Alternating A/B runs of tools/perf_bench.py --game horizon --offscreen --distances 16 --seconds 10 on the Mac mini (M4 Pro, shared with other jobs, so pairs alternate off/on). Off = HORIZON_COSMETICS=0; on = HORIZON_COSMETICS=1 HORIZON_COSMETICS_LOCAL=<the 4 art items>, where every mannequin wears a head, back and shoulder item: 300 avatars and 900 items in view, far more than a server shows.

Scene Off: frame p50 (fps, 1% low) On: frame p50 (fps, 1% low)
stress_empty (no avatar), 3 pairs 0.67 / 0.68 / 0.65 ms (1422 / 1401 / 1466 fps) 0.67 / 0.68 / 0.68 ms (1422 / 1395 / 1416 fps)
stress_avatars, first commit, 3 pairs 1.24 / 1.49 / 1.50 ms (797 / 654 / 651 fps; 1% 551 / 440 / 451) 2.06 / 2.12 / 2.13 ms (479 / 461 / 463 fps; 1% 344 / 271 / 290)
stress_avatars, with the reuse commit, 2 pairs 1.52 / 1.60 ms (652 / 578 fps) 2.00 / 2.08 ms (487 / 468 fps)
  • None in view: no cost (stress_empty is the same within noise). A player with nothing to wear costs one cache lookup.
  • 300 avatars with three items each: about +0.5 ms p50 after the second commit (it reuses the pose buffers and bone matrices between avatars; +0.63 ms before), so about 1.6 µs per avatar for its three items. A typical server view of 10–20 dressed players is ~30 µs.

Tests

  • tests/test_perf_bench.py: the new scene summons its 300 mannequins within the bench distance.
  • Seen in game: HORIZON_COSMETICS=1 HORIZON_COSMETICS_LOCAL=… with the art items on rows of mannequins: the sprout, owl and backpack on their bones, lit with the scene.

pr_ready

pr_ready (tools/pr_ready.py --quick --base origin/feat/cosmetics-fetch on ludovics-mac-mini, against origin/feat/cosmetics-fetch at b72413d1d, 15 min 49 s)

Check Result
Scope ✅ 19 files, +471 −9
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 614 passed (1 min 49 s)
rustfmt ❌ failed (6 s)
clippy ✅ (1 min 15 s)
tests: workspace ❌ 3777 passed, 1 failed (6 min 43 s)
doc tests ✅ 0 passed (1 min 9 s)
content root tests ✅ 24 passed (2 min 51 s)
mod API up to date ✅ (18 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (2 s)
launcher clippy ✅ (40 s)
launcher tests ❌ 451 passed, 1 failed (55 s)
Parity ➖ 382 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute and 370 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The three ❌, on 6a35c8e1e8:

  • rustfmt: two long lines in game/cosmetics.rs and a mod order in game.rs; fixed in dcf54ab49c (cargo fmt -p horizon-client … -- --check passes).
  • tests: workspace: only horizon-friends::tests::a_deadline_ends_the_stream_unless_dropped, which fails the same way on main on macOS (set_read_timeout after the shutdown returns EINVAL); untouched crate, CI runs it on Linux.
  • launcher tests: only backend::tests::prepared_versions_get_what_the_asset_store_adds_without_preparing_again, which saw an extra "Waiting for another horizon-prepare to finish" line: a lock race under the Mac mini's load. This PR doesn't touch the launcher.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7772 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/cosmetics-draw` --- ### 📝 Commits (4) - [`ca4435e`](https://github.com/horizon-rust/horizon/commit/ca4435ef2745092fdb338eca56ca95137ff31ebf) Cosmetics: the game draws them on players, behind a flag - [`6a35c8e`](https://github.com/horizon-rust/horizon/commit/6a35c8e1e871af995c1c863711fca940f14137ec) Cosmetics: reuse the pose buffers and bone matrices between avatars - [`dcf54ab`](https://github.com/horizon-rust/horizon/commit/dcf54ab49cfc4b0bdc4a2e4815e6476c798576d5) Cosmetics: rustfmt - [`52d38ca`](https://github.com/horizon-rust/horizon/commit/52d38ca94c2bed8a2b7f56f9f24066b7aab14818) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **19 files changed** (+473 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+2 -0) 📝 `crates/horizon-client-render/Cargo.toml` (+1 -0) 📝 `crates/horizon-client-render/src/extras.rs` (+42 -4) 📝 `crates/horizon-client/Cargo.toml` (+1 -0) 📝 `crates/horizon-client/assets/horizon/lang/de_de.json` (+6 -1) 📝 `crates/horizon-client/assets/horizon/lang/en_us.json` (+6 -1) 📝 `crates/horizon-client/assets/horizon/lang/fr_fr.json` (+6 -1) 📝 `crates/horizon-client/src/game.rs` (+4 -0) ➕ `crates/horizon-client/src/game/cosmetics.rs` (+255 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+19 -0) 📝 `crates/horizon-client/src/game/perspective.rs` (+8 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -0) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+1 -0) 📝 `crates/horizon-cosmetics/src/fetch.rs` (+68 -0) 📝 `crates/horizon-cosmetics/src/lib.rs` (+18 -1) 📝 `docs/cosmetics.md` (+18 -0) 📝 `docs/extras.md` (+1 -0) 📝 `tests/test_perf_bench.py` (+2 -1) 📝 `tools/stress_scenes.py` (+9 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #7722. Stacked on #7762 (retargets to main when it merges). ## What The game draws cosmetics on players, **off by default**: `horizon_cosmetics::ON_BY_DEFAULT = false`, so a normal build starts no thread, sends no request, shows no setting and draws nothing. `HORIZON_COSMETICS=1` turns them on for one run (development and the bench). Details: `docs/cosmetics.md`, "In the game". - **Drawing** (`game/cosmetics.rs`): each item's texture takes one of the skin atlas's 64×64 slots (`store_skin`, marked drawn like a downloaded skin, so it's freed with them), and its boxes are posed on the wearer's bone each frame through the same GPU skin path as the player model (`mobs::skin::Skin::draw`), or the CPU path where that is off. They are lit and culled with the player (merged into its skinned bounds). A helmet hides a head item; an elytra or a cape hides a back item. - **Who**: other players by their UUID from the player info the server already sends (`remote_player_uuid`), and your own model (third person, inventory preview). Nothing new goes to the server; vanilla players and servers see nothing. - **Settings** (Options → Horizon Settings → Extras, a "Cosmetics" header shown only with the flag on): *My cosmetics* and *Other players' cosmetics*, both on. Off, the game doesn't ask about those players at all. - **Local items for art and the bench**: `HORIZON_COSMETICS_LOCAL=<folder>` reads item files from a folder; every player and mannequin then wears the first item of each slot. `HORIZON_COSMETICS_API` points at another service. - **Bench scene** `stress_avatars` in `tools/stress_scenes.py`: 300 mannequins (20×15, 1.5 blocks apart) in front of the camera. ## Perf Alternating A/B runs of `tools/perf_bench.py --game horizon --offscreen --distances 16 --seconds 10` on the Mac mini (M4 Pro, shared with other jobs, so pairs alternate off/on). Off = `HORIZON_COSMETICS=0`; on = `HORIZON_COSMETICS=1 HORIZON_COSMETICS_LOCAL=<the 4 art items>`, where every mannequin wears a head, back and shoulder item: 300 avatars and 900 items in view, far more than a server shows. | Scene | Off: frame p50 (fps, 1% low) | On: frame p50 (fps, 1% low) | |---|---|---| | `stress_empty` (no avatar), 3 pairs | 0.67 / 0.68 / 0.65 ms (1422 / 1401 / 1466 fps) | 0.67 / 0.68 / 0.68 ms (1422 / 1395 / 1416 fps) | | `stress_avatars`, first commit, 3 pairs | 1.24 / 1.49 / 1.50 ms (797 / 654 / 651 fps; 1% 551 / 440 / 451) | 2.06 / 2.12 / 2.13 ms (479 / 461 / 463 fps; 1% 344 / 271 / 290) | | `stress_avatars`, with the reuse commit, 2 pairs | 1.52 / 1.60 ms (652 / 578 fps) | 2.00 / 2.08 ms (487 / 468 fps) | - **None in view: no cost** (`stress_empty` is the same within noise). A player with nothing to wear costs one cache lookup. - **300 avatars with three items each: about +0.5 ms p50** after the second commit (it reuses the pose buffers and bone matrices between avatars; +0.63 ms before), so about 1.6 µs per avatar for its three items. A typical server view of 10–20 dressed players is ~30 µs. ## Tests - `tests/test_perf_bench.py`: the new scene summons its 300 mannequins within the bench distance. - Seen in game: `HORIZON_COSMETICS=1 HORIZON_COSMETICS_LOCAL=…` with the art items on rows of mannequins: the sprout, owl and backpack on their bones, lit with the scene. ## pr_ready **pr_ready** (`tools/pr_ready.py --quick --base origin/feat/cosmetics-fetch` on ludovics-mac-mini, against origin/feat/cosmetics-fetch at b72413d1d, 15 min 49 s) | Check | Result | | --- | --- | | Scope | ✅ 19 files, +471 −9 | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ✅ 614 passed (1 min 49 s) | | rustfmt | ❌ failed (6 s) | | clippy | ✅ (1 min 15 s) | | tests: workspace | ❌ 3777 passed, 1 failed (6 min 43 s) | | doc tests | ✅ 0 passed (1 min 9 s) | | content root tests | ✅ 24 passed (2 min 51 s) | | mod API up to date | ✅ (18 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (2 s) | | launcher clippy | ✅ (40 s) | | launcher tests | ❌ 451 passed, 1 failed (55 s) | | Parity | ➖ 382 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute and 370 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The three ❌, on 6a35c8e1e8: - **rustfmt**: two long lines in `game/cosmetics.rs` and a `mod` order in `game.rs`; fixed in dcf54ab49c (`cargo fmt -p horizon-client … -- --check` passes). - **tests: workspace**: only `horizon-friends::tests::a_deadline_ends_the_stream_unless_dropped`, which fails the same way on main on macOS (`set_read_timeout` after the shutdown returns `EINVAL`); untouched crate, CI runs it on Linux. - **launcher tests**: only `backend::tests::prepared_versions_get_what_the_asset_store_adds_without_preparing_again`, which saw an extra "Waiting for another horizon-prepare to finish" line: a lock race under the Mac mini's load. This PR doesn't touch the launcher. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:24:30 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7811
No description provided.