Register    Login    Forum    FAQ    PinSimDB.org

Board index » Future Pinball » BAM corner




Post new topic Reply to topic  [ 1861 posts ]  Go to page Previous  1 ... 181, 182, 183, 184, 185, 186, 187  Next
Author Message
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Sun Jul 15, 2018 6:49 am 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 931
BAM update. v233

https://www.ravarcade.pl/files/bam-setup.exe
https://www.ravarcade.pl/files/BAM_v1.4-233.zip
https://www.ravarcade.pl/files/BAM-OpenVR.zip

Change log:
- dynamic flippers setting (see thread: http://gopinball.com/forum/viewtopic.php?f=86&t=6676)
- FP broken flipper shape and wird ball collision fixed

Dynamic flippers setting in short: When ball hit flipper, all params, like flipper mass, omega, elasticCoef can be adjuste based on ball speed, move direction, contact point for that one "hit".

Watch comming Monster Bash table.

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-241, released: Nov 9, 2018


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Mon Jul 16, 2018 4:20 pm 
Offline

Joined: Fri Jun 28, 2013 4:46 pm
Posts: 321
hello,

many thank for your hard work on making FP better.

I've 2 little questions:
1)-what do you mean by -> FP broken flipper shape and wird ball collision fixed ?

2)is it possible to add some effect on transparent/semi transparent ramp?
like somme blur or offset of that can we see through? maybe piloted by a tecture like a similar bump map texture?
I think it will make better plastic ramp rendering.


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Mon Jul 16, 2018 4:48 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2143
Location: Ontario, Canada
Hi smoke
Re: weird flipper shape
viewtopic.php?nomobile=1&f=86&t=6676&p=86688&hilit=Dimmension#p86688


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Mon Jul 16, 2018 5:22 pm 
Offline

Joined: Fri Jun 28, 2013 4:46 pm
Posts: 321
Gimli wrote:



haaaaa thanks!!


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Mon Jul 16, 2018 7:11 pm 
Offline

Joined: Fri Jun 28, 2013 4:46 pm
Posts: 321
do we still need to add a Flipper_prehit subroutine (even empty one).
to correct the problem on weird ball collision fixed ?


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Mon Jul 16, 2018 7:58 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2143
Location: Ontario, Canada
I think you need the prehit directories even if empty

I believe if you press control-c when you are in flipper tweak menu in BAM it will copy all you need to clipboard then press control-v to paste to script....

Code:
Dim LeftFlipperExt, RightFlipperExt
Sub BAM_Init()
   Set LeftFlipperExt       = xBAM.Flipper("LeftFlipper")
   Set RightFlipperExt      = xBAM.Flipper("RightFlipper")
End Sub

Sub LeftFlipper_prehit()
   OnPreHitFlipperSettings LeftFlipperExt
End Sub

Sub RightFlipper_prehit()
   OnPreHitFlipperSettings RightFlipperExt
End Sub

' === Dynamic Flipper Settings ===
Sub OnPreHitFlipperSettings(FlipperExt)
   ' Add flipper params moddifications here
End Sub


If you want to play around with Rav's test codes for dynamic flippers, you can copy ALL of the following into any table under "option explicit" in script.

