I’ve put together a setup guide for adding nudging to your Pinball Cab based on my experience and the various help I’ve received across the forum. I thought instead of copying and pasting it in every new thread, I’d just link back to this one if I find someone asks about nudge setup.
I cover both Analog and Digital nudge setup. Feel free to ask any detailed questions as needed.
Setup for > Analog Nudge with Accelerometer
1) Position your device in a location that will allow nudges to be sensed properly. Closer to your hands is better.
Example: The Nanotech PBW board can be positioned in the front of the cab under the lockdown bar on a piece of wood, that is attached like a shelf to the front of the cab. The Nanotech board can then be attached to the small 'shelf' board and easily accessed by taking off the lockdown bar.
2) To calibrate the board, instead of relying on basic Windows calibration, grab this DXTweak tool, it will allow you to get perfect calibration.For newer OS’s you can use the DiView but DXTweak will work on newer OSs some of the time.
3) Grab this table for testing. Its a zero slope table.
4) Start adjusting the mid values of the X and Y axis, choose the proper tabs on top. You are trying to get the meter as close to center as possible for each X and Y axis. Keep the low and high values in line with your adjustment of mid, move mid up 5, you move low and high up 5. Make sure you don't have the x and y Axis to tight in DXTweak/DiView. By this I mean...make sure you are at least 300-500 from center each way. So if X Axis mid is 2000, the min should be 1500 and max 2500. The same for the Y axis. The closer you get to mid, the tighter and less forgiving the nudge is. If it's too tight, the chip will start to fight itself causing the jitters and ball wandering.
5) Start the zero slope test table in VP and see how the ball reacts. Your goal is to have the ball standing still when the table starts. Go back and forth between the DXTweak/DiView tool and restarting the zero slope table. You need to restart the table after each DXTweak/DiView tweak. You can also test the nudges on the table.
6) If you still find a slight wander in the zero slope table, adjust the deadzone. In VP, go to Preferences>Keys and check your gains and deadzone. I'm at 500% for x and y, and a 3% deadzone. The deadzone will give the ball a buffer before it acts to a nudge.
Setup for > Digital Nudge with Mercury switches or Plumbob or other tilt sensing device
1) Position your device in a location that will allow nudges to be sensed properly. Closer to your hands is better.
Example: Mercury switches positioned close to the flippers, one on each side, and under the lockdown bar for the center nudge is an example of good placement. Mercury switches are positioned with the wires pointing towards the cabinet walls as a nudge will 'pull' the mercury into the contacts, much like tapping a Ketchup bottle on the top to get the Ketchup to flow toward the cap. Good Mercury switches can be purchased here.
2) Wire the device into your keyboard controller(iPac, PBW board, etc) so that it maps to a key.
Example: Mercury switches can have one wire be ground (one wire from each switch wired together and run to ground on the controller), and one wire from each switch would go to it's own input on the keyboard controller.
3) Map the key to the proper nudge key in VP (or FP). In VP go to Preferences>Keys and you use the drop down for Z / and Space(the default nudge keys) and select the keyboard controller input you used from the list.
4) Test with the zero slope table and adjust the device by moving, bending, or shifting it's location until you get the desired nudge. Example: Mercury switches are normally attached to a bendable metal bracket which once mounted are intended to be bent for fine tuning.
5) With these hardware based devices you can experience rebounding where the device contacts or bounces on the switch multiple times. This is a rebound effect. This can be solved with custom nudge script. In the newer core.vbs script, you have the ability to add an external file that holds custom nudge code that overrides core.vbs nudge code. You simply create a file called NudgePlugin.vbs and drop it in the same folder where core.vbs is on your system(Tables folder for some). For some really good nudge code to add to your new file, I point you to Blur's code below:
You can set TiempoFiltro = 2000 to eliminate rebound nudges caused by your device.
You can can set sensitivity of the nudges with setting both p and m sensitivity variables.
You can set the force of your nudge and the return nudge chance:
- if you set aForce = 2 : ReturnPercent = 0 you will hardly ever lose the ball
- if you set aForce = 1 : ReturnPercent = 100 you will have a challenge as nudging will be less forceful and will have a return nudge all the time
You can see the other variables offered and change them as you like.
'----------------------
' Alternative Nudge v2
' by Blur
'----------------------
' For use with core.vbs version 3.41 or greater
' Move into folder with other scripts
Option Explicit
' cvpmNudge2 (Object = vpmNudge)
' Hopefully we can add a real pendulum simulator in the future
' (Public) .TiltSwitch - set tilt switch
' (Public) .Sensitivity - Set tiltsensitivity (0-10)
' (Public) .NudgeSound - set nudge sound, has to be in table
' (Public) .TiltSound - set tilt sound, has to be in table
' (Public) .NudgeMusic - mp3 file with nudge sound in music dir
' (Public) .TiltMusic - mp3 file with tilt sound in music dir
' (Public) .TiltObj - Set objects affected by tilt
' (Public) .DoNudge dir,power - Nudge table
' (Public) .SolGameOn - Game On solenoid handler
' (Private) .Update - Handle tilting
class cvpmNudge2
Private mCount, mSensitivity, pSensitivity, mNudgeTimer, mSlingBump, mForce
Private mFilterCount, mReturnCount, mReturnDir, mReturnForce
Public TiltSwitch
Private NudgeInterval, TiempoFiltro, ReturnTime, ReturnPercent
Public NudgeSound, TiltSound, NudgeMusic, TiltMusic
Private Sub Class_Initialize
' set defaults for all tables here or change them from your table script
NudgeInterval = 1000 ' time in ms after which nudge count goes down
TiempoFiltro = 200 ' nudge filtering time in ms
ReturnTime = 200 ' time after which return force bumps in
pSensitivity = 5 ' preferred sensitivity overrides table settings
mSensitivity = 5 ' default sensitivity used if not defined in table
NudgeSound = "" ' sound has to be in table
TiltSound = "" ' sound has to be in table
NudgeMusic = "nudge.mp3"' put this file in music dir
TiltMusic = "tilt.mp3" ' put this file in music dir
'StartShake ' uncomment to enable table shaking
PlayMusic NudgeMusic ' plays music to avoid stutter on first run
mFilterCount = 0 : mReturnCount = 0 : mReturnDir = 0 : mReturnForce = 0
mCount = 0 : TiltSwitch = 0 : vpmTimer.AddResetObj Me
End sub
Private Property Let NeedUpdate(aEnabled) : vpmTimer.EnableUpdate Me, False, aEnabled : End Property
Public Property Let TiltObj(aSlingBump)
Dim ii
ReDim mForce(vpmSetArray(mSlingBump, aSlingBump))
For ii = 0 To UBound(mForce)
If TypeName(mSlingBump(ii)) = "Bumper" Then mForce(ii) = mSlingBump(ii).Force
If TypeName(mSlingBump(ii)) = "Wall" Then mForce(ii) = mSlingBump(ii).SlingshotStrength
Next
End Property
Public Property Let Sensitivity(aSens)
If pSensitivity = 0 Then mSensitivity = (10-aSens)+1 Else mSensitivity = pSensitivity
End property
Public Sub DoNudge(ByVal aDir, ByVal aForce)
If mFilterCount > 0 and mFilterCount < TiempoFiltro\conTimerPulse then exit sub
mFilterCount = 1
mReturnCount = 1
' preferred angles, force and return force are defined in next lines, set them as you like
If aDir < 5 or aDir > 355 Then aDir = 180 : aForce = 1.25 : ReturnPercent = 100
If aDir >= 5 and aDir <= 175 Then aDir = 90 : aForce = 1 : ReturnPercent = 100
If aDir >= 185 and aDir <= 355 Then aDir = 270 : aForce = 1 : ReturnPercent = 100
aDir = aDir + (Rnd-0.5)*15*aForce : aForce = (0.6+Rnd*0.8)*aForce
Nudge aDir, aForce
If NudgeSound <> "" Then PlaySound NudgeSound Else PlayMusic NudgeMusic
mReturnDir = aDir + 180
mReturnForce = aForce * ReturnPercent / 100
If TiltSwitch = 0 Then Exit Sub ' If no switch why care
mCount = mCount + aForce * 1.2
If mCount > mSensitivity + 10 Then mCount = mSensitivity + 10
If mCount >= mSensitivity Then vpmTimer.PulseSw TiltSwitch : If TiltSound <> "" Then PlaySound TiltSound Else PlayMusic TiltMusic
NeedUpdate = True
End sub
Public Sub Update
if mFilterCount > 0 then mFilterCount = mFilterCount + 1
If mFilterCount > TiempoFiltro\conTimerPulse Then mFilterCount = 0
If mReturnCount > 0 Then mReturnCount = mReturnCount + 1
If mReturnForce > 0 and mReturnCount > ReturnTime\conTimerPulse Then mReturnCount = 0 : Nudge mReturnDir, mReturnForce
If mCount > 0 Then
mNudgeTimer = mNudgeTimer + 1
If mNudgeTimer > NudgeInterval\conTimerPulse Then
If mCount > mSensitivity+1 Then mCount = mCount - 1 : vpmTimer.PulseSw TiltSwitch
mCount = mCount - 1 : mNudgeTimer = 0
End If
Else
mCount = 0
End If
If mCount = 0 and mFilterCount = 0 and mReturnCount = 0 Then NeedUpdate = False
'msgbox mCount & " " & mFilterCount & " " & mReturnCount & " " & mNudgeTimer
End Sub
Public Sub Reset : mCount = 0 : End Sub
Public Sub SolGameOn(aEnabled)
Dim obj, ii
If aEnabled Then
ii = 0
For Each obj In mSlingBump
If TypeName(obj) = "Bumper" Then obj.Force = mForce(ii)
If TypeName(obj) = "Wall" Then obj.SlingshotStrength = mForce(ii)
ii = ii + 1
Next
Else
For Each obj In mSlingBump
If TypeName(obj) = "Bumper" Then obj.Force = 0
If TypeName(obj) = "Wall" Then obj.SlingshotStrength = 0
Next
End If
End Sub
End Class
Other Tips
If you are setting up digital nudge and have an accelerometer board like the Nanotech PBW board that has both keyboard inputs and nudge, you will want to turn off the analog nudge. To completely turn off the analog nudge go to VP > Preferences>Keys and uncheck the Enable Analog Nudge box. THEN change the x and y gains to 0 and the deadzone to 100%. This completely disables the accelerometer within VP.
I will add/cleanup this post as needed.
Edited by uberpinball, 29 July 2013 - 10:45 PM.



Top












Contributor








are all trademarks of VPFORUMS.