Code/Example BAM Simulate Spinners and Gates with BAM

Coding and examples for future Pinball and BAM

Wecoc

Pinball Wizard
Joined
Dec 7, 2021
Messages
63
Reaction score
100
Points
40
Favorite Pinball Machine
Cirqus Voltaire
Using BAM's ball control functions, you can make Toys that recreate Spinners or Gates pretty convincingly.

This allows some things that weren't possible without it:

- Spinners and Gates that don't reduce all the ball's momentum and don't get stuck / permanently horizontal
- Spinners with transparency and sphere mapping
- Gates with transparency
- Spinners with half-spin control (see explanation below)
- Customizable damping types, and Gates with Spinner-like damping
- Spinners and Gates with variable effect based on fpBallID or other parameters
- Spinners and Gates that lit when they are moving or active (using a color change)
- Spinners that rapidly change texture when spinning, to create a shiny/reflective effect (example).
- Gate-like objects with other angles (floor gates, saloon doors…)

Also, although this was possible without BAM, this mechanism allows implementing more easily Gates with non-permanent "One-Way" and/or "Way switch" functionalities, and also extend that to Spinners if needed.

Back in 2013, I did implement this very roughly (without BAM, and using some extra triggers/timers) on a non-published pinball. The idea is simple: the spinner is vertically symmetrical and can end its rotation with either face facing the player. The table tracks that, and uses it for multiple effects.

In this Demo you will find a chrome Spinner with sphere mapping, a half-spin Spinner, and a transparent plastic Gate.
 

Attachments

  • SpinnerToysDemo.fpt
    398 KB · Views: 36
I remember toys as Spinners. But a while ago Rav came up with code for those so no more toys needed.

See here
 
I remember toys as Spinners. But a while ago Rav came up with code for those.
I knew about that. I should have included the link in my post, sorry :|
Of course, in simple cases, that solution is the best. With the help of that code, default Spinners work a lot better on BAM than on vanilla FP.

I made this because for some of those more specific listed cases you still need a Toy, but the Spinners and Gates in my demo use some BAM features that weren't a thing in the early "Toy as Spinner" days. My code applies the ball's force and direction into the Toy to calculate the number of spins and bounces. The original "Toy as Spinner" didn't bounce back, so it was very stiff. It also required extra triggers and timers to read where did the ball come from and how fast was it going. With the help of BAM, this new one is easier and closer to the real deal.
 
I wasn't even looking at fp on those days :D
I do remember coming across those on 1980 Black Knight from Slamt1lt though The code was a lot simpler than the one you posted if I recall correctly.
 
Yep, that's the one. That spinner has only one speed, it always spins the same direction, and it doesn't bounce back. Now we can do much better! :-)
 
Which was why I substitute them for the normal spinners at the time. It could be because I did not understood the code at the time, though :D
 
Thanks for this.
 
Last edited:
it's not the first time i see this strange things, but from wich category you put your spinner Model?
I don't have only "Toy" Category in FP editor
 
Toys if I remember correctly were a special thing.
They had to be copied from a table that already had them. Not sure if true for all toys but I recall something like that
 
So who succes to make that and how?
 
Yes, to get a toy into your table, copy it from a table that already has one. I often use the pinball Cyclone. Or in this case if you want this spinner in your table you can simply copy it, import the model, and also copy the code.

The first toy comes from someone who had the Dev version of the software years ago, which wasn't public, so everyone else does it this way.
 
Thanks for your answer.... Shame that nobody have this Dev version 😅

By the way, i like your Spinner and Gate. For the behaviour, the tuning, and the customisable side of it.
 
On my side, I use the Diverter Category for my own model. This is the only category with wich you can detected object automaticaly with there name and use material and setmaterial for all you want to do
 
I'm using the spinner toy right now. very nice. For gates, i'm just going to use a wall, like the one way/two way setup, but they all work terrific. Big improvements the last couple years.
 
I have to try the spinners in particular. Even if for the sake of avoiding Newtonphysicstick it's worth it.
 
@ Wecoc
Quick question, it appears the timer for the spinner is always on, was that intentional?

There's no music code for the spinner, but this is the best place so far I have seen so you have a repeating sound everytime the spinner does a full rotation:
In Sub ApplySpinner1fpx1ToyForce(ByVal DampingType)
Code:
        If (Abs(Spinner1fpx1ToyForce) > 100) Then
            ' Spin full loop
            IF Spinner1.State = BulbOn THEN
               ' Music/Sound for "spinneron"           
            Else
                 ' Music/Sound for "spinneron"                         
            END IF
 
Quick question, it appears the timer for the spinner is always on, was that intentional?
Nope. In my demo I don't think they are enabled by default, they should only be activated while the spinner or gate is spinning. If that's not the case, it was an oopsie :no:

For the sound, there are some available options.
I would probably add a little spin sound on every full loop. On the example I included AddScore(1) instead. The script has comments about that.

Another option would be using a music that loops, a bit like the motor for classic flippers, but in this case it's just a spinner effect.

Finally, another option is using a single sound at the very start of the spinning (in the trigger hit), but with variants or changing its volume depending on the force of the ball (and therefore, the number of spins).
 
I guess it's a oopsee then. :)

I put a sound file in the timer, so it plays that one sound, and it never stopped.

My sound code is in Sub ApplySpinner1fpx1ToyForce(ByVal DampingType) because it's a fpxEngine thing. Your other idea sounds great (pun) would be great.

I got it all working in fpx, the next bit is to see if I can add the half spin code so it's selectable with a variable between full spin and half spin. I have been playing a little bit with your code because one of the things with fpx is to make it as easy as possible to duplicate the code so I can have multiple spinners at once. That way I can have a different setting for each spinner, and with custom scoring code selectable have different scoring setups like the spinner from Paragon as a example.
 
Just added a new spinner to Silent Hill using this. Works great. Much easier than the older methods I've seen used before by SLAM and others on older tables... and allows me to use a spinner without worrying about it getting stuck (Sonic), or worry that it will stop the ball in place, etc.

Thanks for the example table.
 
Is any soul able to create a T2 spinner model?
T1 is rather small.

Thanks in advance.
 
just use fpm editor to change category
 
I know I can use fpm editor to extract the ms3d. I can install milkshape too but is useless because I don't know how to use it. Last time I tried took me hours to just use scale one damn flipper.

I'm sure anyone versed in this can do it in 5m hence my pledge :)
 
@Wecoc

I got a table with two spinners in which I tried your code.

The left spinner has no problems but the right one I noticed it renders the "wire" through the "blade" like you can see in the image attached.

Any ideas on why? I also use the same texture as I use on the left spinner.

Cosmic Princess v1.5.1fpt.png
 
Yes, this is a well-known bug with Toys in general. Sometimes they render incorrectly, I'm not sure why.
Luckily, it's very easy to fix: Set the toy offset to a non-zero value in the editor, and then change it back in the Script using the Ty parameter.

In the Demo, the Spinner has an Offset of 100 but the script includes this which gets it back in place:
Code:
SpinnerToy.Ty = 38 ' Toy Model Offset Bugfix
 
I noticed that while implementing the code about the height line so I left the GUI offset field at 0. That was 2 weeks ago and only now do I notice it renders badly.

Both have the same settings but just in case I did change the offset to 100 in the GUI on both and sure enough, the problematic spinner now renders correctly and has no change to the left one.

Thanks.
 
Forum activity
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Mibs Mibs: Pop Bumper Pete has posted a new reply in the thread "Post interesting videos you found on YouTube".
      Back
      Top