Code:
' ================= Physics XML in script =============================
' It is FP 1.0 default physics with one change:
' <flipper rotationSpeedChart="{0.0,70.0},{50.0,100.0}" ....
' Line #42 in script.
' So, we use flipper rotation speed chart with only 2 points: 0ms : 70%, 50ms : 100%
' This will make flippers slowly accelerate when use press and hold flipper button
' Default FP behave is: flipper max speed is right after user press flipper button and flipper slowly decelerate... slowly
xBAM.PhysicsXML = "" & vbcrlf &_
   "<?xml version=""1.0"" encoding=""utf-8""?>" & vbcrlf &_
   "<document>" & vbcrlf &_
   "  " & vbcrlf &_
   "  <!-- Physics processing -->" & vbcrlf &_
   "  <!-- Note. Changing the FPS will effect how how all the other values interact with each other and should " & vbcrlf &_
   "  be a high value due to the fact the ball in a pinball is moving very fast and lower values will cause the ball" & vbcrlf &_
   "  to go into objects fractionally (thus we must sample at a higher rate)" & vbcrlf &_
   "" & vbcrlf &_
   "  threaded (true/false) defines if the physics runs in a separate thread for multicore CPU's (dev version only)" & vbcrlf &_
   "  -->" & vbcrlf &_
   "  <physics slope=""6"" fps=""256"" threaded=""0""></physics>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Settings for various objects -->" & vbcrlf &_
   "  <ball newtonDamping=""0"" mass=""18"" gravity=""4000"" damping=""0.25""></ball>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- moeMethod=""0"" Auto-calculate the moments of Inertia for the flipper using internal Newton functions -->" & vbcrlf &_
   "  <!-- moeMethod=""1"" Calculate the Flipper MOE based on a rectangle (changes aiming behaivour) -->" & vbcrlf &_
   "  <!-- Note: omega is rotational force -->" & vbcrlf &_
   "  <flipper rotationSpeedChart=""{0.0,70.0},{50.0,100.0}"" newtonDamping=""1"" mass=""20000"" omega=""50"" moeMethod=""0"" " & vbcrlf &_
   "           leftXoff=""0"" leftYoff=""0"" leftZoff=""0"" " & vbcrlf &_
   "           rightXoff=""0"" rightYoff=""0"" rightZoff=""0""></flipper>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- impluse            The amount of power applied to the ball (normal setting).. " & vbcrlf &_
   "                          this is then scalled up or down to suit the strength setting" & vbcrlf &_
   "       impulseRandomness  Random Percentage (of impulse) added to impulse when the ball hits the object" & vbcrlf &_
   "       vectorRandomness   Random Angle change +/- value to ball direction" & vbcrlf &_
   "  -->" & vbcrlf &_
   "  <bumper impulse=""85.0"" impulseRandomness=""10"" vectorRandomness=""6""></bumper>" & vbcrlf &_
   "  <autoplunger mass=""20000.0"" force=""60000.0""></autoplunger>" & vbcrlf &_
   "  <diverter mass=""10000.0"" omega=""33.0""></diverter>" & vbcrlf &_
   "  <gate mass=""2.0"" gravity=""4500.0"" damping=""0.25""></gate>" & vbcrlf &_
   "  <kicker impulse=""800.0"" vukImpulse=""1300.0"" impulseRandomness=""4"" vectorRandomness=""1""></kicker>" & vbcrlf &_
   "  <plunger mass=""20000.0"" force=""30000.0""></plunger>" & vbcrlf &_
   "  <slingshot impulse=""480.0"" impulseRandomness=""15"" vectorRandomness=""10""></slingshot>" & vbcrlf &_
   "  <spindisk mass=""10000.0"" angularDamp=""0.33"" linearDamp=""0.25""></spindisk>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!--" & vbcrlf &_
   "  <spinner mass=""100000.0"" gravity=""100000"" angularDamp=""0.5"" angularAccel=""5.25""" & vbcrlf &_
   "           spinDampLoose=""0.22"" spinBackLoose=""1.8""" & vbcrlf &_
   "           spinDampNorm=""0.325"" spinBackNorm=""2.7""" & vbcrlf &_
   "           spinDampTight=""0.575"" spinBackTight=""3.2""></spinner>" & vbcrlf &_
   "  -->" & vbcrlf &_
   "  <spinner mass=""45.0"" gravity=""100.0"" angularDamp=""0.5"" angularAccel=""5.0"" " & vbcrlf &_
   "           spinDampLoose=""0.325"" spinBackLoose=""2.850"" " & vbcrlf &_
   "           spinDampNorm=""0.575""  spinBackNorm=""3.250"" " & vbcrlf &_
   "           spinDampTight=""0.750"" spinBackTight=""3.500""></spinner>" & vbcrlf &_
   "  <emkicker mass=""10000.0"" omega=""80.0""></emkicker>" & vbcrlf &_
   "  <varitarget mass=""100.0"" damping=""0.5"" tension=""3.0"" return=""15.0""></varitarget>" & vbcrlf &_
   "  <magnet impulse=""10.0"" impulseRandomness=""2""></magnet>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Nugde Settings -->" & vbcrlf &_
   "  <nudge impulse=""100.0"" impulseRandomness=""25.0"" warningLevel=""160"" leftAngle=""65"" upAngle=""0.0"" rightAngle=""295""" & vbcrlf &_
   "         vectorRandomness=""4"" visualDistance=""2"" waitPeriod=""300"" maxBallVelocity=""1000.0""></nudge>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Materials Settings -->" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Static coefficient" & vbcrlf &_
   "       - - - - - - - - - - " & vbcrlf &_
   "       Static friction is the force that holds back a stationary object up to the point that it " & vbcrlf &_
   "       just starts moving. Thus, the static coefficient of friction concerns the force restricting " & vbcrlf &_
   "       the movement of an object that is stationary on a relatively smooth, hard surface." & vbcrlf &_
   "" & vbcrlf &_
   "       Kinetic coefficient" & vbcrlf &_
   "       - - - - - - - - - - " & vbcrlf &_
   "       Once you overcome static friction, kinetic friction is the force holding back regular motion. " & vbcrlf &_
   "       This, kinetic fiction coefficient of friction concerns the force restricting the movement of " & vbcrlf &_
   "       an object that is sliding on a relatively smooth, hard surface." & vbcrlf &_
   "       " & vbcrlf &_
   "       Both coefficients are based on material pairs (ie wood on wood, metal on wood) etc.." & vbcrlf &_
   "" & vbcrlf &_
   "       In FP all the settings are for Ball on Wood/Plastic/Rubber/Metal etc.." & vbcrlf &_
   "" & vbcrlf &_
   "       and from the Newton docs.." & vbcrlf &_
   "       staticFriction and kineticFriction must be positive values. kineticFriction must be lower or equal than " & vbcrlf &_
   "       staticFriction. It is recommended that staticFriction and kineticFriction be set to a value " & vbcrlf &_
   "       lower or equal to 1.0, however because some syntetic materials can have higher than one coeficient " & vbcrlf &_
   "       of friction Newton allows for the coeficient of friction to be as high as 2.0." & vbcrlf &_
   "" & vbcrlf &_
   "       For more information refer to http://en.wikipedia.org/wiki/Friction" & vbcrlf &_
   "  -->" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Default Materal Settings to act as defaults incase we forget to set an object during development.  " & vbcrlf &_
   "       There shouldn't be any objects set to this material so these are just a fail safe values -->" & vbcrlf &_
   "  <defaultMat softnessCoef=""0.02"" elasticCoef=""0.1"" staticFriction=""0.01"" kineticFriction=""0.02""></defaultMat>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Material Settings for surfaces marked as playfields -->" & vbcrlf &_
   "  <playfieldMat softnessCoef=""0.03"" elasticCoef=""0.2"" staticFriction=""0.01"" kineticFriction=""0.02""></playfieldMat>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Primary Material Types -->" & vbcrlf &_
   "  <metalMat softnessCoef=""0.01"" elasticCoef=""0.05"" staticFriction=""0.01"" kineticFriction=""0.02""></metalMat>" & vbcrlf &_
   "  <woodMat softnessCoef=""0.03"" elasticCoef=""0.2"" staticFriction=""0.01"" kineticFriction=""0.02""></woodMat>" & vbcrlf &_
   "  <plasticMat softnessCoef=""0.02"" elasticCoef=""0.25"" staticFriction=""0.01"" kineticFriction=""0.02""></plasticMat>" & vbcrlf &_
   "  <rubberHardMat softnessCoef=""0.04"" elasticCoef=""0.4"" staticFriction=""0.01"" kineticFriction=""0.02""></rubberHardMat>" & vbcrlf &_
   "  <rubberIntMat softnessCoef=""0.05"" elasticCoef=""0.5"" staticFriction=""0.01"" kineticFriction=""0.02""></rubberIntMat>" & vbcrlf &_
   "  <rubberSoftMat softnessCoef=""0.06"" elasticCoef=""0.6"" staticFriction=""0.01"" kineticFriction=""0.02""></rubberSoftMat>" & vbcrlf &_
   "" & vbcrlf &_
   "  <!-- Object Specific Material Settings -->" & vbcrlf &_
   "  <gateMat softnessCoef=""0.05"" elasticCoef=""0.66"" staticFriction=""0"" kineticFriction=""0""></gateMat>" & vbcrlf &_
   "  <kickerMat softnessCoef=""0.01"" elasticCoef=""0.05"" staticFriction=""0.8"" kineticFriction=""0.8""></kickerMat>" & vbcrlf &_
   "  <rampMat softnessCoef=""0.01"" elasticCoef=""0.05"" staticFriction=""0.01"" kineticFriction=""0.02""></rampMat>" & vbcrlf &_
   "  <plungerMat softnessCoef=""0.04"" elasticCoef=""0.4"" staticFriction=""0.01"" kineticFriction=""0.02""></plungerMat>" & vbcrlf &_
   "  <spindiskMat softnessCoef=""0.05"" elasticCoef=""0.5"" staticFriction=""2"" kineticFriction=""2""></spindiskMat>" & vbcrlf &_
   "  " & vbcrlf &_
   "</document>"

