Initial Python Mockup done

So traveling over to the repository, the latest version has a python mockup for a pinball machine.   The idea is that there is a translite mounted in front of a monitor.  The translite has cutout areas so that the player’s scores, ball count, credits and current player is displayed.  All of these are in static locations so the translite is just a typical translite.  The simulation automatically scales between a mockup size and the full screen size so testing can be done more easily without having the simulation take the whole screen.

When coding it up, I decided that the monitor also needed to include general illumination fake lights to mock up general illumination behind the translite.  To make it clear, I made the general illumination lights appear like circles so they appear just as if they were 44 or 47 bulbs.  If doing it for real, the general illumination lights could be any shape that would make the most sense behind the translite.  The general illumination lights are turned on and off as a group.

Well if you have general illumination, you also need feature lights to highlight whatever needs to be highlighted in the translite.  You need Santa Claus on the backglass to light up when you pick him up in the Taxi.  The feature lights are triggered off simulated inputs.

I threw in a very simple set of rules which essentially contains a way to add credits to the machine, start a game, and drain the current ball.  Up to four players are supported.  When the game is playing, inputs can be simulated to add score to the active player.

It’s not much of a pinball machine if it doesn’t have sound.  When a game is playing, a background song plays continuously.  Inputs can also be simulated to play sounds on top of the background music.

All of the stuff is written using pygame.  I originally was going to use tkinter, but really wanted to support sound.  It has been “optimized” to only redraw (blit) changes in the screen, so it should run very quickly.  I could have cheesed out and redrawn the whole screen, but who knows how fast the Raspberry Pi will be able to draw to the screen.

This should work on a Raspberry Pi, without installing extra modules.  When I get the power supply boards, and the Pi shield in the next couple of weeks, I will try it out, but I’m not in a rush.  My development environment is very simple on a regular PC, so there is no reason to move onto the actual Pi until later.

It is currently only a simulation, so it doesn’t run the serial commands to interface with the input and solenoid cards.  That’s probably going to be the next step.

Here is a quick rundown of how to run the simulation:

Starting it up, you should see the positions of the player scores, and current player and credits/ball num displays.  The following commands (single key presses) are supported.
‘s’ go to sound mode, ‘0’ to ‘9’ will then play a sound (there are only about 5 sounds installed.  Used normally to trigger sound files.
‘i’ simulate input mode, ‘0’ to ‘9’ simulate an input
‘l’ light mode, toggle on/off feature lights, ‘0’ to ‘9’ simulate an change

Starting a game:
‘c’ add a credit
‘g’ start a game
‘d’ drain the ball

Quick walk through:
Start up the program.  Press the ‘s’ key to get into sound mode.  Press a couple number keys to listen to the sounds.  Next press the ‘l’ key.  (That’s an L)  Press a couple number keys and watch feature “lights” toggle on and off.

Now start a game.  ‘c’ gives a credit, and ‘g’ starts the game.  Background music should be playing.  Press ‘i’ to simulate inputs and add score to the player 1.  Press ‘d’ to drain the ball.  Notice the ball num going up.  (it is assume that the translite will have text indicating to the player which window is the ball num/credits and which window is the current player)  Drain enough balls (3) and the game is over.  The background music should stop.  Press ‘esc’ to leave

There is a batch file in the directory that automatically sets the right parameters on a Windows machine.  The command line is:

c:\Python27\python.exe -port=COM1 -simWidth=854 -actualWidth=1366 -debug

Here is a quick screenshot of the simulation.




Leave a Reply

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

You are commenting using your 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