Java, java, java and working on the language

So I drew up a simple pinball machine to verify the scripting language is working.  I always find it easier to try and implement a real example to make sure I have most of the functionality that I need to implement a machine.  Hopefully when you click on the picture, you can see enough of the writing to understand what I’m trying to do.


Simple Pinball machine from three test cards

I populated three of the cards (a solenoid driver, an input card, and an LED driver card).  Here is the quick pinball machine that I drew up to make sure that the machine could be implemented with the “generic” scripting language.  I’ve spent the last few days trying to write up the script for this machine to make sure that I have everything that I need.

If you currently grab the newest stuff from the repository, the java code resides under the Eclipse directory.  VLC needs to be installed on the base machine, and in the build_notes.txt file it lists the flags that need to be handed into the VM and handed to the base class to start the pinball application.  Right now it simply runs two different movies, one after the other and repeats.  If you press the ‘s’ key, it swaps to the other movie.  If you press the ‘x’ key, it exits.  I did this to verify that I could swap between movies quickly enough during game play.  I’m happy with the response on my PC (which isn’t the zippiest in the world), but I’m pretty sure it will work well enough on the real hardware.  I will eventually put this all together in a single application.

The script file that I’m working on is named simplerules.txt.  I’m still adding functionality to the script language, but I’m pretty happy with how it is coming out.  Here is some general information about how it will work.

The scripting file is broken down into a couple different areas:  hardware identification,    variables,  modes,  and chains.  (Actually after popping it open, I need to convert all the tabs to spaces to make it look a lot more readable.)  I’ve made all keywords capitals.   (These are reserved words for the scripting  itself.)

Hardware identifies the number of cards in the system, their configurations, and the names used to refer to each of the hardware bits.

Variables are broken down to single variables (one per pinball machine) and indexed variables.  A good example of an indexed variable is the player’s score in a multi-player game.

Modes are the states of the pinball state machine.  When playing a game, the controller moves between these states and does things differently for each state.  One state might be attract mode which tries to get people to add coins.  Another mode would be press start mode which happens after they add credits.  Then of course there are tons of different modes when a game is being played depending if you are in a multi-ball mode, or a special scoring mode.  These are highly dependent on the game rule set.

Chains are processing chains.  They can alter the mode if something happens, or change LEDs on off, etc.  I’m planning on having multiple chains per mode.  These chains are the init chain, processing chain, video chain, audio chain, and LED chain.  The init chain happens once when the mode is entered.  The processing chain happens every tick (approx 10 or 20 ms).  The video chain allows videos to be streamed during each mode.  (Multiple videos can be in a chain, so it will play one, then the next, then the next, and repeat that chain.)  The audio chain allows songs to be streamed.  The LED chain allows a series of LEDs in a certain sequence.  All attract modes use something like this, and most modes like multi-ball would use something like this.

Well that is the idea behind the script.  Hopefully by the end of the weekend, I will have finished the rule-set for the simple pinball machine.  Next would be coding the java which shouldn’t be that hard, but will probably take a couple weeks.


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