' ========================== FlipperExt settings in prehit events demo starts here =========================

' Creation of RightFlipperExt, LeftFlipperExt
' This code was generated with CTLR+C pressed in Physics Tweak section of BAM menu .
Dim RightFlipperExt, LeftFlipperExt
Sub BAM_Init()
   Set RightFlipperExt      = xBAM.Flipper("RightFlipper")
   Set LeftFlipperExt       = xBAM.Flipper("LeftFlipper")
End Sub


' This function is called by FP for RightFlipper when ball may hit flipper.

' I want to moddify flipper settings in one fuction for all flippers, so....
' ... this function will call OnPreHitFlipperSettings with RightFlipperExt as argument.
Sub RightFlipper_prehit()   
   OnPreHitFlipperSettings(RightFlipperExt)
End Sub

' This function is called by FP for LeftFlipper when ball may hit flipper.
' I want to moddify flipper settings in one fuction for all flippers, so....
' ... this function will call OnPreHitFlipperSettings with LeftFlipperExt as argument.
Sub LeftFlipper_prehit()
   OnPreHitFlipperSettings(LeftFlipperExt)
End Sub


' This function is called by LeftFlipper_prehit or RightFlipper_prehit.
' I want to moddify flipper settings in one fuction for all flippers, so ....
' .... it will call one of demo versions of OnPreHitFlipperSettings_...something...
' [ha ha .... one more jump to go]
'
' Tips for you:
' 1. Unrem one line to test version of OnPreHitFlipperSettings... or rem all if you want to use default FP.
' 2. If you want to have ONE OnPreHitFlipperSettings like i do, you can put all code inside OnPreHitFlipperSettings
' 3. If you want differen behave for different flippers you can put different code in LeftFlipper_prehit and RightFlipper_prehit
'    Dont forget to to rename FlipperExt from my examples to LeftFlipperExt and RightFlipperExt or ....
'    At begin of LeftFlipper_prehit function you can add: Dim FlipperExt: Set FlipperExt = LeftFlipperExt
Sub OnPreHitFlipperSettings(FlipperExt)
'   OnPreHitFlipperSettings_weekTip(FlipperExt)
   OnPreHitFlipperSettings_linearOmega(FlipperExt)
'   OnPreHitFlipperSettings_massWeekTip(FlipperExt)
'   OnPreHitFlipperSettings_linearElasticCoef(FlipperExt)
'       OnPreHitFlipperSettings_bounceControl(FlipperExt)
'  ---- versions with some debug info when you press F9 instead of F5
'  OnPreHitFlipperSettings_weekTip_debug(FlipperExt)
   OnPreHitFlipperSettings_linearOmega_debug(FlipperExt)
'   OnPreHitFlipperSettings_massWeekTip_debug(FlipperExt)
'   OnPreHitFlipperSettings_linearElasticCoef_debug(FlipperExt)
End Sub


' =================== some debug stuffs ===========
' Helper variables used to monitor ball speed change in next frame after ball hit
Dim NewtonCounterWhenBallHitFlipper, BallSpeedBeforeHit

' This subroutine is executed for every newton physics simulation step.
' Variable xBAM.NewtonCounter contains "frame counter" increased by 1 every simulation step.
' I use it to check ball speed change after hit in all "debug" versions of OnPreHitFlipperSettings
'
' Tip:
' If you don't want to use debug stuffs and debug versions of OnPreHitFlipperSettings:
' - remove all line between "some debug stuffs" and "end of "some debug stuffs""
' - remove all OnPreHitFlipperSettings_[... somthing ...]_debug subroutines
Sub NewtonPhysicsTick()
   Dim Ball
   Set Ball = xBAM.BallCloseTo(0,0,0)

   If Ball.Exist Then
      If NewtonCounterWhenBallHitFlipper+1= xBAM.NewtonCounter Then
         Dim precChange
         precChange = 0
         ' test bellow is needed to avoid division by zero if BallSpeedBeforeHit is near 0
         If BallSpeedBeforeHit > 1 Then
            precChange = CInt(100*((Ball.Speed - BallSpeedBeforeHit) / BallSpeedBeforeHit))
         End If

         AddDebugText "## At frame: " & NewtonCounterWhenBallHitFlipper & " speed change: " & precChange  & "%"
         AddDebugText "## " & BallSpeedBeforeHit & " => " & Ball.Speed
         AddDebugText " " ' empty line in debug window
      End If
   End If
