Code/Example Help BAM Timers and variables

Coding and examples for future Pinball and BAM
no i cant get xbam.trails.color x,x,x to take a variable

You need to create a variable for all three values of Red, Green, Blue. Same goes for trail level

Dim Ball_Trails_Level
Dim trail_red, trail_green, trail_blue

'a timer that increases the trail length

Sub Trail_Length_Expired
Ball_Trails_Level = Ball_Trails_Level+0.01
xBAM.Trails.level = Ball_Trails_Level
End Sub

'a sub just for changing the colour by names

Sub Change_Trail_Colour(colour)
if colour = "red" then trail_red = 255: trail_green = 0: trail_blue = 0
if colour = "green" then trail_red = 0: trail_green = 255: trail_blue = 0
if colour = "blue" then trail_red = 0: trail_green = 0: trail_blue = 255
xbam.trails.color trail_red, trail_green, trail_blue
End Sub

Ball_Trails_Level = 0.1: Trail_Length.set True, 10
Change_Trail_Colour "red"
xBAM.Trails.enabled = true

you can change the r,g,b variables individually if you want through other events, timers, etc.
 
Last edited:
Hi.....if this helps, I'm the only one using this feature so far!

 
Hi.....if this helps, I'm the only one using this feature so far!


You're not the only one using it :)

I normally hate Ball Trails, but I use them for "effects" on occasion. For Sonic Pinball Mania, I have ball trails used when you get Sonic Shoes... and with MOTU CE (wip), I used them for Orko Shots when the ball gets transported with magic, etc.
 
You're not the only one using it :)

I normally hate Ball Trails, but I use them for "effects" on occasion. For Sonic Pinball Mania, I have ball trails used when you get Sonic Shoes... and with MOTU CE (wip), I used them for Orko Shots when the ball gets transported with magic, etc.
Not trails, particle effects. Sounds more advanced 🙂
 
You need to create a variable for all three values of Red, Green, Blue. Same goes for trail level

Dim Ball_Trails_Level
Dim trail_red, trail_green, trail_blue

'a timer that increases the trail length

Sub Trail_Length_Expired
Ball_Trails_Level = Ball_Trails_Level+0.01
xBAM.Trails.level = Ball_Trails_Level
End Sub

'a sub just for changing the colour by names

Sub Change_Trail_Colour(colour)
if colour = "red" then trail_red = 255: trail_green = 0: trail_blue = 0
if colour = "green" then trail_red = 0: trail_green = 255: trail_blue = 0
if colour = "blue" then trail_red = 0: trail_green = 0: trail_blue = 255
xbam.trails.color trail_red, trail_green, trail_blue
End Sub

Ball_Trails_Level = 0.1: Trail_Length.set True, 10
Change_Trail_Colour "red"
xBAM.Trails.enabled = true

you can change the r,g,b variables individually if you want through other events, timers, etc.
I knew you would answer this
My using it for a special effect as well maybe if I can get the other partnof it working
That’s changing balleffects on the fly from point a to point b. Automated so it can be used anywhere on a object_hit()
 
I knew you would answer this
My using it for a special effect as well maybe if I can get the other partnof it working
That’s changing balleffects on the fly from point a to point b. Automated so it can be used anywhere on a object_hit()
Rag give the command references but not all of them have examples and being a newbie to all this Advanced scripting is hard. However I think I’m catching on rather quickly.
 
Oh, you want to make particle effects that follow the ball! I finally understand the meaning behind this topic.
Making particle effects on Future Pinball is not hard, here's a little tutorial for you: [Link to Never Gonna Give You Up]

Just kidding, here are some things that may help, I won't build the whole thing, but hopefully it will be a step to the right direction.

1. The Sun​

First, I want to start with the basics; how to make a glowing ball.

To do a ball like that, you need a Flasher with a custom model that's just the ball but slightly bigger, so it wraps it (you could also make the ball invisible).

particle-tuto01.png


Then all you need to do is follow the ball with the flasher, and turn it on/off on the ball's creation/destruction. Simple enough, right?

Code:
Dim bBallActive

Sub CreateBall()
    bBallActive = True
    FlasherBallExt.SetLitColor  255, 170, 0
    FlasherBallExt.SetGlowColor 255, 170, 0
    PlungerKicker.CreateBall    255, 170, 0
    FlasherBall.State = BulbOn
End Sub

Sub DestroyBall()
    bBallActive = False
    FlasherBall.State = BulbOff
    Drain.DestroyBall
End Sub

Sub DrawFrameTick()
    If (bBallActive = True) Then
        Dim Ball : Set Ball = xBAM.Ball
        FlasherBallExt.SetPosition Ball.Position.X, Ball.Position.Y, Ball.Position.Z, False
    End If
