Skip to main content

Haptics

Haptics are short vibrations you can play on the player's phone — the same kind of tactile feedback that phones use for button presses, notifications, and toggles. They're a great way to make an action feel more satisfying: a tap when a button is pressed, a buzz when the player takes damage, or a celebratory pulse when they win.

There are two ways to trigger haptics from a deck:

  • The Vibrate the device Response (no code needed)
  • The castle.haptic(...) script function

Both play the same set of vibration styles.

The "Vibrate the device" response

Add a Response to any Rule and choose Vibrate the device (in the Device section). It has a single setting:

  • style — which vibration to play. Defaults to Medium.

For example, a rule like "When this actor is tapped → Vibrate the device with style Light" gives a button a satisfying little tap.

Vibration styles

There are seven styles to choose from, grouped into three kinds of feedback:

StyleFeel
LightA soft, subtle tap
MediumA standard tap (the default)
HeavyA strong, heavy thud
SelectionA tiny "tick", like scrolling through a picker
SuccessA positive, upbeat notification pattern
WarningA cautionary notification pattern
ErrorA negative "something went wrong" pattern

Light, Medium, and Heavy are single taps of increasing strength — use them for impacts, hits, and button presses. Success, Warning, and Error are short multi-tap patterns — use them to signal an outcome, like winning, losing, or an invalid move. Selection is a very light tick for scrolling or cycling through options.

Using haptics in scripts

If you're writing a script, call castle.haptic() with the name of a style:

-- play a strong tap
castle.haptic("heavy")

-- signal a win
castle.haptic("success")

-- no argument defaults to "medium"
castle.haptic()

The style names are the lowercase versions of the styles above: "light", "medium", "heavy", "selection", "success", "warning", and "error".

Things to keep in mind

  • Not every device vibrates. Haptics play on iPhones and most Android phones. They do nothing on the web player and on iPads, which don't have haptic hardware — so never rely on a vibration as the only feedback for something important. Pair it with a visual or sound change too.
  • Don't overdo it. Rapid-fire vibrations feel unpleasant and drain the battery. Castle automatically rate-limits haptics that fire too quickly in a row, so a burst of vibrations may get thinned out. Reserve haptics for moments that matter.
  • Players can mute them. Just like sound, players can turn haptics off, in which case your vibrations won't play during their session.