End Sub
' ================ end of "some debug stuffs" =================

' ---------------------------- here are OnPreHitFlipperSettings_[...something...] subroutines ---------------

' WeekTip:
' If ball hit flipper near tip then set omega to 8, so:
' If ContactPoint > 0.6 set Omega to 8.
Sub OnPreHitFlipperSettings_weekTip(FlipperExt)
   If FlipperExt.Hit And FlipperExt.ContactPoint > 0.6 Then
      FlipperExt.Omega = 8
   End If
End Sub

' LinearOmega:
' Force applied to ball on hid should be ~same on all surface of flipper.
' So, ball at tip should be pushed with same forca as ball near center or begin of flipper.
Sub OnPreHitFlipperSettings_linearOmega(FlipperExt)
   If FlipperExt.Hit Then
      Dim omegaCorrection
      omegaCorrection = 1.0 - FlipperExt.ContactPoint * 0.7

      ' ContactPoint may be lower than 0.0 and higher than 1.0, so...
      ' ... we need to clamp omegaCorrection in range 0.05 to 1.0
      If omegaCorrection < 0.05 Then
         omegaCorrection = 0.05
      End If
      If omegaCorrection > 1.0 Then
         omegaCorrection = 1.0
      End If
      
      FlipperExt.Omega = 70 * omegaCorrection
   End If
End Sub

' MassWeekTip:
' If ball hit flipper near tip then set mass to 50, so:
' If ContactPoint > 0.6 set mass to 50.
Sub OnPreHitFlipperSettings_massWeekTip(FlipperExt)
   If FlipperExt.Hit And FlipperExt.ContactPoint > 0.6 Then
      FlipperExt.Mass = 50
   End If
End Sub


' LinearElasticCoef:
' Tip of flipper will be less "bouncy" than center... center will be less bouncy than begin.
Sub OnPreHitFlipperSettings_linearElasticCoef(FlipperExt)
   If FlipperExt.Hit Then
      Dim elasticCoef
      elasticCoef = 1.0 - FlipperExt.ContactPoint * 0.9

      ' ContactPoint may be lower than 0.0 and higher than 1.0, so...
      ' ... we need to clamp elasticCoef in range 0.05 to 1.0
      If elasticCoef < 0.05 Then
         elasticCoef = 0.05
      End If
      If elasticCoef > 1.0 Then
         elasticCoef = 1.0
      End If
      
      ' 0.9 is max elasticCoef, at flipper tip it will be 0.05*0.9 = 0.045... ball should not bounce at tip
      FlipperExt.SetMaterial 0.9 * elasticCoef
   End If
End Sub

' ------------------------ here are OnPreHitFlipperSettings_[...something...]_debug subroutines -------------

' WeekTip with some debuging
Sub OnPreHitFlipperSettings_weekTip_debug(FlipperExt)
   If FlipperExt.Hit Then
      NewtonCounterWhenBallHitFlipper = xBAM.NewtonCounter
      BallSpeedBeforeHit = xBAM.Ball.Speed
      If FlipperExt.ContactPoint > 0.6 Then
         FlipperExt.Omega = 8
         AddDebugText xBAM.NewtonCounter & ": week hit " & FlipperExt.ContactPoint & " : " &  xBAM.Ball.Speed
      Else
         AddDebugText xBAM.NewtonCounter & ": normal hit " & FlipperExt.ContactPoint & " : " &  xBAM.Ball.Speed
      End If
   End If
End Sub

' LinearOmega with some debuging
Sub OnPreHitFlipperSettings_linearOmega_debug(FlipperExt)
   If FlipperExt.Hit Then
      Dim omegaCorrection
      omegaCorrection = 1.0 - FlipperExt.ContactPoint * 0.7

      ' ContactPoint may be lower than 0.0 and higher than 1.0, so...
      ' ... we need to clamp omegaCorrection in range 0.05 to 1.0
      If omegaCorrection < 0.05 Then
         omegaCorrection = 0.05
      End If
      If omegaCorrection > 1.0 Then
         omegaCorrection = 1.0
      End If
      
      FlipperExt.Omega = 50 * omegaCorrection

      NewtonCounterWhenBallHitFlipper = xBAM.NewtonCounter
      BallSpeedBeforeHit = xBAM.Ball.Speed
      AddDebugText "LinearOmega: " &  50 * omegaCorrection
   End If
End Sub

' MassWeekTip with some debug
Sub OnPreHitFlipperSettings_massWeekTip_debug(FlipperExt)
   If FlipperExt.Hit Then
      NewtonCounterWhenBallHitFlipper = xBAM.NewtonCounter
      BallSpeedBeforeHit = xBAM.Ball.Speed
      If FlipperExt.ContactPoint > 0.6 Then
         FlipperExt.Mass = 50
         AddDebugText xBAM.NewtonCounter & ": week hit " & FlipperExt.ContactPoint & " : " &  xBAM.Ball.Speed
      Else
         AddDebugText xBAM.NewtonCounter & ": normal hit " & FlipperExt.ContactPoint & " : " &  xBAM.Ball.Speed
      End If
   End If
End Sub

' LinearElasticCoef with some debug
Sub OnPreHitFlipperSettings_linearElasticCoef_debug(FlipperExt)
   If FlipperExt.Hit Then
      Dim elasticCoef
      elasticCoef = 1.0 - FlipperExt.ContactPoint * 0.9

      ' ContactPoint may be lower than 0.0 and higher than 1.0, so...
      ' ... we need to clamp elasticCoef in range 0.05 to 1.0
      If elasticCoef < 0.05 Then
         elasticCoef = 0.05
      End If
      If elasticCoef > 1.0 Then
         elasticCoef = 1.0
      End If
      
      FlipperExt.SetMaterial 0.9 * elasticCoef

      NewtonCounterWhenBallHitFlipper = xBAM.NewtonCounter
      BallSpeedBeforeHit = xBAM.Ball.Speed
      AddDebugText "linearElasticCoef: " &  0.9 * elasticCoef
   End If
End Sub