End Sub

particle-tuto02.png


The glow is applied to all other things when the ball moves, so the effect looks pretty cool.

2. Fire​

Foremost, I should say I don't recommend burning your pinball machine on fire.
That being said, it's the easiest particle effect to make, so here it goes.

To make a basic Particle Effect, in this case a 3D fire, the idea is pretty much the same, but using a few "Mini-Suns", or particles. (I will use bulbs instead of flashers so my computer doesn't explode.) Therefore, I require a custom bulb model that's just a small ball. I could even define a TGA texture to it to make it look less spherical, but a simple ball should do the trick. I include 16 in the table, and name them P1, P2, P3... You get the idea. I also use a Timer, always enabled, that will update the particle effect. A normal Timer does the trick absolutely fine.

particle-tuto03.png


I make a Particle Class that defines the index, position, movement, brightness, and randomness for every particle. I also make a ParticleEffect Class that groups those particles in a single entity. This is the most technical part, but it's not as bad as it seems.

Code:
Function MakeRandom(ByVal min, ByVal max)
    MakeRandom = CInt(Int((max - min + 1) * Rnd())) + min
End Function

Const BAM_VERSION = 0

xBAM.CreateAllExt

Class Particle
    ' Basic variables
    Public Bulb, BulbExt, Index
    Public LifeSpan

    ' Parameters
    Public sX, sY, sZ, mX, mY, mZ, sBrightness, mBrightness, Randomness

    ' Define(Particle, Start X, Start Y, Start Z, Move X, Move Y, Move Z, Start Brightness, Move Brighness, Randomness)
    Public Function Define(p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl)
        Set Bulb = p
        Set BulbExt = Eval(p.name + "Ext")
        sX = s_x : sY = s_y : sZ = s_z : mX = m_x : mY = m_y : mZ = m_z
        sBrightness = s_bright : mBrightness = m_bright : Randomness = random_lvl
        Refresh()
    End Function

    Public Function Desv()
        If (Randomness = 0) Then
            Desv = 0
            Exit Function
        End If
        Desv = (Randomness * Rnd()) - (Randomness * Rnd())
    End Function

    ' Set particle to its original position
    Public Function Refresh()
        BulbExt.SetPosition sX + Desv, sY + Desv, sZ + Desv, False
        Index = 0
        LifeSpan = MakeRandom(10, 100)
        BulbExt.GlowBrightness = sBrightness
    End Function

    ' Update the particle
    Public Function Update()
        Index = Index + 1
        If (Index > LifeSpan) Then
            Refresh()
            Exit Function
        End If
        BulbExt.SetPosition BulbExt.X + mX + Desv, BulbExt.Y + mY + Desv, BulbExt.Z + mZ + Desv, False
        BulbExt.GlowBrightness = BulbExt.GlowBrightness + mBrightness
    End Function
End Class

Class ParticleEffect
    Public Particles(), ParticlesLength

    ' Start with no particles
    Private Sub Class_Initialize()
        ParticlesLength = 0
    End Sub

    ' Add a particle to the effect
    Public Function PushParticle(ByVal p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl)
        Dim CurrentParticle
        Set CurrentParticle = New Particle
        CurrentParticle.Define p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl
        ParticlesLength = ParticlesLength + 1
        Redim Preserve Particles(ParticlesLength)
        Set Particles(ParticlesLength) = CurrentParticle
    End Function

    ' Update
    Public Function Update()
        Dim i : For i = 1 To ParticlesLength
            Particles(i).Update()
        Next
    End Function
End Class

Dim Fire
Sub BAM_Init()
    Set Fire = New ParticleEffect
    ' Create a particle effect with 16 particle bulbs called P1, P2, ...
    Dim i : For i = 1 To 16
        Fire.PushParticle Eval("P" + CStr(i)), 257, 197, 0, 0, 0, 0.5, 1, -0.01, 1
    Next
End Sub

Sub FireTimer_Expired()
    ' Update all the particle effects here
    Fire.Update()
End Sub

And this is the result.

particle-tuto04.gif


Since the starting position and the movement of X, Y and Z can be adapted, you could modify this code so the fire follows the ball and the movement is based on its speed and current trajectory. Pretty neat, huh?

3. Fire (Cont)​

What's some fire without smoke, right?

To make smoke, you could update the bulb's colour apart from the brightness. I will make the bulbs visible (semi-transparent) and with a "dark gray" unlit colour. This is where a small custom TGA smoke texture may be handy. Remember with BAM you can even swap textures on certain points of the particle's cycle if necessary.

We use some RGB formulas to convert the lit colour to the unlit colour gradually through the particle's cycle.

Code:
Class Particle
    ' Basic variables
    Public Bulb, BulbExt, Index
    Public LifeSpan, LitColor, UnlitColor

    ' Parameters
    Public sX, sY, sZ, mX, mY, mZ, sBrightness, mBrightness, Randomness

    ' Define(Particle, Start X, Start Y, Start Z, Move X, Move Y, Move Z, Start Brightness, Move Brighness, Randomness)
    Public Function Define(p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl)
        Set Bulb = p
        Set BulbExt = Eval(p.name + "Ext")
        sX = s_x : sY = s_y : sZ = s_z : mX = m_x : mY = m_y : mZ = m_z
        sBrightness = s_bright : mBrightness = m_bright : Randomness = random_lvl
        LitColor = Bulb.LitColour
        UnlitColor = Bulb.UnlitColour
        Refresh()
    End Function

    Public Function Desv()
        If (Randomness = 0) Then
            Desv = 0
            Exit Function
        End If
        Desv = (Randomness * Rnd()) - (Randomness * Rnd())
    End Function

    ' Set particle to its original position
    Public Function Refresh()
        BulbExt.SetPosition sX + Desv, sY + Desv, sZ + Desv, False
        Index = 0
        LifeSpan = MakeRandom(50, 150)
        Dim cR, cG, cB
        cR = LitColor Mod 256
        cG = ((LitColor - cR) / 256) Mod 256
        cB = ((((LitColor - cR) / 256) - cG) / 256) Mod 256
        BulbExt.SetLitColor  cR, cG, cB
        BulbExt.SetGlowColor cR, cG, cB
        BulbExt.Brightness = sBrightness
        BulbExt.GlowBrightness = sBrightness
    End Function

    ' Update the particle
    Public Function Update()
        Index = Index + 1
        If (Index > LifeSpan) Then
            Refresh()
            Exit Function
        End If
        BulbExt.SetPosition BulbExt.X + mX + Desv, BulbExt.Y + mY + Desv, BulbExt.Z + mZ + Desv, False
        BulbExt.Brightness = BulbExt.Brightness + mBrightness
        BulbExt.GlowBrightness = BulbExt.GlowBrightness + mBrightness
        Dim sR, sG, sB, eR, eG, eB ' Start (lit) and end (unlit) color RGB values
        sR = LitColor Mod 256
        sG = ((LitColor - sR) / 256) Mod 256
        sB = ((((LitColor - sR) / 256) - sG) / 256) Mod 256
        eR = UnlitColor Mod 256
        eG = ((UnlitColor - eR) / 256) Mod 256
        eB = ((((UnlitColor - eR) / 256) - eG) / 256) Mod 256
        If (Index > 50) Then
            ' If the index is high simply use the unlit color
            BulbExt.SetLitColor  eR, eG, eB
            BulbExt.SetGlowColor eR, eG, eB
        Else
            Dim dR, dG, dB, cR, cG, cB ' Difference and current RGB values based on the index and life span
            dR = eR - sR : dG = eG - sG : dB = eB - sB
            cR = CInt(sR + (dR * Index / 50))
            cG = CInt(sG + (dG * Index / 50))
            cB = CInt(sB + (dB * Index / 50))
            BulbExt.SetLitColor  cR, cG, cB
            BulbExt.SetGlowColor cR, cG, cB
        End If
    End Function
End Class

particle-tuto05.gif


Someone should call the brigade!

And that's it! I hope it helps ;)
 
Oh, you want to make particle effects that follow the ball! I finally understand the meaning behind this topic.
Making particle effects on Future Pinball is not hard, here's a little tutorial for you: [Link to Never Gonna Give You Up]

Just kidding, here are some things that may help, I won't build the whole thing, but hopefully it will be a step to the right direction.

1. The Sun​

First, I want to start with the basics; how to make a glowing ball.

To do a ball like that, you need a Flasher with a custom model that's just the ball but slightly bigger, so it wraps it (you could also make the ball invisible).

particle-tuto01.png


Then all you need to do is follow the ball with the flasher, and turn it on/off on the ball's creation/destruction. Simple enough, right?

Code:
Dim bBallActive

Sub CreateBall()
    bBallActive = True
    FlasherBallExt.SetLitColor  255, 170, 0
    FlasherBallExt.SetGlowColor 255, 170, 0
    PlungerKicker.CreateBall    255, 170, 0
    FlasherBall.State = BulbOn
End Sub

Sub DestroyBall()
    bBallActive = False
    FlasherBall.State = BulbOff
    Drain.DestroyBall
End Sub

Sub DrawFrameTick()
    If (bBallActive = True) Then
        Dim Ball : Set Ball = xBAM.Ball
        FlasherBallExt.SetPosition Ball.Position.X, Ball.Position.Y, Ball.Position.Z, False
    End If
End Sub

particle-tuto02.png


The glow is applied to all other things when the ball moves, so the effect looks pretty cool.

2. Fire​

Foremost, I should say I don't recommend burning your pinball machine on fire.
That being said, it's the easiest particle effect to make, so here it goes.

To make a basic Particle Effect, in this case a 3D fire, the idea is pretty much the same, but using a few "Mini-Suns", or particles. (I will use bulbs instead of flashers so my computer doesn't explode.) Therefore, I require a custom bulb model that's just a small ball. I could even define a TGA texture to it to make it look less spherical, but a simple ball should do the trick. I include 16 in the table, and name them P1, P2, P3... You get the idea. I also use a Timer, always enabled, that will update the particle effect. A normal Timer does the trick absolutely fine.

particle-tuto03.png


I make a Particle Class that defines the index, position, movement, brightness, and randomness for every particle. I also make a ParticleEffect Class that groups those particles in a single entity. This is the most technical part, but it's not as bad as it seems.

Code:
Function MakeRandom(ByVal min, ByVal max)
    MakeRandom = CInt(Int((max - min + 1) * Rnd())) + min
End Function

Const BAM_VERSION = 0

xBAM.CreateAllExt

Class Particle
    ' Basic variables
    Public Bulb, BulbExt, Index
    Public LifeSpan

    ' Parameters
    Public sX, sY, sZ, mX, mY, mZ, sBrightness, mBrightness, Randomness

    ' Define(Particle, Start X, Start Y, Start Z, Move X, Move Y, Move Z, Start Brightness, Move Brighness, Randomness)
    Public Function Define(p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl)
        Set Bulb = p
        Set BulbExt = Eval(p.name + "Ext")
        sX = s_x : sY = s_y : sZ = s_z : mX = m_x : mY = m_y : mZ = m_z
        sBrightness = s_bright : mBrightness = m_bright : Randomness = random_lvl
        Refresh()
    End Function

    Public Function Desv()
        If (Randomness = 0) Then
            Desv = 0
            Exit Function
        End If
        Desv = (Randomness * Rnd()) - (Randomness * Rnd())
    End Function

    ' Set particle to its original position
    Public Function Refresh()
        BulbExt.SetPosition sX + Desv, sY + Desv, sZ + Desv, False
        Index = 0
        LifeSpan = MakeRandom(10, 100)
        BulbExt.GlowBrightness = sBrightness
    End Function

    ' Update the particle
    Public Function Update()
        Index = Index + 1
        If (Index > LifeSpan) Then
            Refresh()
            Exit Function
        End If
        BulbExt.SetPosition BulbExt.X + mX + Desv, BulbExt.Y + mY + Desv, BulbExt.Z + mZ + Desv, False
        BulbExt.GlowBrightness = BulbExt.GlowBrightness + mBrightness
    End Function
End Class

Class ParticleEffect
    Public Particles(), ParticlesLength

    ' Start with no particles
    Private Sub Class_Initialize()
        ParticlesLength = 0
    End Sub

    ' Add a particle to the effect
    Public Function PushParticle(ByVal p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl)
        Dim CurrentParticle
        Set CurrentParticle = New Particle
        CurrentParticle.Define p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl
        ParticlesLength = ParticlesLength + 1
        Redim Preserve Particles(ParticlesLength)
        Set Particles(ParticlesLength) = CurrentParticle
    End Function

    ' Update
    Public Function Update()
        Dim i : For i = 1 To ParticlesLength
            Particles(i).Update()
        Next
    End Function
End Class

Dim Fire
Sub BAM_Init()
    Set Fire = New ParticleEffect
    ' Create a particle effect with 16 particle bulbs called P1, P2, ...
    Dim i : For i = 1 To 16
        Fire.PushParticle Eval("P" + CStr(i)), 257, 197, 0, 0, 0, 0.5, 1, -0.01, 1
    Next
End Sub

Sub FireTimer_Expired()
    ' Update all the particle effects here
    Fire.Update()
End Sub

And this is the result.

particle-tuto04.gif


Since the starting position and the movement of X, Y and Z can be adapted, you could modify this code so the fire follows the ball and the movement is based on its speed and current trajectory. Pretty neat, huh?

3. Fire (Cont)​

What's some fire without smoke, right?

To make smoke, you could update the bulb's colour apart from the brightness. I will make the bulbs visible (semi-transparent) and with a "dark gray" unlit colour. This is where a small custom TGA smoke texture may be handy. Remember with BAM you can even swap textures on certain points of the particle's cycle if necessary.

We use some RGB formulas to convert the lit colour to the unlit colour gradually through the particle's cycle.

Code:
Class Particle
    ' Basic variables
    Public Bulb, BulbExt, Index
    Public LifeSpan, LitColor, UnlitColor

    ' Parameters
    Public sX, sY, sZ, mX, mY, mZ, sBrightness, mBrightness, Randomness

    ' Define(Particle, Start X, Start Y, Start Z, Move X, Move Y, Move Z, Start Brightness, Move Brighness, Randomness)
    Public Function Define(p, s_x, s_y, s_z, m_x, m_y, m_z, s_bright, m_bright, random_lvl)
        Set Bulb = p
        Set BulbExt = Eval(p.name + "Ext")
        sX = s_x : sY = s_y : sZ = s_z : mX = m_x : mY = m_y : mZ = m_z
        sBrightness = s_bright : mBrightness = m_bright : Randomness = random_lvl
        LitColor = Bulb.LitColour
        UnlitColor = Bulb.UnlitColour
        Refresh()
    End Function

    Public Function Desv()
        If (Randomness = 0) Then
            Desv = 0
            Exit Function
        End If
        Desv = (Randomness * Rnd()) - (Randomness * Rnd())
    End Function

    ' Set particle to its original position
    Public Function Refresh()
        BulbExt.SetPosition sX + Desv, sY + Desv, sZ + Desv, False
        Index = 0
        LifeSpan = MakeRandom(50, 150)
        Dim cR, cG, cB
        cR = LitColor Mod 256
        cG = ((LitColor - cR) / 256) Mod 256
        cB = ((((LitColor - cR) / 256) - cG) / 256) Mod 256
        BulbExt.SetLitColor  cR, cG, cB
        BulbExt.SetGlowColor cR, cG, cB
        BulbExt.Brightness = sBrightness
        BulbExt.GlowBrightness = sBrightness
    End Function

    ' Update the particle
    Public Function Update()
        Index = Index + 1
        If (Index > LifeSpan) Then
            Refresh()
            Exit Function
        End If
        BulbExt.SetPosition BulbExt.X + mX + Desv, BulbExt.Y + mY + Desv, BulbExt.Z + mZ + Desv, False
        BulbExt.Brightness = BulbExt.Brightness + mBrightness
        BulbExt.GlowBrightness = BulbExt.GlowBrightness + mBrightness
        Dim sR, sG, sB, eR, eG, eB ' Start (lit) and end (unlit) color RGB values
        sR = LitColor Mod 256
        sG = ((LitColor - sR) / 256) Mod 256
        sB = ((((LitColor - sR) / 256) - sG) / 256) Mod 256
        eR = UnlitColor Mod 256
        eG = ((UnlitColor - eR) / 256) Mod 256
        eB = ((((UnlitColor - eR) / 256) - eG) / 256) Mod 256
        If (Index > 50) Then
            ' If the index is high simply use the unlit color
            BulbExt.SetLitColor  eR, eG, eB
            BulbExt.SetGlowColor eR, eG, eB
        Else
            Dim dR, dG, dB, cR, cG, cB ' Difference and current RGB values based on the index and life span
            dR = eR - sR : dG = eG - sG : dB = eB - sB
            cR = CInt(sR + (dR * Index / 50))
            cG = CInt(sG + (dG * Index / 50))
            cB = CInt(sB + (dB * Index / 50))
            BulbExt.SetLitColor  cR, cG, cB
            BulbExt.SetGlowColor cR, cG, cB
        End If
    End Function
End Class

particle-tuto05.gif


Someone should call the brigade!

And that's it! I hope it helps ;)

Gimli developed something like the lighted ball you created in your first step. We are using it on Avatar. I believe he attached the halo of a flasher to the ball in some way. It did take a while to make it look like the light came from the center of the ball.
 
Kind of, terry answered this, but I was also looking ad dong something similar.
accept using multipe textures on the ball to do a burning animation.
it wouldnt be for the whole time only for a little bit of time. I would think it may be a heavy load on a lower end pc.
its pastt my october 30 deadline anyways, but Im going to finish it.
Thanks for the cool code and the burning ball, it would be pretty cool.

balltrails were called particle effects in future pinballs manual (I believe) and it sounds so more advanceds than ball trails.
I was being a smart ass when I wrote that. HOWEVER that is really cool ! Thank you, that may work with some tweaking to find a desired effect, then see oif it fite the table. Im debating on addikng to much to a table. i may just stick to texture effects. I have been workming double shifts and banking money before christmas .
again thank you!!!
 
And this is the result.
Wow what a code!!!
I wonder if you are also some kind of programmer or mathematician??
Returning to point 2fire....as far as I can understand
You attacked using MP(mini-playfield) function,16 mini-bulbs to the ball controlled by a timer,ok....but one question....is it on a static ball, or a playable one? one other thing though, I don't see the ball??
 
GeorgeH said:
We are using it on Avatar. I believe he attached the halo of a flasher to the ball in some way.
Yep, very cool effect.

HZR said:
balltrails were called particle effects in future pinballs manual (I believe)
Ah, I see. I've always thought that effect could be improved, though. Maybe being additive (just like the bulb halo) would help... I don't know how hard that is to customize, I've never used that option myself.

Paolo said:
I wonder if you are also some kind of programmer or mathematician??
I'm a programmer, but there are almost no maths involved in that example. These basic particle engines are simpler to implement than it looks. I added comments in the code, and you can see there's nothing too complicated, and since most of the movement comes from randomness there's no hard calculation going on. It can of course be modified to make more complex variants. You could make particles that go fast from the center at a constant direction for each (fireworks, explosions...), and with a clever use of textures (or models?) you could make sparkles, or something that looks more like magic. I guess you could even make a lightning effect, although it's hard to do that convincingly with just a few bulbs.

To make something more similar to an explosion effect, I use the code from the last example, but I assign a fixed random velocity to each particle and apply the effect only once. Thus, for this I only need to change the part where the effect is defined, not the class itself.

I also changed the bulb colors so they go from yellow to red.

Code:
Dim Fire, FireCounter, FireStartDelay
Sub BAM_Init()
    Set Fire = New ParticleEffect
    FireCounter = 0
    FireStartDelay = 700
    TurnFireEffect(BulbOff)
    ' Variant: From Yellow (252, 248, 92) to Red (156, 14, 14), sparse out from the middle
    ' It also uses a fixed bulb in the center, dark yellow (140, 108, 0)
    Dim i, angle, radius, dx, dy : For i = 1 To 30
        angle = MakeRandom(0, 360) * 2 * 3.14159265 / 360
        radius = MakeRandom(2, 4) / 3
        dx = radius * Cos(angle)
        dy = radius * Sin(angle)
        Fire.PushParticle Eval("P" + CStr(i)), 257, 197, 0, dx, dy, 0.01, 1, -0.01, 0
    Next
End Sub

Sub TurnFireEffect(ByVal State)
    ' Change the bulb state of all the particles
    PBase.State = State
    Dim i : For i = 1 To 30
        Eval("P" + CStr(i)).State = State
    Next
End Sub

Sub FireTimer_Expired()
    FireCounter = FireCounter + 1
    If (FireCounter = FireStartDelay) Then
        ' Start effect
        TurnFireEffect(BulbOn)
        PBaseExt.GlowBrightness = 1
        Fire.Update()
    End If
    If (FireCounter > FireStartDelay) Then
        ' Update all the particle effects here (effect is only applied once)
        Fire.Update()
        PBaseExt.GlowBrightness = PBaseExt.GlowBrightness - 0.05
    End If
    If (FireCounter = FireStartDelay + 50) Then
        FireTimer.Enabled = False
        ' Hide all the particles at the end of the effect
        TurnFireEffect(BulbOff)
    End If
End Sub

particle-tuto06.gif


This is just an example on how you would customize this stuff. Be creative! ;)

Returning to point 2fire....as far as I can understand
You attacked using MP(mini-playfield) function,16 mini-bulbs to the ball controlled by a timer,ok....but one question....is it on a static ball, or a playable one? one other thing though, I don't see the ball??

Those codes are just an example with static fire, I didn't implement the ball tracking part. You would do that in the Refresh function; updating there the parameters related to the ball's position (sX, sY, sZ) and movement (mX, mY, mZ). I guess the number of particles visible would also depend on the ball's speed, so it's a bit more complicated, but it's a start.

By the way, there's no Mini-Playfield here. It could be used, but since the lights already have a BAM function to set their position, it's not necessary.
 
I'm a programmer, but there are almost no maths involved in that example. These basic particle engines are simpler to implement than it looks. I added comments in the code, and you can see there's nothing too complicated, and since most of the movement comes from randomness there's no hard calculation going on. It can of course be modified to make more complex variants. You could make particles that go fast from the center at a constant direction for each (fireworks, explosions...), and with a clever use of textures (or models?) you could make sparkles, or something that looks more like magic. I guess you could even make a lightning effect, although it's hard to do that convincingly with just a few bulbs.
HI @Wecoc ,

So you are a programmer ? :-D:-D. What kind of programmer? Software progammer?
So, i would ask something to you. In case you are a Software programmer, should you able to use the FP-addon-SDK?
Nobody still use them to continue to open FP doors.... If you could open new door with that.. There should be a big potential!

I resently ask LvR some new stuff about FPM-editor, as it is written that he is the author of it... But he is not..
So i try to contact Martin Antholzner, wich apparently is one the author... But no success...

Greetings,
JLou
 
Martin was in charge of all 3D objects design. He created for me some missing objects (for old EM).
Try to contact him at VPF ( lio: last seen 22/9/2023).
I'll send you a PM with his mail (well, his 2010's mail...).
 
