Virtual Driver
Virtual Driver
The virtual driver simulates every pinball hardware device in memory. It is a complete drop-in replacement for a hardware driver so you can develop and test .cade configurations on any workstation.
Configuration
The virtual driver is configured in a platform block within your Cade configuration file. All properties are optional and control the maximum number of each device type.
platform "virtual" "sim" {
switch_count = 64
coil_count = 32
light_count = 128
servo_count = 8
}
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
switch_count | int | No | 64 | Number of virtual switch inputs |
coil_count | int | No | 32 | Number of virtual coil outputs |
light_count | int | No | 128 | Number of virtual light outputs |
servo_count | int | No | 8 | Number of virtual servo outputs |
Simulated Capabilities
The virtual driver simulates every capability the runtime exposes:
- Switches. State is tracked in memory and can be driven by event injection.
- Coils. Pulse, enable, and disable commands update in-memory state; pulses complete instantly.
- Lights. Full RGBW and brightness tracking, including batch updates, flash, and fade.
- Flippers. Enable/disable state is tracked per flipper.
- Autofire rules. Enable/disable state is tracked per rule (bumpers, slingshots).
- Servos. Position in degrees is tracked per servo, starting at 0.
Platform Capabilities
| Capability | Value |
|---|---|
| Transport | virtual |
| RGB lights | Yes |
| PWM coils | Yes |
| Firmware flippers | Yes |
| Firmware autofire | Yes |
| Address format | numeric |
Simulated Behavior
The virtual driver maintains in-memory state for each device type:
- Switches start in the open state. State changes feed the same hardware event pipeline used by physical drivers.
- Coils track energized/de-energized state. Pulse commands complete instantly.
- Lights track full RGBW color values, brightness, and on/off state.
- Flippers and autofire rules track enabled/disabled state.
- Servos track the current position angle in degrees, starting at 0.
Event Injection
Tests and tooling can inject switch events directly. Injected events flow through the same path as real hardware inputs, so scoring and game logic react identically.
Use Cases
- Development without hardware. Build and test game logic on any workstation without a pinball controller connected.
- Automated testing. Drive switch inputs programmatically and verify game behavior in unit and integration tests.
- CI/CD pipelines. Run the full Cade stack in continuous integration environments where no hardware is available.
- Prototyping. Experiment with device configurations, event flows, and game rules before committing to a hardware layout.
Diagnostics
The virtual driver reports the same diagnostics as hardware drivers:
- Connection status
- Uptime
- Events received and commands sent
- Counts of configured switches, coils, lights, and servos