2/9/2015 – GenPyCode and PinballFramework

The Frankenstein Sharpe Shooter 3 machine is slowly coming alive.  Stealing parts from multiple types and multiple brands of machines is starting to make things difficult for me.  The lockdown bar didn’t quite fit properly, so I needed to modify it a little bit.  That has been completed, but then adding the shooter rod, it seems that Gameplan used a different length of shooter rod than Williams.  (Why???).  I mounted the lockdown bar a little too low in the cabinet, so now I’m going to have to remount it about 1/4 inch higher.  (The good part of that is that I can now mount the flipper buttons, and stop using an electrical junction box to press the flippers).

I stole most of the “rules” running in the game from Joe’s Blue October demo I did over a year ago.  That uses coin drops and presses of the start button to start a game.  Ooop, I don’t have either of those switches hooked up, so I can’t start the game at this point.  Little things like that keep popping up like moles and you just have to keep knocking them down.

A lot of time has been put into GenPyCode the last few weeks. For that one person that is actually reading this and has not been following, the GenPyCode Python program takes a rules file and converts it into Python classes that are then run using the PinballFramework. It takes much of the grunt work out of creating the necessary classes to run the individual pinball machine rules.

I’ll eventually write up a document on the rules file, but a lot of it is self explanatory.  The solenoid section describes how many solenoid cards are in the system and their configurations.  The input cards (switch inputs) section describes the number of switch input cards and their configurations.

GenPyCode is now passed a parameter with the output directory to put the generated files.  In my case, the command line used is:

python GenPyCode.py -rulesFile=ss3rules.txt -outDir=SS3

This uses the ss3rules.txt input file and stores the output in the SS3 directory.  Previously, the generator always used the same output directory and input file name, but it is useful to be able to work on rules for multiple machines at the same time.

The files in the SS3 directory are then moved into the PinballFramework directory to be run by the pinball machine.  The pinball framework has been modified to support multiple rulesets.  Here is my current command line for the pinball framework and SS3:

python PinballFramework.py -port=COM1 -simWidth=854 -debug -rulesDir=SS3

-port=xxxxx Lists the serial port used by the solenoid/input cards.  If this parameter is blank or does not exist, the framework will disable serial communications.  This is very useful since I’m not sitting at the pinball machine most of the time when I’m writing the rules.  Instead, I’m simply simulating the switch inputs, etc.

-simWidth=854 Simulation width of the screen.  The pinball machine runs in full screen mode, which makes it nearly impossible to develop.  Using the simWidth parameter, the LCD screen is scaled down, and a menubar is added so that it can easily be moved around.

-debug Creates the debug window which contains all of the solenoids, input switches and LEDs.  By pressing buttons in the debug window, switch inputs and solenoid inputs can be simulated.  The one problem with the debug window is that it does not have a scrollbar on the side.  SS3 has 2 solenoid cards, 2 switch input cards and 6 LED driver boards.  The debug window is too tall, and the bottom LED boards can’t be seen.  That’s probably going to be the next thing that I fix.

-rulesDir=yyyyy Directory location of the GenPyCode generated files.  It also contains the rulesFunc.py which fills out the logic for the game.  (The generator creates an empty shell for this file called rulesFunc.py.gen).

Joe gave me a bunch of great LCD screenshots which have been integrated into the attract mode on the backpanel.  In attract mode it cycles through the images which is really the first time “rules” are being run on the machine.

Lightbulbs are now brighter than I was expecting.  I’m guessing that I was shorting a 5V to ground through the rotisserie.  (There were a bunch of bulb sockets that were very close to the angle aluminum of the rotisserie.  I thought I threw enough non-conductive foam in there to isolate it, but it seems like I didn’t).  I put the playfield into the cabinet and lit it up using incandescent bulbs and it looks spectacular (in an early 80s sort of a way).  I now believe my calculations that 5VDC on incandescent bulbs are brighter than 6.3VAC on the bulbs which is what the math says.  The LED bulbs are still going to be great in the inserts to make those really pop.  (The mode inserts are a really dark purplish color which is going to mask a lot of the light).

There is a flipper issue when double flippering.  It is drawing too much currrent and shutting down one of the power supplies.  I believe that I have a fix, but don’t have the parts to make it happen.  I need to make a mouser order and get the stuff needed to fix that.

Next up is working on the getting all the lights firing as expected.  That will make the attract mode that much more exciting.  The LED functions also need to have better support for multiple cards.  (Right now they support only four cards, but since SS3 has six LED cards in it, the passed parameters need to move from a single parameter to passing in lists.)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s