JLou5641 said:
So you are a programmer ? :-D:-D. What kind of programmer? Software progammer?
So, i would ask something to you. In case you are a Software programmer, should you able to use the FP-addon-SDK?
Nobody still use them to continue to open FP doors.... If you could open new door with that.. There should be a big potential!

That seems a bit out of my ballpark for now, probably I wouldn't get very far. I'm not a software programmer, even if I briefly touched coding from many branches, I fall more into the data engineering side of the spectrum... although with VBA I'm unstoppable 8-) :lol:

I also don't understand exactly what you mean by "open FP doors", or what would you want to change in FPM-Editor. That tool is very complete, and most things you may be able to add (like new collision shapes) couldn't be implemented anyway because FP itself wouldn't support them. It's missing some things, but not much. Of course, there would be some other things that would be cool to implement in FP (like better file management; I'm so tired of adding/removing images one by one) but I wouldn't know where to start with that.

Those links may be handy:
FP Addons SDK on Github
FP Addons SDK - now rebuild table MAC (all three pages are available).

Wecoc said:
This is just an example on how you would customize this stuff. Be creative! ;)
This is getting more and more off-topic. I think I already said everything I had about this, but if someone has ideas for particle effects of this kind (teleport, splash...) but doesn't know how to apply them, I guess I may give it a try :scratchchin:
 
