Reply to thread

Yep, very cool effect.



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.



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.


[SPOILER="Explosion"]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[/CODE]



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




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.


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:
    titomajo has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    daveseawater has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    rockin ray has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Citron68 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    hammerpower has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    max37170 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    OZZOLO has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    GG974 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    MSev has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    sghure has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    huik has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    ellitehaxor has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    KenF has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Mario1963 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    etherealmusic has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Snowstorm125 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    LBlackburn has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Ducati66 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    pinballgirlBR has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    arthab has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    bor74 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    ROCJR73 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    sparky has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    scutters has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    vincez28 has left the room.


      Type /nick followed by the desired name to set your nickname.
      Chat Bot Mibs Chat Bot Mibs: vincez28 has left the room.
      Back
      Top