Vibrate the Controller Feedback System (PLUGIN COMPLETE, RTM SUBMITTED FOR REVIEW)

Status
Not open for further replies.

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
923
Reaction score
394
First Language
English (USA)
Primarily Uses
RMMV
UPDATE 19 JULY 2019: The plugin is complete and final review is pending. In the event of approval, the discussion will be moved to this link:

https://forums.rpgmakerweb.com/inde...ble-a-plugin-for-controller-vibration.111254/

Thanks to everyone for helping to make this happen.

ORIGINAL TOPIC:
Exactly as it sounds. Not sure if anyone has ever thought of this yet (edit: aside from maybe a select few) but what if there was a "plugin and extension" combo that allowed for a "vibrate the controller" feedback system (aka rumble mode)?
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
the problem is that this is very difficult to program over multiple devices.
controllers are handled differently between Windows and MacOS, and mobiles with their vibration function would need a third option of controlling them - and that assumes that Linux and MacOS use the same API or it would be a fourth set of commands that would be needed in the project.
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
923
Reaction score
394
First Language
English (USA)
Primarily Uses
RMMV
Obviously I am open to any consequences with this and can easily start with platform-based support to begin with. I have absolutely zero interest in an all-at-once rollout and I already know my way around the navigator agent API (read: how to account for different devices in a HTML-based app) to determine availability. And unless you count Switch I wouldn't even be interested in using this feature on a portable device to begin with.

For simplicity I'll probably end up starting with the Windows implementation of the feature before anything else and then build it up from there.
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
923
Reaction score
394
First Language
English (USA)
Primarily Uses
RMMV
After some research I determined that starting with an implementation for Windows is probably going to be my best starting point. The downside is that I would have to reject anything prior to Win10 (which is fine as I've already decided to completely diss Win7 because my release is targeted for well after the drop dead support date). That and it would have to be platform-exclusive for the solution I've decided on, provided someone can do a plugin around this.

Anyway, here's what I'm looking at (but keep in mind that some of it may not interface at the desktop level as it was originally intended for use in Xbox targeting (and hence UWP/Microsoft Store). If anyone would be able to analyze this and craft a plugin that can access the functions within (like what OrangeGreenworks does) that would be the point I'd start with.

https://www.npmjs.com/package/@nodert-win10-rs4/windows.gaming.input/v/0.4.0
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
923
Reaction score
394
First Language
English (USA)
Primarily Uses
RMMV
Additional research pointed me to this piece from the Gamepad API extensions. Not a guarantee (availability unknown per listed status) but try this.

EDIT: After further discussion, I should note that a change in the game launcher from the default provisions that MV ships with may be required as well (similar to how OrangeGreenworks is managed but for the app package itself).
 
Last edited:

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
923
Reaction score
394
First Language
English (USA)
Primarily Uses
RMMV
Feature complete! After discovering by visual cross-exam that I had a no-rumble gamepad I took up Prime Day and ordered a separate controller for use in specifically testing this new addition to my project.

First off, a quick disclaimer: as I have previously stated there's no guarantee that the launcher shipped with MV will have this capacity so you'll want to patch in a more recent build of nwjs (latest available version preferred, and don't forget to back up the default launcher in case you run into a problem.) Do this for both MV and your exported game (MV should be patched with the developer's build for obvious reasons), and do so with a 64-bit package to really future-proof your work (and besides, MV ships with a x86-class launcher anyway which is both technically and logistically substandard for modern game development).

Once you've patched and tested the SDK environment, put this code in any event in your project where you intend to have rumble processing via a script eval:

Code:
var gamepads = navigator.getGamepads();
if (gamepads.length > 0) {
var gamepad = gamepads[0];
if (gamepad.vibrationActuator) {
gamepad.vibrationActuator.playEffect("dual-rumble", {
duration: 1000,
strongMagnitude: 1.0,
weakMagnitude: 1.0 }
);
}
}
Hope this helps any of you who are interested in doing this! And before I forget to mention this, don't increase the numeric values above the given example (unless you're changing duration by however much time in milliseconds) because otherwise it won't work. Seriously, 1.0 is the maximum load that rumble systems can handle (and yes, I tested it myself - the function will go completely unnoticed if you try going above these values on anything other than your intended duration). You can go with lower values than I have listed, however - so if you have something for which you don't need full intensity you can adjust by fractions and still be within limits.

EDIT: Turns out that 0.1 on either of the magnitude values doesn't work either. (Guessing it's for obvious reasons.)

EDIT 2: Forgot to mention that weak and strong don't have to follow a reasonable logic pattern, so you can totally do 0.2 strong and 0.4 weak if that's what you want.

EDIT 3: All I have left to ask is for someone to put this in a plugin so that it's easier to deal with on a per-case basis.

EDIT 4: Screw finding someone to do the plugin itself: my contact for the project basically did the work for me! After going over what I was provided with I went into my plugin database and converted it accordingly using the provided code function. I'll be moving this to plugin releases to accommodate this development so until I get the new discussion page up for that I'm outta here. Thanks to everyone for their input on making this happen!

EDIT 5: And the plugin has now been submitted for review. Thanks again to everyone for your input.
 
Last edited:

Ms Littlefish

Dangerously Caffeinated
Global Mod
Joined
Jan 15, 2014
Messages
6,417
Reaction score
8,104
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top