It missed some things on editor.
For exemple, you have only generic rubber material, wood, metal, and plastics... but there is more material in game.... Much more... and it should be more powerfull if we could choose directly material number.

Some FP object have more than 1 collision shape, and in the game, they don't have same material... But in Fpm-Editor, you can't choose material for each Collision Shape...

Also, you can't change orientation of colidable shape, wich could be very usefull for object made with flipper shape function. ( imagine a new kicker wich have a double flipper shape like a slingshot shape 😉... but you can't orientate it in the good angle actually )

The "custom value" in Fpm-Editor, we don't know what it mean, and how it work also.
 
Some FP object have more than 1 collision shape, and in the game, they don't have same material...
Are you sure about that? If you're thinking about Bumpers, it's because they're made with multiple models. I can't think of a single case of a model with multiple materials for each collision.

I have some screenshots that may help.

model-editor01.png

This is a screenshot I made of the FP internal model editor, only available with the dev version of the software. As you can see, I got to open that window in my normal version with a bit of tweaking, but nothing works properly. At least, it can help visualize how models are built.

- The "Material Type of Model" only has four options: Metal, Wood, Plastic, Rubber. It is also applied on the entire model, as I said.
It's true that there are other materials, like playfieldMat, softRubberMat, etc. but they're "special cases". I don't know if by changing the material of an object via code with BAM you can access those, I believe you can recreate their elastic coefficient and other parameters, but you can't set them from an integer as you suggested.

- I don't know what's "Rubber Guide Radius / Special Value", but I'm guessing it's the same as the "Custom value" in FPM-Editor.
When you create a rubber object in your table, you can set its elasticity (Hard, Intermediate, Soft). Maybe when defining a model with Rubber material that special value corresponds to those?

- The "Shadow Casting Model" is new. I believe BAM's dynamic lighting probably knocks that out of the park.

Here are the screenshots of the popup windows. Those make me think there may be some hidden collision shapes, but no rotation.

model-editor02.png
 
yes, i'm sure about that 😉.
I searched for all material correspondance in FP... This is as this moment i find that some object have 2 different materials ( like some Target 😉 )
I don't think about Bumper, i already know how they work since the begining of FizX, and I solved them in same time
 
Are you sure about that? If you're thinking about Bumpers, it's because they're made with multiple models. I can't think of a single case of a model with multiple materials for each collision.

I have some screenshots that may help.

model-editor01.png

This is a screenshot I made of the FP internal model editor, only available with the dev version of the software. As you can see, I got to open that window in my normal version with a bit of tweaking, but nothing works properly. At least, it can help visualize how models are built.

- The "Material Type of Model" only has four options: Metal, Wood, Plastic, Rubber. It is also applied on the entire model, as I said.
It's true that there are other materials, like playfieldMat, softRubberMat, etc. but they're "special cases". I don't know if by changing the material of an object via code with BAM you can access those, I believe you can recreate their elastic coefficient and other parameters, but you can't set them from an integer as you suggested.

- I don't know what's "Rubber Guide Radius / Special Value", but I'm guessing it's the same as the "Custom value" in FPM-Editor.
When you create a rubber object in your table, you can set its elasticity (Hard, Intermediate, Soft). Maybe when defining a model with Rubber material that special value corresponds to those?

- The "Shadow Casting Model" is new. I believe BAM's dynamic lighting probably knocks that out of the park.

Here are the screenshots of the popup windows. Those make me think there may be some hidden collision shapes, but no rotation.

model-editor02.png
okey,
So for material, if you take rubber hard, you have material 23,24,25,26 if i remember right.
23 is when a hard rubber has hitable function like slingshot or leaf rubber
24 is when it's standard,
25, i don't still find when or where it set,
26, it's when rubber is not collidable..

But why it should be usefull?
because i use this in FizX 😉, and should have more possibilty by using material like we want with toy, as toy is the only object with wich we can do everything!

For the custom value case, i know what's for rubber, pegs, bumper... it's for make easier placement in editor ( the purple circle 😉 ),
but for kicker for exemple, i still don't find.

Can i have this Editor ?
 
... the FP internal model editor, only available with the dev version of the software. ...
Where can I get this version of the FP Editor?
 
Nowhere, as far as I know. I also don't have it.

Wecoc said:
As you can see, I got to open that window in my normal version with a bit of tweaking, but nothing works properly.

