• Google Translate to French or Other Languages Click on the link and a new tab will open with this page translated into French.
    Click on the "To:" pull down option to select a different language. Users will not be logged in on the new Google tab.

Support File Tutorial Help BAM About physics ......For a better gameplay!

Paolo

No Bam no Play
Chat Moderator
Site Supporters
ya miniplayfield tool was a great idea
tool???? function is better!!!!
as Terry told George.....in another context,I say to you, two brilliant minds think alike!!!!
it is thanks to Rav, MP was born, it was the evolution of Bam, of 2016.
 

Paolo

No Bam no Play
Chat Moderator
Site Supporters
@Gimli
@GeorgeH

I have a question......
in your opinion, in normal fp physics, what speed can the ball reach during the game?(obviously it is understood that the fins have an optimal configuration)
you may ask ... what is the reason for this question? I explain to you2

my understanding for this code, "xBAM.BallSpeedLimit"it suggests to me that if I put a value let's put the case 3000 the ball will never exceed the speed of 3000.

So based on my perception, to avoid that the ball moves in the gameplay, with too much speed (at certain times) and therefore that you need to have two eyes like "superman", to follow the ball, I put and use this code.

Now, thanks to a suggestion from @AnonTet ,(another with evil mind running around here:shockedalien:,but remember , I'm, the boss ?) made me think that putting a "wrong" value could affect the natural speed of the ball in play, and negatively affect the gameplay .....

so I ask to you2, what think and could suggest
 

GeorgeH

Flippered Out
Staff member
Site Supporters
maybe you understood the mechanics?
It is pretty simple if I understand correctly. If you tap the flippers, the dynamic flippers would use the normal omega values. If you hold the flipper keys a little longer, then you would use the higher omega values.

If you are talking about coding it, I don't know how to do that. Gimli's idea does seem like it could work.
 

AnonTet

Pinball Hall of Famer
Site Supporters
Simple idea... hard to implement. Just look at shiva's code variable coil - not quite usable for the above purpose but it'll give you an idea on how complex it is.

Even if you want it to do it as simple as a tap = minomega and press = maxomega I'm not sure it'll work because FP has a degree of "lag" built in to control that even at default physics. And then there's the contact point to take into consideration too.

I'm just thinking out loud and as usual, I hope i'm wrong.
 

Gimli

Pinball Master
It is pretty simple if I understand correctly. If you tap the flippers, the dynamic flippers would use the normal omega values. If you hold the flipper keys a little longer, then you would use the higher omega values.

If you are talking about coding it, I don't know how to do that. Gimli's idea does seem like it could work.
You've almost got what I mean George, but instead of using a second omega( which I don't think you can do by holding the flipper because at that point you have already hit the ball) we just add a burst of speed.

If you hold the flipper then we will add a burst to the ball that has already been hit and "left Dodge city".
With the new set velocity code , we can make the ball continue on its current trajectory at a higher speed at any point and from any location we choose.

It does seem to work. Below is a proof of concept. See video and demo table. Play in Debug mode by pressing F9 from table editor.
You should see "maximum speed " given after you hit the ball. If you tap flipper and release right away the ball speed is around 800 , but if you hold flipper it jacks it up to 3000.

I exagerated the effect just to demonstrate and to see if it would work.

 

Attachments

  • velocity.fpt
    227.5 KB · Views: 28
Last edited:

Gimli

Pinball Master
@wild
@ravarcade
@GeorgeH
@TerryRed
@AnonTet
@NitroNimbus
@shiva

See above proof of concept. Wild wondered if there was a way to have a variable strength flippers.
If you hold flipper it shoots fast and if you tap flipper it shoots slow.

I used the FlipperExt.hit = true / false in the Sub PreHit as a signal for activating this.
If FlipperExt.hit = true then BurstAvailable = True


Code:
Sub LeftFlipper_prehit()
   If BAM_VERSION < 233 then Exit Sub
    If LeftFlipperExt.hit = True then BoostAvailable = True:BoostTimer.Set False:BoostTimer.Set True, 200
   OnPreHitFlipperSettings(LeftFlipperExt)
      omegaCorrectionL = MaxOmega - (LeftFlipperExt.ContactPoint * ((MaxOmega - MinOmega)/1.2))
      If LeftFlipperExt.ContactPoint < 0.0 then LeftFlipperExt.Omega = MaxOmega
      If LeftFlipperExt.ContactPoint > 1.2 then LeftFlipperExt.Omega = MinOmega
      If (LeftFlipperExt.ContactPoint => 0.0) And (LeftFlipperExt.ContactPoint =< 1.2) then
         LeftFlipperExt.Omega = omegaCorrectionL
      End if
End Sub

Sub BoostTimer_Expired()
    BoostAvailable = False
End Sub

And then I added the set velocity code to be applied 100 ms after you use the flipper and activate what I called "FlipperTimer"


Code:
'if flippers are pressed'''''''''''''''''''''''''''''''''
If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
                LeftFlipper.SolenoidOn
                maxballspeed = 0
                If BoostAvailable = True then FlipperTimer.Set True, 100
                'PlaySound "Flipper"
            End If

