Skip to content

The Virtual Pinball (VPX) Platform

Related Config File Sections:

VPX can be used (on Windows) to emulate the hardware of a pinball machine to test your game without real hardware. For instructions to download and install Visual Pinball please see here.

This can be useful for software and hardware development. To use the VPX platform you need to install it, along with the MPF-VPX bridge and add some VPX scripts to your VPX table.

The bridge will connect to the running MPF machine when you start your VPX table. As the VPX table is used only to emulate the hardware and should not contain any game logic.

Installation

Copy the file register_vpcom.py to your local machine folder. To register the bridge run a CMD shell as Administrator, then

python register_vpcom.py --register

(You can use --unregister to uninstall the bridge)

Use VPX in MPF

In your config.yaml configure virtual_pinball as your platform:

hardware:
  platform: virtual_pinball

or if you already have physical hardware configured start MPF with the --vpx commandline option (similar to -X):

mpf both --vpx

Configure VPX

In VPX you need to adjust your script to talk to MPF. You can also looks this up in the example project inside the bridge repository. The GameName set in VPX is not used to check or validate the MPF machine.

Setup controller and timers

  • add Set Controller = CreateObject("MPF.Controller")
  • add a Timer MPFTimer with an interval of 10 to 50ms. Keep this well below the minimal default_pulse_ms set in MPF for solenoids
  • add a Sub MPFTimer_Timer to update all the lights and solenoids

In Table_Init

  • call Controller.run
  • set the Trough switch(es) or create balls for a physical Trough (as in the demo table)
  • init NC switches to False

In Drain_Hit (for 1-Ball games)

  • set the Trough switch(es)

To use autofire_coils (Slings, Pops etc)

  • add a droppable wall to each bumper. This will be used in Sub CheckAutofireCoils to disable/enable the bumper
  • if necessary place an invisible wall behind the slingshots to stop the ball once the slingshots are disabled
  • add each autofire object in VPX to Sub CheckAutofireCoils
  • use the normal Slingshot_Slingshot and Bumper_Hit events

Switch Handling

  • add Controller.Switch(MPFSwitchNumber)=SwitchState to the Switch_Hit/_Unhit events. Use "" to include string type numbers
  • add Controller.PulseSW(MPFSwitchNumber) to the Switch_Hit event of targets, slingshots and bumpers

Controlled Lights (all types)

  • create a collection "ControlledLamps"
  • assign all controlled VPX lamps (Matrix, GI, LED, Flashers) to the collection "ControlledLamps" and call InitLamps

LEDs and Lamps

  • in Sub UpdateLamps add a case for every MPF light and LED number, setting the state of the VPX lamp/LED. Use "" to include string type numbers

GI strings

  • create a collection for each GI string, assign the GI lamps to the collections as needed
  • assign all GI lamps to the collection "ControlledLamps" and callInitLamps
  • in Sub UpdateGI add a case for every MPF gi string number, setting the state of the VPX GI collection. Use "" to include string type numbers

Flashers

  • assign all flasher lamps to the collection "ControlledLamps" and call InitLamps
  • in Sub UpdateFlashers add a case for every MPF flasher number, setting the state of the VPX flasher. Use "" to include string type numbers

Solenoids

  • add all normal solenoids to the Sub InitSolenoids, to initialize them as False
  • in Sub UpdateSolenoids add a case for every MPF coil number, setting the state of the VPX solenoid. Use "" to include string type numbers

Flippers

  • add the Flipper routines (Solenoids and KeyUp/KeyDown) as in the demo table. Flippers are handled as autofire coils and can be enabled/disabled using hrdware rules.

To run a game

  1. start VPX as Administrator
  2. start MPF, wait until the display has been initialized
  3. start VPX table

To exit a game shut down the VPX table first

What if it did not work?

Have a look at our hardware troubleshooting guide.


Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results