Basically, by inspecting the Exe file I got to open this window on my normal editor, but it doesn't work; the buttons are like placeholders, since I don't have the requirements to do anything. I only showed it because this way we can see how the default models were built. I will share my modified Exe with both in a private message for if you're still interested, but I don't think it's very useful at this state.

This topic is pure chaos, I apologize to HZR since I kinda threw this train off the rails. (Or I threw this ball off the trails? :bonk:)
 
Where can I get this version of the FP Editor?
A few persons have it (dev version): Obviously Chris, Martin (lio), Steve (but he deleted it when he had a little crash between he and Chris :whistle: ) and maybe James (Greywolf).
 
WOW...
Thank you, Im going to try and get it working.
I has somthing similar pre coded and couldnt figure out how to get the script so future pinball would accept it.
I used ball textures of fire frame by frame instead of lights.
this is more random , cool. thats awesome!
 
your good. I do the same thing when I respond sometimes.
I appreciate you.
 
Thanks Paolo
Hi.....if this helps, I'm the only one using this feature so far!

I understand how to use ball trails, but I wanted a bit more control,
When the ball hits a trigger the trail gets longer then shorter as the ball aproaches the end of a specified point

point a to point b = trail increases then decreases.
translation....
Ho capito come usare le scie della palla, ma volevo un po' più di controllo,

Quando la palla colpisce un grilletto, la scia si allunga e si accorcia man mano che la palla si avvicina alla fine di un punto specifico.

Certainly! Below is an example of how you can achieve this in Future Pinball scripting:

```vbscript
' Define the default trail length
Const DefaultTrailLength = 1.0
Dim BallTrailsLevel
BallTrailsLevel = DefaultTrailLength

' Set the initial trail length
xBAM.Trails.level = BallTrailsLevel

' Subroutine for increasing the trail length
Sub IncreaseTrailLength
' Increase the trail length gradually
BallTrailsLevel = BallTrailsLevel + 0.01
xBAM.Trails.level = BallTrailsLevel
End Sub

' Subroutine for resetting the trail length to default
Sub ResetTrailLength
' Reset the trail length to the default value
BallTrailsLevel = DefaultTrailLength
xBAM.Trails.level = BallTrailsLevel
End Sub

' Trigger A event
Sub TriggerA_Event
' Call the subroutine to increase the trail length
IncreaseTrailLength
End Sub

' Trigger B event
Sub TriggerB_Event
' Call the subroutine to reset the trail length to default
ResetTrailLength
End Sub
```

I think this should do the trick
 
Last edited:
General chit-chat
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.
      Chat Bot Mibs Chat Bot Mibs: Killabot has left the room.
      Back
      Top