Register    Login    Forum    FAQ    PinSimDB.org

Board index » Resources » Tutorials, how-to's, bug report and docs




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Blues Flippers version 2 example and tutorial
 Post Posted: Tue Nov 01, 2016 4:40 pm 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 236
Location: Abbotsford
Blues flipper mod example

(Tutorial copy and file example included)

A basic tutorial and example of how the flippers work in Star trek xse version 1.3, released Oct 2016

OVERVIEW

The basic stock flippers are well known for their bad physics, it's been a major sore point for years. As time has rolled by, and more creative people have entered the scene, new ideas and creations have been added to the point that it is possible to create far more actuate and better playing flippers. This mod tutorial details how to get the most out of the Future Pinball flippers. Though it seems complicated, it's actually quite easy to put in your table, and the script is mostly copy and paste, with a couple lines of code in certain subroutines.

THE STOCK FLIPPERS

Before we begin with the mod, it's best to talk about the stock flippers first, and detail some of the problems with them. The flippers are modeled, and have a basic collision mesh. The main problem is there are very few physic statements for the flippers, and very generic.

You only have a Mass setting, a omega setting (which handles speed and strength) and the moeMethod, which sets the collision to the actual shape of the flipper, or with a setting, draw the collision as a rectangle. There are also settings to adjust the horizontal,vertical angles of the ball when the flipper strikes it.The physics with pinball are very complex, especially with flippers, so the physics used with the flippers are beyond basic.

Furthermore, there is coding problems, as the angle set for the ball to come off the flippers is very excessive, a shot off the tip of a flipper will hit the lower part of the slingshot. As a example, in a arcade game like from Bally, the flippers are set to a 122 degree angle, but in FP, to get close to the same kind of shot, you would have to set your angle to 116.
On top of that, the range of the flippers is such that if you have your flippers set for shots to the side of the table, you lose the range for shots towards the center.
There are also problems with the speed of the ball, as sometimes the ball will speed up with a backhand type shot, or shoot at a bad angle if you have your flippers in the up position, drop the flippers and repress the flipper buttons and strike the ball BEFORE the flipper hits it's most downward position.

WHAT YOU NEED

To counteract these problems, a method using multiple objects and special scripting has been developed. This tutorial uses version 2 of the mod, that add triggers to prevent conflict problems, but the principle is the same as in version 1, used for Playboy xse.
Star Trek xse version 1.3 uses version 2 of this mod, you can find the table here at http://www.pinsimdb.org/pinball/table-1 ... r_trek_xse

This mod also uses the zed flipper models. You can export the models directly from the tutorial table, you will need the following models:
- Flipper-T4- Left-ZED (large visible left flipper)
- Flipper-T4- Right-ZED (large visible right flipper)
- Flipper-T1-Short_hide ( The hidden flipper, this is not rendered in the game, and only shows as a small circle in the editor)
- Flipper-T1-Short (stock flipper, this is only used so you can see what you are doing when setting up the flipper. Once you are done and happy with it, set the model to Flipper-T1-Short_hide)

The rest of the objects use stock FP objects, the timer objects, walls, and triggers.

The sample table is stripped, just to play the table, and to demo the flippers. Both small flippers are set to "visible" as well as the triggers so you can see how it works. A image is included and set to the pf image, which is a quide to the names and what they do.

HOW IT WORKS

The mod uses two flippers, a drop-able wall, a trigger and 3 timers for each flipper. We will use the left flipper for this example, but any other flippers you have in your table will be the same.

- The small flipper (named LF)(found in Layer 2 of your editor) is "hidden" in other words not rendered when you play your game. It uses the Flipper-T1-Short_hide model and handles shots for the center of the table, as well as backhand shots or any shots that require the ball to be at the base of the larger flipper. This is usually set to be weaker in the strength setting than the main flipper, as this gives a more realistic effect and helps prevent one of the main flaws with stock fp flippers with suddenly faster speeds.
- The small flipper is only "active" and will only flip when the ball is over the TriggerLFM trigger, if the ball is not touching the trigger, the small flipper will stay in it's downward position, even if the main flipper is "up". This was done to prevent the small flipper from being active and interfering in game play)
- When the ball is over the trigger ( TriggerLFM_Hit() ), it sets a "flag" (UseLeftFlipperMid = 1) to tell the game that the small flipper is active, starts the small flipper to "flip" with a keypress and then calls a timer (TimerLF.Enabled) after a set amount of time before it flips the main flipper. This assures that the small flipper will strike the ball before the main flipper.
- When the ball is no longer over the trigger ( TriggerLFM_UnHit() ) it sets the "flag" (UseLeftFlipperMid = 0) to tell the game that the small flipper is no longer active, and therefore not to "flip" at all, just have the main LeftFlipper "flip".
When you release the flipper key, both flippers move to it's downward position and UseLeftFlipperMid is set back to 0.

THE WALL
The wall is also a vital part of the mod. It serves a dual purpose, as it provides a more stable surface for the ball, and serves to position the ball properly for better and more realistic shots. If you have read above, the wall basically serves as the collision mesh for the flipper, instead of the actual mesh of the flipper. This means that you can adjust exactly how you want the ball to interact with the flipper, and set up the shots you want based on where the ball is on the flipper.

The wall is non rendered (not visible in game play) (Layer 3 in the editor) and is set to be "collidable" ONLY when the flippers are in it's downward position. When the key is pressed for the left flipper(s), a timer is called (TimerFL) that after a set amount of time, makes that wall "non-collidable". This is done to prevent interference with the ball if the ball is to the side of the flipper, or behind it and prevents the possibility of the ball being stuck.

When the flipper key is unpressed, we do the opposite. We call a timer (TimerFlipL) so that after the set time used by the timer, the wall is set back to collidable. You can set this timer (and the right side timer called TimerFlipR) in the editor by clicking on the timer object (It's in layer 4) and setting the interval. Default is 150 (1000 = one second) and was done this way to make it easier to adjust. The other timers are script based.

ADJUSTMENTS

Here's the bugaboo, There is no way to explain how to set the flippers perfectly in one shot for your table. It's very subjective, and it totally depends on you on how you want your table to play. Pinball design is not easy, you just can't slap a few objects on the table, and then expect people to do cartwheels over it. There is a art to it, but also, as a designer, you set the table in such a way for how you want people to play your game. Little things count, including a shot off the flipper tip. Where do you want it to go exactly? Do you want the natural tip shot to hit the bottom target, or do you want it to always hit the post before it and do nothing but bounce. Or, maybe you just want to use the stock flipper model and stock settings and have the ball hit the slingshot instead?

As hard as it is to adjust flippers to get the most out of them, the real trick is deciding what is the most fun shot, the shot that makes the player happy as opposed to annoyed, and then trying to balance the flipper to give you as many satisfying shots as possible. You are just not designing the game, you are also designing how the game plays.

So, this is what this mod helps you with. It's still the same old crappy FP physics, but it works around some of the flaws by changing the angles of when the flipper strikes the ball, and also bypassing some of the more dodgy aspects of Future Pinball. The concept is simple of the 3 main objects used, so here's what they do as their primary function.

- The large flipper (The visible one to the player) handles the shots to the opposite side. If you draw a line straight up from exactly between the flippers, then the shots from this flipper should be on the opposite side of the flipper. For example, shooting from the right flipper will hit the target bank, the hyperspace and the little loop shot. Usually I set the left flipper angle to 116, and a good but not too fast strength. (about halfway) Strength does affect the angles of the shot as well, a weak shot is very noticeable and has a very sloppy feel to it. I used 52 for the swing settings here, I'm not sure what difference it actually makes, it was set so the ball will roll down the flipper and not be interfered by the slingshot post above it.

- The small flipper (Usually hidden) handles the more center based shots. In Star Trek, I use a small trigger to restrict when the flipper flips or not, that way I make sure that the flipper is striking the ball exactly where I want it to, so I can make that center target. If you change the trigger to another bigger size, you will see the shots change. Usually I set the left small flipper angle to 115, (more center based) and strength weaker than the main flipper, so the ball doesn't shoot out so fast (looks far better, especially for known backhand shots like in Flash Gordon).
The swing is important, I set it to 50. If you notice, I only expose the part of the small flipper, the tip area is actually tucked ever so slightly behind the main flipper when both flippers are up. This allows the ball to flow smoothly up or down the flippers without any noticeable "bumps"

- The wall serves to replace the collision map of the flipper, but it also serves to set the ball exactly at the correct position and adds stability for the shots you want. You will notice how this is done in Star Trek, Playboy and the example table. The wall starts at the same line as the flipper from the base, and once it clears past the trigger, it curves horizontally to past the tip. By changing the position and angle of the ball for when the flipper strikes it, you solve the "too much to one side" problem, and gain for more control to have precise shots.
If you adjust the "hook" downward, the natural shot of the ball will be more downward, if you adjust the hook higher, the ball will have a tendency to move more vertically towards the center.

- The triggers set exactly where you want the small flipper to strike the ball. Moving it left or right will adjust the shot left or right accordingly. If you increase the size of the trigger, you increase the amount of area of that flipper to strike the ball. With Star Trek, I used the smallest trigger, because there is only one target, but if you have a game with 4 or 5 targets in the center (Like Alien Poker) you may want to use a larger trigger so you have a better range

- The timers are script base, they serve to set which flipper does what first, and prevent mishits and weird ball movement. You can set the interval for them as the delay, as they handle the flippers and the wall.

THE SCRIPT

The script itself for the tutorial has loads of comments to help you track the code. Some portions you have to copy into existing subroutines (If you use the stock "new table" template included with Future pinball) and others are self contained subroutines.

Here's a copy of the complete script, it should be pretty easy to follow as any excess code is removed:

Code:
' *********************************************************************
' ***********                   Blue's Mods                ************
' *********************************************************************
' Copy and paste into your script in the following subroutines

' this goes at the top of your script
' these control the variables so the script knows if the trigger to control the small flippers is rolled over by the ball
Dim UseRightFlipperMid,UseLeftFlipperMid

' When the table is first started by pressing play in the editor
Sub FuturePinball_BeginPlay()
' This is a error catcher more than anything, this sets the initial values of the two variables for the small flipper
   UseRightFlipperMid=0
   UseLeftFlipperMid=0
' this is just so you can play the example, no need to add this in your code
   Drain.CreateBall()
   Drain.SolenoidOn()
End Sub

' Find and replace your flipper code in these routines, this is when the player presses the key for the flipper(s)
Sub FuturePinball_KeyPressed(ByVal KeyCode)

' The Player is Pulling back the Plunger. There is no need to add this, this is just so the tutorial table will play
   If (KeyCode = GetKeyCode(PlungerKey)) Then
      Plunger.Pull()
   End If

 ' *** Flipper Key Pressed ***
   If KeyCode = GetKeyCode(LeftFlipperKey) Then
      If UseLeftFlipperMid = 1 then                     ' see if the left flipper key is pressed down and the ball is over the trigger rollover
         LF.SolenoidOn                                 ' If so, activate the small flipper so it swings upward
         TimerLF.Interval = 25                        ' Makes sure small flipper is up before main flipper, by setting the interval, before it...
         TimerLF.Enabled = True                        ' swings the main flipper at the end of the timer interval
      Else
         LeftFlipper.SolenoidOn                        ' if the trigger is not rollovered, then just swing the main flipper, NOT the small flipper
      End If
      TimerFL.Interval = 150:TimerFL.Enabled = True   ' Sets a delay so the left wall becomes non-collidable, and out of the way if the ball is behind the wall
   End If

' Right flipper, like the left flipper in code
'
   If KeyCode = GetKeyCode(RightFlipperKey) Then
      If UseRightFlipperMid = 1 then                   ' see if the right flipper key is pressed down and the ball is over the trigger rollover
         RF.SolenoidOn
         TimerRF.Interval = 25:TimerRF.Enabled = True
      Else
         RightFlipper.SolenoidOn
      End If
      TimerFR.Interval = 150:TimerFR.Enabled = True   ' sets the right wall timer
   End If
   ' *** End ***
End Sub

' This is when the player releases the flipper key
'
Sub FuturePinball_KeyReleased(ByVal KeyCode)
' The Player has released the Plunger, Let it go... This is not needed, it's in the script so you can play the tutorial table
   If (KeyCode = GetKeyCode(PlungerKey)) Then
      Plunger.LetGo()
   End If

' *** Flipper Key Released ***
   If KeyCode = GetKeyCode(LeftFlipperKey)  Then
      LeftFlipper.SolenoidOff                         ' Drop the main flipper
      LF.SolenoidOff                                    ' Drop the small "hidden" flipper
      UseLeftFlipperMid=0                              ' make sure the trigger variable is "off"
      TimerFlipL.Enabled = True                        ' make the wall become "colidable" again. The interval is set in the editor, as this may need fine tuning
   End If

' Right flipper, pretty much exactly like the left flipper
   If KeyCode = GetKeyCode(RightFlipperKey) Then
      RightFlipper.SolenoidOff
      RF.SolenoidOff
      UseRightFlipperMid = 0
      TimerFlipR.Enabled = True
   End If
End Sub

' *** Copy and Paste this next part, till you hit "END" ***

' Left flipper Code

' Sets small hidden flipper to be active or not for center shots
Sub TriggerLFM_Hit():UseLeftFlipperMid = 1:End Sub
Sub TriggerLFM_UnHit():UseLeftFlipperMid = 0:End Sub

' Flipper(s) is up, so turn off the wall so it's no longer collidable
' This is called by the Sub FuturePinball_KeyPressed subroutine
Sub TimerFL_Expired()
   TimerFL.Enabled = False
   FlipWallLeft.Collidable=FALSE
end sub

' delays main flipper going up if TriggerLFM_Hit, so the small flipper swings first before the main flipper does.
' This is called by the Sub FuturePinball_KeyPressed subroutine
Sub TimerLF_Expired()
   TimerLF.Enabled = False
   LeftFlipper.SolenoidOn
end sub

' Restores wall if flippers are in their downward position.
' This is called by the Sub FuturePinball_KeyReleased subroutine
Sub TimerFlipL_Expired():
   TimerFlipL.Enabled = False
   FlipWallLeft.Collidable=TRUE
End Sub

' Right Flipper
' (pretty much the same as the left flipper)
' small hidden flipper to be active or not for center shots
Sub TriggerRFM_Hit():UseRightFlipperMid = 1:End Sub
Sub TriggerRFM_UnHit():UseRightFlipperMid = 0:End Sub

' Flipper up, turn off wall, set variable
Sub TimerFR_Expired()
   TimerFR.Enabled = False:FlipWallRight.Collidable=FALSE
end sub

' sets delay for a flipper flip if TriggerRFM_Hit
Sub TimerRF_Expired()
   TimerRF.Enabled = False:RightFlipper.SolenoidOn
end sub

' Restores wall if flipper down
Sub TimerFlipR_Expired():
   TimerFlipR.Enabled = False:FlipWallRight.Collidable=TRUE
End Sub

' *** End of copy and paste ***

' ****** These subroutines may be named differently!!! You have to find the end of ball and the game end subroutines ****

' this is at the end of a players ball, when it hits the drain. This just clears all variables to start over
Sub EndOfBallComplete()
   ' *** Drop Flippers ***
   LeftFlipper.SolenoidOff: RightFlipper.SolenoidOff:RF.SolenoidOff:LF.SolenoidOff   ' Flippers Off
   TimerFlipL.Enabled = True:TimerFlipR.Enabled = True                               ' Walls become "collidable"
   UseRightFlipperMid=0:UseLeftFlipperMid=0                                          ' Reset Variables
   ' *** End ***
End Sub

' End of Game routine for when the player is finished all his balls. This just clears all variables
Sub EndOfGame()
   LeftFlipper.SolenoidOff: RightFlipper.SolenoidOff:RF.SolenoidOff:LF.SolenoidOff   ' Flippers Off
   UseRightFlipperMid=0:UseLeftFlipperMid=0                                          ' Reset variables
End Sub

' this goes in your tilt code, if you have any
Sub FuturePinball_Tilted()
   ' Drop Flippers
   LeftFlipper.SolenoidOff: RightFlipper.SolenoidOff:RF.SolenoidOff:LF.SolenoidOff
   TimerFlipL.Enabled = True:TimerFlipR.Enabled = True ' switchs flippers off
End Sub


' *** End ***

' this is so you can play the example, no need to add this in your code
Sub Drain_Hit()
   Drain.SolenoidOn()
End Sub


You do not have the required permissions to view the files attached to this post.

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: FPx Template Engine


Top 
 Profile  
 
 Post subject: Re: Blues Flippers version 2 example and tutorial
 Post Posted: Tue Nov 01, 2016 11:28 pm 
Offline

Joined: Sat Oct 15, 2016 11:16 pm
Posts: 32
Excellent!

Thank you for writing this up.


Top 
 Profile  
 
 Post subject: Re: Blues Flippers version 2 example and tutorial
 Post Posted: Wed Nov 02, 2016 12:32 am 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 1212
Location: Arkansas, USA
The demo table helps a lot.

Thanks,

George


Top 
 Profile  
 
 Post subject: Re: Blues Flippers version 2 example and tutorial
 Post Posted: Fri Nov 04, 2016 4:56 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 1212
Location: Arkansas, USA
Blue,

I have been experimenting with your flippers. Your flipper models are a bit fatter that the ones on the table I am editing but they are about the same length and appear to work OK.

I noticed that in your demo table, the timer "TimerRF" is set to 150 milliseconds and "TimerLF" is set to 175 milliseconds. Is this a mistake? I don't even know what this setting does actually. Both flippers appear to work in the demo.

Also, my table has a T1 short flipper on it. Is there any advantage to doing a Zed double flipper on it or should I just not do anything to it?

George


Top 
 Profile  
 
 Post subject: Re: Blues Flippers version 2 example and tutorial
 Post Posted: Fri Nov 04, 2016 9:47 pm 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 236
Location: Abbotsford
The demo table was rushed, so missed the timer difference. You can set it to what you want actually, as long as it works.

Quote:
- When the ball is over the trigger ( TriggerLFM_Hit() ), it sets a "flag" (UseLeftFlipperMid = 1) to tell the game that the small flipper is active, starts the small flipper to "flip" with a keypress and then calls a timer (TimerLF.Enabled) after a set amount of time before it flips the main flipper. This assures that the small flipper will strike the ball before the main flipper.


The T1 flipper by itself should be fine, I'm not sure what differences the different flipper models have, doesn't seem to be all that much, other than the length. If you don't get the results like Star trek with one flipper, then try it with 2, see if it works.

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: FPx Template Engine


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 5 posts ] 

Board index » Resources » Tutorials, how-to's, bug report and docs


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
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: