[PR #149] [MERGED] Controllers: rumble #2354

Closed
opened 2026-11-02 15:55:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/149
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: feat/controllers-rumble


📝 Commits (2)

  • ccdc4fe Controllers: rumble
  • 40fce01 Controllers: hurt rumble only within one player's life

📊 Changes

8 files changed (+226 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -0)
📝 crates/horizon-client/src/game/end.rs (+1 -0)
📝 crates/horizon-client/src/game/explosion.rs (+9 -0)
📝 crates/horizon-client/src/game/nether_portal.rs (+1 -0)
📝 crates/horizon-client/src/game/pad.rs (+79 -2)
📝 crates/horizon-client/src/game/remote.rs (+1 -0)
📝 crates/horizon-client/src/game/totem.rs (+1 -0)
📝 crates/horizon-client/src/gamepad.rs (+132 -0)

📄 Description

Part 4 of controller support (design: docs/controllers.md). Based on main (rebased after #129).

What

Vibration through gilrs force feedback, on by default (vibration:true in horizon-controller.txt; the switch is in #145's Controller options):

Event Heavy motor Light motor Length
Damage taken (any source, single-player or server) 0.2 + 0.06 × HP lost, max 0.8 0.3 150 ms + 20 ms × HP, max 400
Block broken 0 0.25 60 ms
Explosion nearby 0.9 × closeness 0.6 × closeness 350 ms (felt up to 4× the blast radius)
Totem of undying 0.7 0.7 500 ms
  • Damage is detected from the player's health dropping between polls (HealthWatch); the baseline is forgotten on the title screen, when there is no player, and whenever a new player entity takes over (spawn/respawn, joining a server, End/Nether dimension changes), so arriving with less health than the last player isn't "hurt", so every damage source (and multiplayer) is covered without touching combat code. Hooks elsewhere are one line each: break_block_as_player, server_explode, apply_totem.
  • Only the pad that is playing vibrates (a connected pad lying idle while the mouse plays stays still). gilrs has no force feedback on macOS: skipped silently there; Linux (evdev, incl. Steam Input's virtual pad) and Windows support it.
  • horizon-ctl pad status reports last_rumble (reason, motors, length).

How tested

  • Unit tests gamepad::tests::rumble_pulses and health_watch_only_counts_damage_in_one_life; clippy clean (macOS).
  • Linux build on vscreen with the injected pad, reading last_rumble: breaking a block → block (weak 0.25, 60 ms); a 12-block fall in survival → hurt (strong 0.74, 330 ms); a TNT primed 8 blocks away → explosion (strong 0.44, 350 ms). Totem not exercised (one-line hook).
  • Nothing was felt: no pad was connected, so the gilrs effect path itself (and whether the strengths feel right) needs a real DualSense/Xbox pad or the Deck.

🤖 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/149 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/controllers-rumble` --- ### 📝 Commits (2) - [`ccdc4fe`](https://github.com/horizon-rust/horizon/commit/ccdc4fe6826ef87ad2343cce852fd119b128a5c8) Controllers: rumble - [`40fce01`](https://github.com/horizon-rust/horizon/commit/40fce014f1532dd090bb2aa0074b15e851493aa2) Controllers: hurt rumble only within one player's life ### 📊 Changes **8 files changed** (+226 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -0) 📝 `crates/horizon-client/src/game/end.rs` (+1 -0) 📝 `crates/horizon-client/src/game/explosion.rs` (+9 -0) 📝 `crates/horizon-client/src/game/nether_portal.rs` (+1 -0) 📝 `crates/horizon-client/src/game/pad.rs` (+79 -2) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -0) 📝 `crates/horizon-client/src/game/totem.rs` (+1 -0) 📝 `crates/horizon-client/src/gamepad.rs` (+132 -0) </details> ### 📄 Description Part 4 of controller support (design: `docs/controllers.md`). Based on `main` (rebased after #129). ## What Vibration through gilrs force feedback, on by default (`vibration:true` in `horizon-controller.txt`; the switch is in #145's Controller options): | Event | Heavy motor | Light motor | Length | |---|---|---|---| | Damage taken (any source, single-player or server) | 0.2 + 0.06 × HP lost, max 0.8 | 0.3 | 150 ms + 20 ms × HP, max 400 | | Block broken | 0 | 0.25 | 60 ms | | Explosion nearby | 0.9 × closeness | 0.6 × closeness | 350 ms (felt up to 4× the blast radius) | | Totem of undying | 0.7 | 0.7 | 500 ms | - Damage is detected from the player's health dropping between polls (`HealthWatch`); the baseline is forgotten on the title screen, when there is no player, and whenever a new player entity takes over (spawn/respawn, joining a server, End/Nether dimension changes), so arriving with less health than the last player isn't "hurt", so every damage source (and multiplayer) is covered without touching combat code. Hooks elsewhere are one line each: `break_block_as_player`, `server_explode`, `apply_totem`. - Only the pad that is playing vibrates (a connected pad lying idle while the mouse plays stays still). gilrs has no force feedback on macOS: skipped silently there; Linux (evdev, incl. Steam Input's virtual pad) and Windows support it. - `horizon-ctl pad status` reports `last_rumble` (reason, motors, length). ## How tested - Unit tests `gamepad::tests::rumble_pulses` and `health_watch_only_counts_damage_in_one_life`; clippy clean (macOS). - Linux build on vscreen with the injected pad, reading `last_rumble`: breaking a block → `block` (weak 0.25, 60 ms); a 12-block fall in survival → `hurt` (strong 0.74, 330 ms); a TNT primed 8 blocks away → `explosion` (strong 0.44, 350 ms). Totem not exercised (one-line hook). - **Nothing was felt**: no pad was connected, so the gilrs effect path itself (and whether the strengths feel right) needs a real DualSense/Xbox pad or the Deck. 🤖 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-02 15:55:15 +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#2354
No description provided.