Since there's some talk about intiface and lovense devices being unresponsive:
Direct bluetooth connections via intiface should be far more responsive, however it's also important to note that while in theory most bluetooth devices should be able to handle a lot of commands per second they for some reason don't. It all depends on the quality of bluetooth modules they are using and a lot of toys use cheaper ones. And even 2 of the same toy can differ regarding bluetooth quality.
The most important thing to keep in mind in the dev side of things is to not overwhelm the device with commands, otherwise it will struggle to keep up. This means limiting the rate at which commands are sent and optimizing them, aka skip the command to vibrate at 70% when the device is already doing that.
For vibrating devices I have found that a minimum time of 0.2secs between requests is fine for most toys. In another beat based game I modded I used the following approach when triggering a beat:
- get the time until the next beat and calculate an intensity based on that. I used an exponential function that gave me 100% at 0.2s, 50% at 0.5s and 20% at 0.8s.
- skip if the intensity is the same as the last one I sent to the device
- if the next beat is in less than 0.25 secs just send the command, otherwise spice it up a little. instead of sending the calculated intensity I increase it by a third of the missing intensity and hold it for 0.2secs before returning to the regular intensity. in simple terms, if the original is 10% then 90% are missing. a third of that is 30%, so I send 40% and reduce it to the original amount of 10% after 0.2 seconds. It creates a noticable bump when beats hit for better tactile feedback.