November 01, 2024, 02:34:30 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Buzzy Bee Redemption Game--Prop-2 program

Started by jukingeo, April 14, 2010, 09:32:00 PM

Previous topic - Next topic

JonnyMac

The Hydra Gaming book is by Andre LaMonthe -- you can find it on the Parallax web site.
-- http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/hydra/List/0/SortField/4/ProductID/474/Default.aspx

If you have an SX-Key or Blitz you can reprogram the new RC-4 to do whatever you like.  The code we use now is simple (i.e., not multi-tasking), but we put a 50MHz oscillator on the new board to give you the bandwidth to do that should you desire.  Many customers wrote unique code for the FC-4, we figured they'd want to do the same with the RC-4 so we accommodated it.
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Ok, thanx Jon for the info!

I got the confirmation from John for the order of the Prop-1 I ordered so I probably will be posting 'future' redemption games there.  Like I said, yesterday I was at CEC with my kids and I took some careful notes of the operation of many of the redemption style games there, and surprisingly about 85% to 90% could be handled by a Prop-1.   Sure there were exceptions such as a Simpson's redemption game called "Kooky Carnival".  The game was made by Stern, a pinball mfg. , so I know that game was probably handled much in the same way they handle their pinball machines.   The Propeller/Hydra can do it for sure.

Here are some pictures of it:

http://www.sternpinball.com/images/Kooky3D.jpg

Playfield only:

http://www.sternpinball.com/images/Kooky3DPlayfieldsmall.jpg

This was probably one of the more advanced games there which has the dot matrix display and clearly has some evidence of multi-tasking going on.   Some of the other "advanced" games look like they could be handled by a single threaded program and should be easily handled by the BS-2.   But by and large most of the games are ridiculously simple such as one in which you insert your token and it rolls down a chute and is launched from the chute at a constantly rotating wheel.  The wheel has different width slots and naturally the narrower the slit, the more tickets are paid out.  Thus the game really has only one electronically rotated part (with exception of the ticket dispenser).    Once I get the Prop-1, I probably will write a program for that along with some of the other games I have seen.

Geo

bsnut

I have worked on some of your code and tested it. I had no problems with scanning the switch, chasing the lights and doing the "score", just like you wanted. This was easy ;D. Remember this outline will need to be used to count the "coins" in and chase your lights when the game is not running. This program format only used 27% of space in the EEPROM. So your whole promgram should use no more than 70% of the EEPROM.

The chasing lights part is done in a subroutine, which is called from the "main" label and "score" label, these two labels I use for counting up  the timer.

I used K1 on the RC4 for your "fan motor" %1011  and the rest for the lights, so when your game stops it should look something this %1010. Just remember that K1 in your pattern %0000 (K4=bit3,K3=bit2,K2=bit1,K1=bit0) is on the far right hand side.
William Stefan
The Basic Stamp Nut

bsnut

April 23, 2010, 02:08:23 AM #18 Last Edit: April 23, 2010, 02:20:48 AM by bsnut
I have worked on your code and here it is. This was easy  ;D. This program only used 64% of space in the EEPROM. I will be testing it later on today.

'   File.......Prop1 Buzzy Bee Redemption Game
'   Author.....W. Stefan
'   E-mail.....
'   Started....
'   Updated....
' {$STAMP BS1}
' {$PBASIC 1.0}
' -----[ Program Description ]---------------------------------------------

' This program mimics the operation of the Buzzy Buzzy Bee redemption game.
' The Buzzy Bee game centers around catching ping pong balls that are circ-
' ulated around an enclosed tank via a fan. The ping pong balls are striped
' yellow and black to mimic 'bees'.  You catch the floating bees using a
' plastic 'net' on a long shaft that is connected via a universial joint like
' mount that has a handle on the outside of the cabinet.  The caught 'bees'
' are placed in a honey jar container that is on the left side of the play
' area.  The score is incremented for each 'bee' caught.
'
' The game is run on a timed basis which starts after a coin is inserted.
' Music plays in the background as the game is in progress. When the time
' is complete the fan shuts off, the lights turn off, and the music stops.
' Finally a ticket dispenser pays out a number of tickets based ON the
' final score. The game then enters an 'attract' mode awaiting another coin.

'

' Note: The light flash pattern is different for attract v.s. game play.

