Thanks Beneau, I have gathered some information about the SDL rumble interface from the SDL2 wiki [1]:
The SDL haptic subsystem allows you to control haptic (force feedback) devices. The basic usage is as follows:
1. Initialize the subsystem (SDL_INIT_HAPTIC)
2. Open a haptic device
a. SDL_HapticOpen() to open from index
b. SDL_HapticOpenFromJoystick() to open from an existing joystick
3. Create an effect (SDL_HapticEffect)
4. Upload the effect with SDL_HapticNewEffect()
5. Run the effect with SDL_HapticRunEffect()
6. (optional) Free the effect with SDL_HapticDestroyEffect()
7. Close the haptic device with SDL_HapticClose()
The wiki mentions this blog by Edgar Simo Serra: SDL Haptic In Depth[2]. It uses SDL 1.3, so it may need some changes to work with the current SDL version (2.0.14)
The other half of the solution is to figure out what effects to apply to the steering wheel. I can think of the following events:
- A kart is blown up: a rumble. Maybe it's cool to add a sharp shake of the steering wheel when the kart leaves the ground, and another one when the kart hits the ground again.
- A kart is hit from the side: A sudden force on the wheel. The harder the kart is hit, the more force.
- A kart runs over wooden logs: A low-intensity rumble.
Do we want realistic forces on the wheel during cornering?
[1]
https://wiki.libsdl.org/CategoryForceFeedback[2]
https://web.archive.org/web/20130728040 ... dl_haptic/