'
Sub OnPreHitFlipperSettings_bounceControl(FlipperExt)
   ' Params to tweak
   const base_elasticCoef                        = 0.8  ' very bouncy flipper rubber
   const expected_ball_speed_after_hit           = 240  ' calc elasticCoef to get desired ball speed after ball hit flipper
   const minimum_elasticCoef_to_scale_fast_balls = 0.05 ' we will add this to calculated elastiCoef, so ball after hit will have aditional 5% of speed before hit
   const reduction_for_flipper_in_motion         = 0.20 ' if flipper is not in starting point, reduce elasticCoef by 10%
   const min_elasticCoef                         = 0.02 ' 2%, ball will almost glue to flipper, this is minimum value

   If FlipperExt.Hit Then
      Dim elasticCoef
      ' ball_speed_after_hit = elastic_coef * ball_speed_before_hit
      ' so, elastic_coef = expected_ball_speed_after_hit / ball_speed_before hit !
      elasticCoef = expected_ball_speed_after_hit / xBAM.Ball.Speed

      ' now add little bit to preserv atleast 5% of ball speed before hit (not all balls should end with 240 mm/s)
      elasticCoef = elasticCoef + minimum_elasticCoef_to_scale_fast_balls

      ' make sure, we to not have elasticCoef higher than base value
      If elasticCoef > base_elasticCoef Then elasticCoef = base_elasticCoef

      ' now, reduce elastic coef if flipper is not at StartAngle (1 deg difference or more required)
      If FlipperExt.AngleDiff > 1 Then elasticCoef = elasticCoef - reduction_for_flipper_in_motion

      ' ... finally make sure, that elasticCoef will not be "negative" or to smalll
      If elasticCoef < min_elasticCoef Then elasticCoef = min_elasticCoef

      FlipperExt.SetMaterial elasticCoef

      ' some debug info:
      Dim raport
      raport = ""
      If expected_ball_speed_after_hit / xBAM.Ball.Speed < (base_elasticCoef-0.2) Then raport = raport & "[slowdown]"
      If FlipperExt.AngleDiff > 1 Then raport = raport & "[flipper in air]"
      AddDebugText "bouncCtrl: " & Round(elasticCoef*100) & "% " & raport
   End If
End Sub
======================================================================


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Fri Jul 20, 2018 1:07 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 1727
Location: Arkansas, USA
When I saw the initial stuff on the flippers, I thought I could do it but now I am completely lost. I doubt I will be able to do this because I am not much of a coder. Anyway, I'll give it a shot.

My first question is how do I add an XML file that I am working on to the script like in Gimli's example in the previous posting? Then if I need to make changes to it, do I have to change the script?

George


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Fri Jul 20, 2018 6:17 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2143
Location: Ontario, Canada
The internal XML is secondary and not needed for the process

I used BAM menu to copy desired XML to clipboard and then selected and deleted the demo table XML code and pasted the desired XML in its place

I believe Bam physics tweaks when you choose save XML only applies to an external XML but if you press control+c instead then you can update script by repasting with control-v

There are so many options now...I don't have much time but I am still very enthusiastic about this and am trying to come up with an easy process for everyone...

From my observations so far (and I probably wrong) ball speed , and not contact point gives better results....

I am considering using ball speed as the key when pinball "attacks" the flipper from above
And using contact point when ball rolls over flippers from inlanes at slower speeds ..

And I haven't even considered flipper angle...

Who knows ?


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Mon Jul 30, 2018 6:14 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 931
BAM update. v237

https://www.ravarcade.pl/files/bam-setup.exe
https://www.ravarcade.pl/files/BAM_v1.4-237.zip
https://www.ravarcade.pl/files/BAM-OpenVR.zip

Updates:
- Flipper rotation now can be controlled when button is presses (SolenoidOn) and release (SolenoidOff)
- Vertical ball speed repoarted thru FlipperExe.BallVSpeed takes in to account flipper rotation

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-241, released: Nov 9, 2018


Top 
 Profile  
 
 Post subject: Re: Better Arcade Mode - MOD for Future Pinball
 Post Posted: Tue Jul 31, 2018 2:12 pm 
Offline

Joined: Fri Jun 28, 2013 4:46 pm
Posts: 321
love it !!!

your flipper rotation chart match perfectly with my physics !

could confirm that to solve the :

"When ball hit flipper in place near tip, physics engine reports 2 contacts with flipper"
"even if we have "flat" top surface, that surface is ignored and ball is bounced only by green-cylinder"

we have to declare Flipper_prehit sub routine but can leave them empty ?

Sub LeftFlipper_prehit()
End Sub
Sub RightFlipper_prehit()
End Sub


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 1861 posts ]  Go to page Previous  1 ... 181, 182, 183, 184, 185, 186, 187  Next

Board index » Future Pinball » BAM corner


Who is online

Users browsing this forum: No registered users and 8 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to: