Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gamepad rumble feature #954

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Fussmatte
Copy link
Contributor

Changes:

This PR adds a rumble/vibration feature for players who use gamepads. It's implemented as a toggleable option (currently off by default) in the game pad options submenu.

Currently these events in the game will cause haptic feedback to occur (sorted here roughly from high to low intensity):

  • Deaths
  • Screen shakes
  • Collecting trinkets
  • Touching teleporters
  • Touching checkpoints
  • Touching gravity lines/tokens

What still needs to be done:

  • Determine all events that should have haptic feedback
  • Determine optimal intensity for each event
  • Test feature across multiple game pads (I may need help for this!)

Legal Stuff:

By submitting this pull request, I confirm that...

  • My changes may be used in a future commercial release of VVVVVV
  • I will be credited in a CONTRIBUTORS file and the "GitHub Friends"
    section of the credits for all of said releases, but will NOT be compensated
    for these changes

@flibitijibibo
Copy link
Collaborator

Functionally this seems fine, though we could maybe make use of HD rumble to do more of a "tap" rather than a traditional rumble spin for some of the more subtle effects. This isn't easily exposed in SDL right now but we support enough devices now that it's probably worth considering for SDL3...

Other than that, will leave the rest to Terry for design feedback.

@flibitijibibo
Copy link
Collaborator

Filed libsdl-org/SDL#7509

Copy link
Contributor

@AllyTally AllyTally left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick review.

desktop_version/src/Graphics.cpp Outdated Show resolved Hide resolved
desktop_version/src/KeyPoll.cpp Outdated Show resolved Hide resolved
desktop_version/src/KeyPoll.cpp Outdated Show resolved Hide resolved
@Fussmatte Fussmatte force-pushed the rumble branch 2 times, most recently from 23e5c55 to 6bad535 Compare March 21, 2023 14:56
This commit adds a "rumble" option to the gamepad menu.
Enabling it will add controller vibration to various
parts of the game. Currently these events trigger a
vibration, at varying degrees of intensity:

- Deaths
- Screen shakes
- Touching checkpoints or teleporters
- Touching gravity lines or gravity tokens
- Collecting a trinket

Further testing is likely needed. So far I have
tested the feature using an 8bitdo SN30 Pro+
controller, in both Xinput and Switch modes.
The rumble has different quality in either mode,
and mileage may vary between other controllers,
which I haven't fully tested.
A few print lines were left in by accident, causing
the Game Pad and Rumble menu option titles to
render over each other if the latter was high-
lighted. This has been corrected.
The controllerRumble function has been cleaned up and now
iterates over the map of connected controllers instead of
opening handles each time rumble is used. The screenshake
rumble functions have been moved into the title and game
logic loops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants