Jump to content



Photo
- - - - -

Mission Pinball Framework VPX Bridge - Demo

Visual Pinball Tutorials

  • Please log in to reply
16 replies to this topic

#1 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 24 April 2019 - 10:32 PM

Hi,

after discovering MPF as a great way to code the rules for a real pinball table, I wanted to to run it with VPX to model the table layout and the code before buying real hardware and drilling real holes.
Then I found the mpf-vpcom-bridge by jabdoa2 on GitHub and things got moving. Documentation was thin but I got the link up and running.

Attached is a basic MPF game folder, the VPX Bridge by jabdoa2 and a VPX table that is providing the "hardware" for MPF. 

Have fun and please let me know if this helps You in Your MPF Projects.

Michael

 

Content of Readme.txt:

Mission Pinball Framework:
https://missionpinball.org/

 

MPF_VPX_Bridge by jabdoa2:
https://github.com/m...pf-vpcom-bridge

 

Bridge Installation:

 

1. Register mpf-visual-pinball bridge (run cmd shell as Administrator):
python register_vpcom.py –register

 

2. Create Your MPF table folder. In Your config.yaml enter:
hardware:
    platform: virtual_pinball

 

3. In VPX edit script and replace the controller with:
Set Controller = CreateObject(“MPF.Controller”)

 

To run a game:

 

1. start MPF (mpf both), wait until the display has been initialized
2. start VPX (as Administrator).
3. Run VPX table.

 

Remarks:
The setting of cGamename in VPX is not used to establish or check the connection.
The VPX Bridge connects to the running MPF.

 

Switch numbers can be of type integer or string. (use quotation marks for strings in VPX: “0-1” od “sf1”)
Numbers of Lamps and Solenoids must be of type integer for the moment.

 

To code a pulse event (Standup Targets, Bumpers, Slingshots) set the switch to True on the Hit event and add a timer (150 or 200ms)
to set the switch back to False. Be careful with Drop Targets and Slingshots, here the built-in timer cannot be used as it is used for the animation.

 

Autofire Solenoids (Bumpers, Slingshots) need some special care. In VPX use the built-in functionality (Bumper_Hit, Slingshot_slingshot) and ignore the solenoid calls from MPF. Enabling/disabling such autofire_coils depending on a specific game mode will perhaps require an artifical lamp to tell VPX what to do.
To receive readable solenoid calls in VPX I had to add a coil_player section in MPF for the autofire_coils.

 

The flippers needed an entry in the coil_player too. In VPX the flippers will be held up while the main flipper coil or the hold coil is energized.

Attached Files


Edited by mfuegemann, 24 April 2019 - 10:37 PM.


#2 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 09 May 2019 - 08:29 PM

Just a short update. I am working on the bridge. 

The changes are available in MPF version 0.53 (still dev at the moment). I added the following things:

- Normally closed switches

- Lamps and Solenoids can be addressed by string type numbers

- The VPX-Controller now has a PulseSW method, that can be called from Target_hit

- Hardware rules are now monitored to enable/disable autofire coils as Bumpers, Slingshots and Flippers

 

The VPX demo table will be extended to show the new features.


Edited by mfuegemann, 09 May 2019 - 08:53 PM.


#3 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 08 October 2020 - 07:50 PM

And another addition: Kickbacks have to be handled as autofire coils too.



#4 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 08 October 2020 - 09:34 PM

You can build a ROM from that, that can then be submitted to be included in pinMAME cant you?


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#5 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 08 October 2020 - 10:08 PM

Hi,

 

I don't think so. All the rules and animations will be there, but I doubt that there is a tool to compress this all into a ROM file. This artificial ROM would be have to be included into the VPinmame.dll too.

The MPF is just a framework to create real life pinball machines. If You want to hook it up onto a real machine, replacing the CPU board, You have to re-code all the table logic.

 

The bridge is just  a way to code the rules without using/risking real pinball hardware. After You are done, the only thing left to do is adjusting the switch, light and solenoid numbers in Your config file to the settings of Your type of controller board and Your wiring.

 

Michael



#6 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 08 October 2020 - 11:27 PM

Oh, i thought that was what they were using to write the roms for custom pinball tables
like Spooky or Jacks etc


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#7 scottacus

scottacus

    Enthusiast

  • Gold Supporter
  • 307 posts
  • Location:Wisconsin

  • Flag: United States of America

  • Favorite Pinball: Adventures of Rocky and Bullwinkle

Posted 17 October 2020 - 02:12 PM

I tried out the demo today from the mpf site and I just wanted to say that this is a brilliant tool!  Thanks for taking the time and effort to put this together.  I'm hoping to use it as a "white board" of sorts to test out the mpf configs before moving on to a physical machine.



#8 luvthatapex

luvthatapex

    Pinball Fan

  • VIP
  • 1,435 posts

  • Flag: United States of America

  • Favorite Pinball: Tron



Posted 18 October 2020 - 02:36 PM

No spooky used the Ben Heck framework for American Most Haunted, Rob Zombie, Jetsons and Dominos, then moved onto the skeletongame framework for the rest of their games. THats what they use today.

 

Mission Pinball framework is just as good as skeletongame, the lead developer supports any mech you can think of and is very responsive.  Hope this tool becomes a gateway for more custom games.

 

Oh, i thought that was what they were using to write the roms for custom pinball tables
like Spooky or Jacks etc


Edited by luvthatapex, 18 October 2020 - 02:39 PM.


#9 joetechbob

joetechbob

    Neophyte

  • Members
  • Pip
  • 2 posts

  • Flag: ---------

  • Favorite Pinball: LOTR

Posted 20 November 2020 - 04:46 AM

Got the basic demo scenario fired up, and played around with the demo table a bit. Works great.

 

Now I want to go to the next level and take an existing table -- Meteor in this case -- and start wiring up mpf there. I have the Meteor table initially firing up, so Controller, etc., are wired up to some degree. However, it seems certain calls it makes through the bridge fail and kills the table.

 

E.g., sending "set_switch" pukes with the error "'NoneType' object has no attribute 'send'". (Saw a similar error for changed_lamps until I commented out that call in visual pinball.)

 

It seems like that, for whatever reason, bcp_client in the bridge is "None"...I 'm not sure how that would happen given the below and that some other commands like start seem like they are issued early on. Any ideas? I'm running everything as admin (visual pinball, mpf, bridge registration). I wasn't seeing any meaningful logs in event viewer and in general poking around.

 

    def _connect(self):
        """Connect to MPF."""
        try:
            reader, writer = self.loop.run_until_complete(asyncio.open_connection("localhost"5051))
            self.bcp_client = AsyncioBcpClientSocket(writer, reader)

 

    def _dispatch_to_mpf(selfcommand**params):
        """Dispatch to MPF and wait for result."""
        params["subcommand"= command
        try:
            self.bcp_client.send("vpcom_bridge", params)


#10 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 20 November 2020 - 06:38 PM

Hi Joetechbob,

 

just send me a PM with a link to Your MPF folder and the VPX table, You want to link. I will have a look.

Your code screenshots are not meaningful to me in any way, unfortunately.

 

We will sort this out.

 

Regards

Michael



#11 joetechbob

joetechbob

    Neophyte

  • Members
  • Pip
  • 2 posts

  • Flag: ---------

  • Favorite Pinball: LOTR

Posted 21 November 2020 - 04:01 AM

Thanks!

 

Hi Joetechbob,

 

just send me a PM with a link to Your MPF folder and the VPX table, You want to link. I will have a look.

Your code screenshots are not meaningful to me in any way, unfortunately.

 

We will sort this out.

 

Regards

Michael



#12 Edenecho

Edenecho

    Neophyte

  • Members
  • Pip
  • 3 posts

  • Flag: Norway

  • Favorite Pinball: Medieval madness

Posted 01 February 2021 - 11:29 PM

/Ignore, got it working!


Edited by Edenecho, 02 February 2021 - 12:18 AM.


#13 legtod2

legtod2

    Enthusiast

  • Silver Supporter
  • 409 posts

  • Flag: Canada

  • Favorite Pinball: Mystic

Posted 24 February 2021 - 04:25 PM

I have begun my journey with MPF to re-theme a Williams Phoenix pinball machine.

 

Going to use the new Cobrapin Pinball Controller and MPF. Have to wait till june or latter til my cobra device is available.

 

As an interm, going to use the vpx - mpf bridge to give me experience in tweaking MPF to do what I want.

The hope is the bridge will enable me to build my mpf game machine and learn MPF better.

 

Created my Linux laptop development machine that will host a Virtual MPF debian machine.

 

Going to start a thread on pinside,com to note the progress but hope I can call on your experience to guide me on my journey.

 

Alternatively I could add a 2nd virtual machine on the laptop running vpx and my Phoenix table.

 

At the end of the day the hope is VPX will emulate the real machine via the mpf bridge and help me learn mpf and coding for the new real machine.



#14 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 24 February 2021 - 05:33 PM

Hi legtod2,

 

this is exactly what I had in mind, building the bridge. I only started with my hardware build once I had the rules running in MPF. 

The CobraPin is a great device, as far as I can say and Thomas is always helping with advice.

 

Good luck with Your build.

 

Michael



#15 legtod2

legtod2

    Enthusiast

  • Silver Supporter
  • 409 posts

  • Flag: Canada

  • Favorite Pinball: Mystic

Posted 08 April 2021 - 05:56 PM

I hope you can clarify something for me. I have my mpf config all done and working nicely.

 

To test mpf and vpx bridge I have a laptop that has my debian linux virtual machine and my cabinet pinball machine.

 

I'm assuming a serial port connection between the cabinet pinball table and debian virtual machine running mpf is established via a usb cable connected between the two machines.

 

Or is it a tcp port connection between the two boxes.

 

for the vpx to mpf bridge to work what is the physical connection between the two (USB cable or tcp port connect)



#16 mfuegemann

mfuegemann

    Pinball Fan

  • VIP
  • 1,222 posts
  • Location:Cologne

  • Flag: Germany

  • Favorite Pinball: Medieval Madness, Fast Draw



Contributor

Posted 08 April 2021 - 08:57 PM

Hi legtod2,

 

VPX and MPF must be started on the same computer. VPX is using the local MPF as controller device.

So, to run MPF with VPX You have to use Windows and install MPF there, unfortunately.



#17 legtod2

legtod2

    Enthusiast

  • Silver Supporter
  • 409 posts

  • Flag: Canada

  • Favorite Pinball: Mystic

Posted 08 April 2021 - 10:06 PM

Michael,

 

 

I am using a vp9 table phoenix.







Also tagged with one or more of these keywords: Visual Pinball, Tutorials