And added 4000 to the current ball speed...just for fun


Code:
Sub FlipperTimer_Expired()
    Dim ball
    Set ball = xBAM.BallCloseTo(0,0 )
    FlipperTimer.Set False
     Burst =ball.speed + 4000
    ball.SetVelocity Burst*sin(BallTrajectory * DegToRad), -Burst*cos(BallTrajectory  * DegToRad), 0

End Sub


If you release the flipper before the timer expires, it turns off the timer and the burst is "aborted"

Code:
'''''''''''''''''if flipper is released'''''''''''

If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
                LeftFlipper.SolenoidOff
                FlipperTimer.Set False
            End If

It ain't pretty or refined yet but it is dynamic as it is based on the current ball speed and trajectory....
 
Last edited:

Paolo

No Bam no Play
Chat Moderator
Site Supporters
Great job,Bob......:cool:,you always manage to finalize my crazy ideas:yourock:

so if I press and immediately release the fin, I have a medium omega (to be set)
if, on the other hand, I keep the fin pressed, we emulate (with ball velocity) a strong omega,right?

and the change of speed when it happens to the ball? because I have the feeling that it is not immediate but only after the ball is in the middle of the playfield ... am I wrong? in the meantime I always have the fin pressed ..... it's just a perception I can be wrong

and another thing is only speed, or even strength ...in this that you call it burst to the ball? is just a question to understand
 
Last edited:

Gimli

Pinball Master
Great job,Bob......:cool:,you always manage to finalize my crazy ideas:yourock:

so if I press and immediately release the fin, I have a medium omega (to be set)
if, on the other hand, I keep the fin pressed, we emulate (with ball velocity) a strong omega,right?
Exactly ! (It will already have the variable speed of the medium omega that is based on contact point and whatever speed that puts on the ball we boost a little bit or a lot )
and the change of speed when it happens to the ball? because I have the feeling that it is not immediate but only after the ball is in the middle of the playfield ... am I wrong? in the meantime I always have the fin pressed ..... it's just a perception I can be wrong
The "burst" or "boost" is applied 100 ms after it leaves the flipper.
So where ever the ball is at that time that is where it happens.

So to narrow the Gap , we can just shorten the time but then you will have to release the flipper (flick) very fast to prevent the boost.

and another thing is only speed, or even strength ...in this that you call it burst to the ball?is just a question to understand
"Strength" or "inertia" of the ball has to do with Speed as well as the Mass of the ball as well as Gravity and the Slope of the table.....
So this is increasing the speed but it will also impact the at least one component of "Strength" as well....
 
Last edited:

Paolo

No Bam no Play
Chat Moderator
Site Supporters
Molto bene!!! excellent explanations,Bravo!!

Another question, this The "burst" or "boost", also changes according to the omega set?
if I have an omega 33
or omega 40
The "burst" or "boost" it's different? I mean, I see the ball more faster

It ain't pretty or refined yet but it is dynamic as it is based on the current ball speed and trajectory....
so I assume it can be improved?
 

Gimli

Pinball Master
Molto bene!!! excellent explanations,Bravo!!

Another question, this The "burst" or "boost", also changes according to the omega set?
if I have an omega 33
or omega 40
The "burst" or "boost" it's different? I mean, I see the ball more faster
yes, I added that in the explanation above.
so I assume it can be improved?
absolutely ...this will take all us all to have a look and tweak. It is very crude.
For instance i was just realizing that the "boost" should be a percentage of the previous ball speed.... like ball.speed x 1.2
instead of ball.speed + Whatever.

The demo above is simply showing a way to have variable flipper strength. I think the concept has potential
 

Paolo

No Bam no Play
Chat Moderator
Site Supporters
ok I think all this is a positive thing, I'm very curious to see other developments and improvements on this one.
thank you and good night
 

Paolo

No Bam no Play
Chat Moderator
Site Supporters
@Gimli
@GeorgeH
@AnonTet

making changes to improve DK gameplay, now i have a problem, which i am sure you know, i mean i am referring to kickers and EmKicker....increasing mass and gravity, this negatively affects the kickers and EmKicker , even if I increase all the strength in edirtor, the kickers and EmKicker does not respond to my needs.

it would also take an omega for the kickers and EmKicker, possible? I don't know, but maybe I'll ask rav, but for now,do you know a practical way to increase strength using bam?

If it's not there, then maybe you Bob, could help me, in the way only you know how to do, which is ball velocity.
would you be able to simulate DK's plunger with ball velocity? attention this is particular use this method for the bow, so I don't know if ball velocity could do the same

Sub PlungerTimer_Expired()
PlungerPercentage = PlungerPercentage +7
If PlungerPercentage > 100 Then PlungerPercentage = 100
If PlungerPercentage < 0 Then PlungerPercentage = 0
Plunger.Pull(PlungerPercentage)
'plungerPull
End Sub
I need more strength (see video), and in the way like the code above to try to hit the 5 targets, see photos
dk6.jpg


 
Last edited:

shiva

Administrator
Staff member
Site Supporters
So this does what shivaFlippers do Gimli? Does it have flipper drag if the omega is set below 10?
 

Popotte

Flipper is good for you!
Site Supporters
...
If it's not there, then maybe you Bob, could help me, in the way only you know how to do, which is ball velocity.
would you be able to simulate DK's plunger with ball velocity? attention this is particular use this method for the bow, so I don't know if ball velocity could do the same
Sub PlungerTimer_Expired()
PlungerPercentage = PlungerPercentage +7
If PlungerPercentage > 100 Then PlungerPercentage = 100
If PlungerPercentage < 0 Then PlungerPercentage = 0
Plunger.Pull(PlungerPercentage)
'plungerPull
End Sub
...
Yes, it's easy to do.
 

Popotte

Flipper is good for you!
Site Supporters
Sub FuturePinball_KeyReleased(ByVal KeyCode)
Dim ball
If KeyCode = GetKeyCode(PlungerKey) Then
PlungerTimer.Enabled = False: Set ball = xBAM.BallCloseTo(0,0 )
ball.SetVelocity 0, (PlungerPercentage/100) * Velocity , 0
Plunger.LetGo
PlaySound "PlungerRelease": PlungerPercentage = 0
End If

Velocity the max velocity you want for the launch (value to be tested).
I tested on DK with a value of 50 000 and it's work (don't ask me why 50 000), so:
ball.SetVelocity 0, (PlungerPercentage/100) * 50000 , 0
 

Gimli

Pinball Master
an example, please?
It is exactly the same concept as above Paolo.

Here is the approach for adding velocity to the ball in direction it is going already. (After plunger release, after flipper ht, after the ball hits anything at all )

1. Add these math codes:
Code:
Const RadToDeg = 57.295779513082320876798154814105
Const DegToRad = 0.01745329251994329576923690768489


Function Atn2(x, y)
   If x > 0 Then
      Atn2 = Atn(y / x) * RadToDeg
   ElseIf x < 0 Then
      Atn2 = 180 - RadToDeg * Atn(y / -x)
   ElseIf y > 0 Then
      Atn2 = 90
   Else
      Atn2 = -90
   End If
   Atn2 = Atn2+90
End Function

2. Add Sub NewtonPhysicsTick with an entry for monitoring "BallTrajectory" or "direzione"
Ball Trajectory is the direction the ball is going

Code:
Dim BallTrajectory



Sub NewtonPhysicsTick()

        dim ball

        Set ball = xBAM.BallCloseTo(0,0 )

        BallTrajectory  = Atn2( xBAM.Ball.Velocity.X, xBAM.Ball.Velocity.y )

      

End Sub

3. Add the set velocity ANYWHERE you want to use it in the code
SpeedNumber below can be any number you want. It makes sense if you want a boost to make this number based on the current ball speed
ball speed x 1.5
or ball.speed x 2 or whatever

Code:
Dim SpeedNumber
Dim ball
    Set ball = xBAM.BallCloseTo(0,0 )
SpeedNumber = ball.speed * 1.5 '''''' Or any number you choose
    ball.SetVelocity SpeedNumber*sin(BallTrajectory * DegToRad), -SpeedNumber*cos(BallTrajectory  * DegToRad), 0

4. Try this code anywhere Paolo.
for instance just to demonstrate simply add it to a cheat key

if keycode = 48 then ' "B" on keyboard
Dim SpeedNumber
Dim ball
Set ball = xBAM.BallCloseTo(0,0 )
SpeedNumber = ball.speed * 1.5 '''''' Or any number you choose
ball.SetVelocity SpeedNumber*sin(BallTrajectory * DegToRad), -SpeedNumber*cos(BallTrajectory * DegToRad), 0
End if
 
Last edited:

Gimli

Pinball Master
Sub FuturePinball_KeyReleased(ByVal KeyCode)
Dim ball
If KeyCode = GetKeyCode(PlungerKey) Then
PlungerTimer.Enabled = False: Set ball = xBAM.BallCloseTo(0,0 )
ball.SetVelocity 0, (PlungerPercentage/100) * Velocity , 0
Plunger.LetGo
PlaySound "PlungerRelease": PlungerPercentage = 0
End If

Velocity the max velocity you want for the launch (value to be tested).
I tested on DK with a value of 50 000 and it's work (don't ask me why 50 000), so:
ball.SetVelocity 0, (PlungerPercentage/100) * 50000 , 0
Nice Jp
In the case of the plunger the ball it only going straight up....so all you need is "y velocity" number. x and z velocities are zero
ball.SetVelocity x velocity , y velocity ,z velocity
 

AnonTet

Pinball Hall of Famer
Site Supporters
So this does what shivaFlippers do Gimli? Does it have flipper drag if the omega is set below 10?

So far it just adds more speed to the ball depending on how long you press the flipper.

/edit
thread is moving fast. I have to add "... and other objects" :)
 
Last edited:

Paolo

No Bam no Play
Chat Moderator
Site Supporters
@Gimli
@Popotte

Thanks for your explanations and codes...
but I need these codes to be called by the PlungerKicker or emkicker, and tell me where I should increase or decrease the speed ....
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    @ Paolo: ********* *** ******
    Top