' RC4 relay bit patterns for SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
' relays = K4:Cabinet Lamp1, K3:Cabinet Lamp2, K2:Cabinet Lamp3, K1:Fan Motor
'           |                 |                 |                 |
'  +--------+                 |                 |                 |
'  |+-------------------------+                 |                 |
'  ||+------------------------------------------+                 |
'  |||+-----------------------------------------------------------+
' %1001 This is relay pattern used in the LOOKUP Command
'INPUTS
'--------------------------------------------------------------------
SYMBOL TriggerB = PIN0       ' Score Increment
SYMBOL TriggerC = PIN1       ' Coin Slot


'OUTPUTS
'--------------------------------------------------------------------
SYMBOL CoinIns  = 2          ' Insert Coin LED (lamp) OUT2 - +V
SYMBOL ScoreInc = 3          ' Scoreboard increment pulse OUT3 - +V
SYMBOL Ticket   = 4          ' Ticket Dispenser OUT4 - +V

'RC-4/AP-8 SERIAL I/O
'--------------------------------------------------------------------
SYMBOL Sio     = 7               ' no ULN or SETUP

'CONSTANTS
'--------------------------------------------------------------------
SYMBOL TickInc = 5           ' Ticket point award.

'VARIABLES
'--------------------------------------------------------------------
SYMBOL timer   = W0
SYMBOL score   = B2
SYMBOL chase   = B3            'LOOKUP Pointer
SYMBOL relays  = B4
SYMBOL tickout = B5
SYMBOL Baud    = OT2400
SYMBOL Addr    = %00

'EEPROM DATA
'--------------------------------------------------------------------

'INITIALIZATION
'--------------------------------------------------------------------
Reset:
SEROUT Sio, Baud, ("!RC4", %00, "x")
SEROUT Sio, Baud, ("!AP8", %00, "x")
score = 0
timer = 0

'PROGRAM CODE
'--------------------------------------------------------------------
Main:
  GOSUB Attract_Update_RC4
  PAUSE 250
  IF TriggerC = 1 THEN Start_Game_Music
  GOTO Main

Start_Game_Music:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0) '

Run_Game:
  IF timer = 480 THEN Ticket_Payout
  GOSUB Run_Game_Update_RC4
  PAUSE 250
  timer = timer +1
  IF TriggerB = 1 THEN Score_Keep
  GOTO Run_Game

Score_Keep:
  PULSOUT ScoreInc, 50
  score = score + 1
  DEBUG score, CR
  GOSUB Run_Game_Update_RC4
  PAUSE 250
  timer = timer +1
  GOTO Run_Game

Ticket_Payout:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 7) ' Play chime as ticket pays out
  FOR tickout = score TO 0                ' Ticket Payout
    PULSOUT Ticket, 50
    PAUSE 1000
  NEXT
  GOTO Reset

'SUBROUTINES
'--------------------------------------------------------------------
Attract_Update_RC4:
chase = chase + 1 // 5                       ' Update cabinet light chase
  LOOKUP chase, (%0010, %0110, %1110, %1100, %1000), relays
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
  RETURN

Run_Game_Update_RC4:
chase = chase + 1 // 3                      ' Update cabinet light chase
  LOOKUP chase, (%1101, %1011, %0111), relays
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
  RETURN
William Stefan
The Basic Stamp Nut

bsnut

April 23, 2010, 12:52:33 PM #19 Last Edit: April 23, 2010, 12:56:28 PM by bsnut
I tested your code and works, but you will need to change FOR/NEXT loop to FOR tickout = 0 TO score. Also, I turned off your chasing lights and fan motor at beginning the "Ticket Payout" label. 

Ticket_Payout:
 SEROUT Sio, Baud, ("!AP8", %00, "x")
 SEROUT Sio, Baud, ("!AP8", %00, "P", 7) ' Play chime as ticket pays out
 FOR tickout = 0 TO score                ' Ticket Payout
   PULSOUT Ticket, 50
   DEBUG tickout, CR
   PAUSE 1000
 NEXT
 GOTO Reset
William Stefan
The Basic Stamp Nut

jukingeo

April 25, 2010, 10:11:35 AM #20 Last Edit: April 25, 2010, 10:23:00 AM by jukingeo
Hello BSnut,

LOL, I had to laugh considering last night I hooked up my Prop-1 (which I just received last week) and I refined the Prop-2 version of the program to work on the Prop-1.   I came up with this program below.  I wasn't able to test it because unlike with the Prop-2  I can't set up the Prop-1 Trainer WITH the RC-4.  In addition I need TWO button switches.  So unfortunately I am going to have to breadboard this one.  However,  I noticed that you posted your version of the program.  So I guess now I can compare them and see the differences between them.

So you said that the program takes up 64% of the memory in the BS-1?  Whew!  The program space is quite limited in then, huh?  I realized some of the limitations too when I was looking over the pre-set variables list.   As the BS-2 doesn't have preset variables, you only have 12 bytes (or 6 Words) to work with on the Prop1 as the last Word (W6) is used for subroutine handling.

It does take a bit of getting used to but I can follow along and last night I was making some rudimentary programs with the Prop-1.    Even though it is much more limited and simpler than the Prop-2, I can see that most control functions really do not need the Prop-2.   But the way I see my progression with using the Prop controllers I think it is going to go like this for me:  Prop-1 (most of my work), Prop-2 (dual prop or medium sized projects), Propeller Chip (the big guns, true multi-tasking).  I am hoping that by the time I get to the Propeller that I could run a small haunt using just one or two chips (if that is possible).

Jon, is there a way to move the later part of this discussion over to the Prop-1 forum?  As of now this is really now diverting to the Prop-1 and it is in the wrong place.   Then just make a link from here to there to tie the two together so this way Prop-2 readers could follow the discussion over there if they like.

Well, here is the program, but again, I have not tested it:

' =========================================================================

'

'   File...... Buzzy Bee Redemption Game.BS1

'   Purpose...

'   Author.... Geo M

'   E-mail....

'   Started...

'   Updated...

'

'   {$STAMP BS1}

'   {$PBASIC 1.0}

'

' =========================================================================





' -----[ Program Description ]---------------------------------------------

' This program mimics the operation of the Buzzy Buzzy Bee redemption game.

' The Buzzy Bee game centers around catching ping pong balls that are circ-

' ulated around an enclosed tank via a fan. The ping pong balls are striped

' yellow and black to mimic 'bees'.  You catch the floating bees using a

' plastic 'net' on a long shaft that is connected via a universial joint like

' mount that has a handle on the outside of the cabinet.  The caught 'bees'

' are placed in a honey jar container that is on the left side of the play

' area.  The score is incremented for each 'bee' caught.

'

' The game is run on a timed basis which starts after a coin is inserted.

' Music plays in the background as the game is in progress. When the time

' is complete the fan shuts off, the lights turn off, and the music stops.

' Finally a ticket dispenser pays out a number of tickets based ON the

' final score. The game then enters an 'attract' mode awaiting another coin.

'

' Note: The light flash pattern is different for attract v.s. game play.



' -----[ Revision History ]------------------------------------------------





' -----[ I/O Definitions ]-------------------------------------------------



SYMBOL  Sio          = PIN7                      ' for AP-8, no ULN or SETUP

SYMBOL  TriggerC     = PIN6                      ' SETUP = DN-Coin Slot

SYMBOL  TriggerB     = PIN5                      ' SETUP = DN-Score Increment



SYMBOL  ScoreInc     = PIN3                      ' Scoreboard increment pulse

SYMBOL  Ticket       = PIN2                      ' Ticket Dispenser

SYMBOL  CoinIns      = PIN1                      ' Insert Coin LED (lamp)

SYMBOL  ScoreClr     = PIN0                      ' Clears Scoreboard



' -----[ Constants ]-------------------------------------------------------



SYMBOL  IsOn            = 1

SYMBOL  IsOff           = 0



SYMBOL  TimerMult       = 6                      ' game timer multiplier 1-6

                                                ' 1 = 10sec, 2 = 20, etc

SYMBOL  TickInc         = 5                      ' Ticket point award. E.G if

                                                ' set to 5, a ticket will be

                                                ' awarded for every 5 points

SYMBOL  Baud            = OT2400



'T2400           CON     396

'T38K4           CON     6

'Open            CON     $8000



'Baud            CON     Open | T38K4





' -----[ Variables ]-------------------------------------------------------



SYMBOL  timer           = W1

SYMBOL  timerloop       = W2



SYMBOL  music           = B6                     ' Set AP-8 to Loop Mode

SYMBOL  chase           = B7

SYMBOL  score           = B8

SYMBOL  tickout         = B9





SYMBOL  relays          = B0                     ' Relay outputs

Cablmp1        VAR     relays.BIT0              ' RC-4.K0

Cablmp2        VAR     relays.BIT1              ' RC-4.K1

Cablmp3        VAR     relays.BIT2              ' RC-4.K2

Fan            VAR     relays.BIT3              ' RC-4.K3



' -----[ Initialization ]--------------------------------------------------



Reset:

 SEROUT Sio, Baud, ["!!!!!!!!AP8", %00, "X", "!RC4", %00, "X"]



 PINS = %00000000

 DIRS = %00011111



 timer = (100 * TimerMult)                   'Timer multiplier

 chase = 0                                     'Set lamp chase start at 0

 score = 0



 GOSUB All_Off





' -----[ Program Code ]----------------------------------------------------



Main:

 CoinIns = IsOn                                ' Turn on Coin Insert Lamp



Attract:

 IF (TriggerC = IsOn) THEN Run_Game            ' while waiting for coin



 chase = chase + 1 // 5                        ' Update cabinet light chase

   LOOKUP chase, [%001, %011, %111, %110, %100], relays

   GOSUB Update_RC4

 GOTO Attract



Run_Game:

 CoinIns = IsOff                               ' Turn off Coin Insert Lamp

 PULSOUT ScoreClr, 50                          ' Clears Scoreboard

 chase = 0                                     ' resets chase lights



 music = 0                                     ' Plays Music Clip at "0"

 GOSUB Play_AP8



 Fan = IsOn                                    ' Turn On Fan

 GOSUB Update_RC4



 FOR timerloop = timer TO 0 STEP - 1           ' Main timer loop

   IF (TriggerB = IsOn) THEN GOSUB Score_Keep  ' Update score

   chase = chase + 1 // 3                      ' Update cabinet light chase

   LOOKUP chase, [%110, %101, %011], relays

   GOSUB Update_RC4

   PAUSE 100

 NEXT



 Fan = IsOff                                   ' Turn Off Fan



 GOSUB Stop_AP8



 Music = 7                                     ' Change To Chime



 GOSUB Play_AP8                                ' Play chime as ticket pays out

 FOR tickout= score TO 0 STEP - TickInc        ' Ticket Payout

   PULSOUT Ticket, 50

   PAUSE 1000

 NEXT

 GOSUB Stop_AP8                                ' Shut down audio



GOTO Main                                      ' Rinse & Repeat





' -----[ Subroutines ]-----------------------------------------------------



Play_AP8:

 SEROUT Sio, Baud, ["!AP8", %00, "P", music]

 RETURN





Stop_AP8:

 SEROUT Sio, Baud, ["!AP8", %00, "X"]

 RETURN





' -------------------------------------------------------------------------



Update_RC4:

 SEROUT Sio, Baud, ["!RC4", %00, "S", relays]

 RETURN



' -------------------------------------------------------------------------



All_Off:

 OUTS = $0000

 relays = %0000

 GOSUB Update_RC4

 RETURN



'--------------------------------------------------------------------------



Score_Keep:                            ' Update Score routine



 PULSOUT ScoreInc, 50

 score = score + 1

 RETURN





' -----[ EEPROM Data ]--------------------------------------------------

JonnyMac

Geo,

No, I cannot move a part of a discussion to another forum -- you should conclude this one and start a new thread that is devoted to the Prop-1.
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Quote from: JonnyMac on April 25, 2010, 11:23:51 AM
Geo,

No, I cannot move a part of a discussion to another forum -- you should conclude this one and start a new thread that is devoted to the Prop-1.

Ok, will do.  I should have done so earlier.

Ok, guys, I am going to shift this over to the Prop-1 message board since the topic discussion clearly shifted over to the Prop-1 controller.  So put your answers there.  I am going to post a link back to this thread in case someone wants to 'back read'.  So from here on in the discussion goes back to the Prop-2 version of the program and the Prop-1 version discussion will be in it's proper place.

Thank You,

Geo