[PR #3276] [CLOSED] Add experimental real-time audio and networking APIs for mods #4886

Closed
opened 2026-11-03 05:08:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3276
Author: @dan4ikx
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: main


📝 Commits (10+)

  • d7b3054 docs(mods): propose native voice permission design
  • 13e4ab6 Merge branch 'horizon-rust:main' into main
  • 69c43c5 feat(mods): add experimental realtime audio and networking APIs
  • 267f54a fix(mods): release realtime resources for mods without frame hooks
  • 7d7806d fix(mods): avoid deprecated atomic fetch_update in DNS limiter
  • e44805c fix(mods): handle custom payload output in the mod checker
  • 4d324e3 fix(mods): keep sync stub empty without the mod runtime
  • 6de6cc3 fix(mods): preserve native settings alongside restored voice APIs
  • 5c95aaa Merge branch 'horizon-rust:main' into main
  • d3994c8 Merge branch 'horizon-rust:main' into main

📊 Changes

37 files changed (+3040 additions, -30 deletions)

View changed files

📝 Cargo.lock (+2 -0)
📝 crates/horizon-client-render/src/mod_list.rs (+10 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+102 -0)
📝 crates/horizon-client/Cargo.toml (+2 -3)
📝 crates/horizon-client/assets/horizon/lang/en_us.json (+13 -1)
📝 crates/horizon-client/assets/horizon/lang/ru_ru.json (+13 -1)
📝 crates/horizon-client/src/game.rs (+9 -0)
📝 crates/horizon-client/src/game/extras.rs (+2 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+9 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+39 -6)
➕ crates/horizon-client/src/game/native_voice.rs (+283 -0)
📝 crates/horizon-client/src/game/options.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+31 -1)
📝 crates/horizon-client/src/game/saving.rs (+1 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+3 -1)
📝 crates/horizon-client/src/net.rs (+7 -0)
📝 crates/horizon-mod-registry/Cargo.lock (+1 -0)
📝 crates/horizon-mods/Cargo.toml (+4 -0)
📝 crates/horizon-mods/src/lib.rs (+4 -1)
➕ crates/horizon-mods/src/native.rs (+1028 -0)

...and 17 more files

📄 Description

🤖 Prepared by dan4ikx's AI agent (OpenAI Codex).

What and why

Adds experimental Mod API level 8 capabilities for implementing voice communication in Rust/WebAssembly mods, including a future Simple Voice Chat compatibility mod.

  • Microphone: device selection, start/stop capture, raw mono PCM and input gain.
  • Audio: buffered PCM playback, simultaneous sources, individual volume and positional attenuation.
  • UDP: connected nonblocking sockets, binary datagrams and asynchronous DNS.
  • Custom payloads: registered Minecraft channels and binary messages between client and server mods, with player UUIDs and connection events.
  • SDK: Rust bindings, documentation and client/server examples demonstrating Push-to-Talk monitoring and protocol negotiation.

Microphone recording requires a separate per-mod permission, blocked by default. Resources and queues are bounded; capture, playback and sockets are cleaned up on unload or disconnect, including for mods without frame hooks.

These are reusable APIs. Simple Voice Chat's codec, authentication, encryption and wire protocol must be implemented by a separate mod.

Vanilla reference

Horizon-only Mod API extension using Minecraft's existing play-state custom payload transport. No vanilla voice feature is introduced.

Self-check

  • Passed: 30 runtime unit tests.
  • Passed: 38 WASM sandbox tests; 1 performance test ignored.
  • Passed: 4 API reference checks and 4 mod-list tests.
  • Python suite: 401 tests run, 4 skipped.
  • Passed: client build with mods and audio.
  • Passed: runtime, SDK and example Clippy checks with warnings denied.
  • Passed: scoped client Clippy with existing nonminimal_bool, collapsible_match and manual_range_contains rules excluded.
  • Passed: formatting and public-tree checks.

pr_ready.py --quick encountered 12 existing Clippy errors in unchanged horizon-world files. Remaining broad workspace checks were not completed. Vanilla harnesses were not run because prepared game resources were unavailable.

Limitations

  • Physical microphone/speaker behavior and end-to-end audio latency require hardware testing.
  • Interoperability with Java Simple Voice Chat has not been tested.
  • Positional playback uses stereo panning and distance attenuation; HRTF and obstruction processing remain future work.

Screenshots

Not captured. The visible change is a per-mod “Microphone: Allowed / Blocked” switch in Options → Mods.

🤖 Generated with OpenAI Codex


🔄 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/3276 **Author:** [@dan4ikx](https://github.com/dan4ikx) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`d7b3054`](https://github.com/horizon-rust/horizon/commit/d7b30543b92181165c091885e167c45a289f8b0f) docs(mods): propose native voice permission design - [`13e4ab6`](https://github.com/horizon-rust/horizon/commit/13e4ab6debdc909de8881d9034b42e3ab1ade869) Merge branch 'horizon-rust:main' into main - [`69c43c5`](https://github.com/horizon-rust/horizon/commit/69c43c50ae5a0060819ffcbc7d6f0439b161482b) feat(mods): add experimental realtime audio and networking APIs - [`267f54a`](https://github.com/horizon-rust/horizon/commit/267f54a5be55b5f4f40f54217e847185243d6811) fix(mods): release realtime resources for mods without frame hooks - [`7d7806d`](https://github.com/horizon-rust/horizon/commit/7d7806d7a628063f8cde3a38ded56aab4396f359) fix(mods): avoid deprecated atomic fetch_update in DNS limiter - [`e44805c`](https://github.com/horizon-rust/horizon/commit/e44805cb8500303b2b800e6928ade171fcb3661f) fix(mods): handle custom payload output in the mod checker - [`4d324e3`](https://github.com/horizon-rust/horizon/commit/4d324e317bf93df9de136fb06cd4a40dbc0a8e68) fix(mods): keep sync stub empty without the mod runtime - [`6de6cc3`](https://github.com/horizon-rust/horizon/commit/6de6cc354dd45171be606ac798b3bc863422990e) fix(mods): preserve native settings alongside restored voice APIs - [`5c95aaa`](https://github.com/horizon-rust/horizon/commit/5c95aaa6aaf37eee098f885c108cb07576cf9415) Merge branch 'horizon-rust:main' into main - [`d3994c8`](https://github.com/horizon-rust/horizon/commit/d3994c851dd6098ec7ba9d02fa28856dd0b3ec0e) Merge branch 'horizon-rust:main' into main ### 📊 Changes **37 files changed** (+3040 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+2 -0) 📝 `crates/horizon-client-render/src/mod_list.rs` (+10 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+102 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -3) 📝 `crates/horizon-client/assets/horizon/lang/en_us.json` (+13 -1) 📝 `crates/horizon-client/assets/horizon/lang/ru_ru.json` (+13 -1) 📝 `crates/horizon-client/src/game.rs` (+9 -0) 📝 `crates/horizon-client/src/game/extras.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+9 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+39 -6) ➕ `crates/horizon-client/src/game/native_voice.rs` (+283 -0) 📝 `crates/horizon-client/src/game/options.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+31 -1) 📝 `crates/horizon-client/src/game/saving.rs` (+1 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+3 -1) 📝 `crates/horizon-client/src/net.rs` (+7 -0) 📝 `crates/horizon-mod-registry/Cargo.lock` (+1 -0) 📝 `crates/horizon-mods/Cargo.toml` (+4 -0) 📝 `crates/horizon-mods/src/lib.rs` (+4 -1) ➕ `crates/horizon-mods/src/native.rs` (+1028 -0) _...and 17 more files_ </details> ### 📄 Description > 🤖 Prepared by dan4ikx's AI agent (OpenAI Codex). ## What and why Adds experimental Mod API level 8 capabilities for implementing voice communication in Rust/WebAssembly mods, including a future Simple Voice Chat compatibility mod. - **Microphone:** device selection, start/stop capture, raw mono PCM and input gain. - **Audio:** buffered PCM playback, simultaneous sources, individual volume and positional attenuation. - **UDP:** connected nonblocking sockets, binary datagrams and asynchronous DNS. - **Custom payloads:** registered Minecraft channels and binary messages between client and server mods, with player UUIDs and connection events. - **SDK:** Rust bindings, documentation and client/server examples demonstrating Push-to-Talk monitoring and protocol negotiation. Microphone recording requires a separate per-mod permission, blocked by default. Resources and queues are bounded; capture, playback and sockets are cleaned up on unload or disconnect, including for mods without frame hooks. These are reusable APIs. Simple Voice Chat's codec, authentication, encryption and wire protocol must be implemented by a separate mod. ## Vanilla reference Horizon-only Mod API extension using Minecraft's existing play-state custom payload transport. No vanilla voice feature is introduced. ## Self-check - Passed: 30 runtime unit tests. - Passed: 38 WASM sandbox tests; 1 performance test ignored. - Passed: 4 API reference checks and 4 mod-list tests. - Python suite: 401 tests run, 4 skipped. - Passed: client build with mods and audio. - Passed: runtime, SDK and example Clippy checks with warnings denied. - Passed: scoped client Clippy with existing `nonminimal_bool`, `collapsible_match` and `manual_range_contains` rules excluded. - Passed: formatting and public-tree checks. `pr_ready.py --quick` encountered 12 existing Clippy errors in unchanged `horizon-world` files. Remaining broad workspace checks were not completed. Vanilla harnesses were not run because prepared game resources were unavailable. ## Limitations - Physical microphone/speaker behavior and end-to-end audio latency require hardware testing. - Interoperability with Java Simple Voice Chat has not been tested. - Positional playback uses stereo panning and distance attenuation; HRTF and obstruction processing remain future work. ## Screenshots Not captured. The visible change is a per-mod “Microphone: Allowed / Blocked” switch in Options → Mods. 🤖 Generated with [OpenAI Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:40 +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#4886
No description provided.