Monthly Archives: April 2014

Processing Engine running, 4/27/2014

Spent all my spare time this weekend on getting the rules engine working.  It is now running the code and can change the LEDs, start games, watch balls drain, etc.  It is pretty exciting to simulate a whole pinball game…but, it is only simulated.  I still don’t have the LED engine running, but that is simple in comparison to the rules engine.  The rules engine is using a good number of the standard functions from the macro language which means that many of them have been verified.  In a couple months, I will end up running a verification of all the standard functions to make sure that they are working properly.

The ruleset that is currently programmed is the targeted rules for the backpack pinball machine.  Here’s a quick picture of the simple layout:

SimplePinballImage

Simple Pinball machine from three test cards

I’m going to update the rules set to include a few more features.  The spinner is used to increment a bonus value.  If the inlanes are completed the bonus multiplier is incremented.  If the all the targets are completed, the bonus multiplier is incremented.  If the ball goes in the kickout hole, the bonus is collected.  If the inlanes are completed and targets are completed within a 30 second timer, the bonus is held to the next ball.

One interesting fact about running the real ruleset is that the rules get really angry if the ball can’t be found to start the game.  It means when running the machine, you must remember the order of pressing the switches.  Before pressing the start button, the Ball_In_Play solenoid switch must be closed.  When the game is started, deactivate the Ball_In_Play solenoid and activate the Ball_At_Shooter input.  The game goes to normal scoring mode when it detects the ball going through one of the inlanes.  At that point, the Ball_At_Shooter can be deactivated.  To simulate the ball draining, activate the Ball_In_Play solenoid switch.

Next big thing with the Python pinball framework will be to attach the LED engine so that the LEDs can be automatically strobed.  After that, sounds need to be added back in to get that fully working.  I also haven’t added the scoring back in, except for bonus score for completing the inlanes.

I’m currently adding in Doxygen comments for Python code.  I’ve never used Doxygen for documenting Python code, so I’ve had to spend a good amount of time reworking file and function/class headers to make sure the information is presented properly.

Last time to mention Allentown, 2014.  Just in case you missed the last post, John and I will be attending Allentown on Saturday (5/3/2014) from opening to mid-afternoon.  We will be wearing OPP (Open Pinball Project) T-shirts.  The first person that comes up to either John or I and says, “Give me a free T-shirt”, bam, they get one.  Thanks again to Joe for doing the artwork.

I will probably be doing another code update this week if you are watching the Google code repository.

Advertisements

Allentown, here we come, 4/23/2014

One of the goals was to make Allentown this year.  I think there is going to be a great big check mark for that one.  John and I will be attending Allentown on Saturday morning 5/3/2014.  We are planning on being there around opening, and will probably leave in the mid-afternoon.  Just for jokes, I’m going to run a contest which I doubt anyone will win.  Both John and I will be wearing OPP T-shirts.  (They have both both OPP and Open Pinball Project on the front of them).  The contest is that the first person to stop us in Allentown and say, “hey, give me a free T-shirt”, you get a brand spankin’ new shirt out of my backpack.  (They only come in large or extra large so there you are…those are your choices.)  I fully expect that no-one will read this, so it just means that I have 6 more T-shirts that aren’t spoken for yet.  The T-shirts are supposed to arrive by Thursday of next week, so it is even questionable if they are going to get here on time.  Joe (the most prolific pinball contributor) did the concept and the artwork.  I’ll post a picture…when I receive the shirts which I’m really hoping is on Thursday or Friday of next week.  Enough with the free giveaways, and back to the open pinball project.

This week a ton more python code has been written, and I’m hoping to be able to run a simulated pinball game next weekend.  The debug interface in the previous blog post can be used to simulate inputs, and so a complete game should be able to be “played” and rules verified.  It is based on the simplerules.txt which was originally going to be compiled into Java, but has been hand compiled into Python.  (I will go back and write a python converter eventually, which will simply be translating the Java I’ve written into Python.)

The nice part is that the architecture has held up nicely.  I originally was going to simply rewrite simplerules.txt into straight Python without using the architecture.  I quickly found out, that it was even easier to use the existing architecture that I had set up (processing chains, standard function calls, etc).  That made it super easy and rather quick to translate.  I got most of that translated last weekend, and then wrote a lot of the standard functions this week.

So what is the new goal for the short term?  I’m going back to finishing the mini 12″ x 24″ pinball machine.  The new goal is to have it up and running by the York pinball show which is happily in October this year.  I don’t feel like dragging a whole machine down to York, so why not a full featured mini-pinball machine?  The pinball machine should be small enough that I can throw it in my backpack and pull it out and show some people if they are interested.  The “backglass” will be a 17 inch LCD monitor, but the image on the back will probably be a static image with scores overlaid on top of the image.  The machine will be made on my drill press, because I just don’t have enough time to get a CNC up and running.  The monitor will be driven with the Raspberry Pi will contain one solenoid, one input, and one LED driver board.

Next entry should be about getting the processing engine working.

4/12/2014, More Python

So I’ve mostly been working on the debug window for the python interface.  The idea of the debug window is that it allows a person programming the ruleset to see the current state of the pinball machine.  Comms and the rules can be stepped through one loop at a time, and solenoids can be individually fired to test wiring.  Here is a quick picture of the Debug window and what it looks like:

DebugWin

I’m planning on locking the frame size down a little bit better so the display looks more pleasant, but right now just working on getting the functionality.  Here is a quick walk through of the different frames.

Starting with the top most command frame.  It has choice boxes to either run or single step the rules thread and the communications thread.  The rules thread runs the rules for the pinball game.  During play it would add scores for switches being hit, play sounds, change the mode of the game, turn on/off light bulbs, etc.  The communications thread reads the switch inputs from input and solenoid cards and can send commands to solenoid cards to fire a solenoid or change its configuration.  The last box lists the state of the game such as attract mode, game running, multiball mode, etc.  The mode labels are written by whoever writes the ruleset.

Next section has the cards that are in the system.  The rulesData.py file contains a list of cards in the system.  The python script uses the INV_ADDR_LIST to populate the cards.

The input card lists the name for each of the sixteen inputs.  The debug window can simulate input pulses, or toggling the switch open or closed.  It lists the current status of the hardware card.

The next card is a solenoid card, and switch inputs can be simulated.  An additional pulse solenoid button is available to send a pulse to the solenoid to fire it.

The last card uses the NUM_LED_BRDS to list all the LED boards.  It lists the name of each individual bit, and the current status (on or off) is graphically shown.

That is about all that I have gotten finished this week.  Hopefully I’ll add some more stuff during the week, and actually start talking to the hardware cards.