Jump to content



Photo
* * * * * 26 votes

WIP: Visual Pinball in Unity


  • Please log in to reply
813 replies to this topic

#141 BorgDog

BorgDog

    We come in peace.. shoot to kill.. shoot to kill.

  • Members
  • PipPipPipPip
  • 1,427 posts
  • Location:Leavenworth, WA

  • Flag: United States of America

  • Favorite Pinball: Alien Star, TNA



Posted 29 February 2020 - 05:00 PM

MPF can talk with Unity, and MPF can talk with VPX, but this project is not really vpx but a whole new thing based on vpx (at least that's how I see it), I'm thinking it could be made to work somehow by someone knowledgeable enough (not me ;) parts and pieces are there.  here's a couple links on the mpf side from a quick search:

 

http://docs.missionp...bcp_server.html

https://groups.googl...Uk/wg8f5UzmFAAJ



#142 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,170 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 03 March 2020 - 08:19 PM

Will this make vr possible without a seperate vpvr build.

Will the tables be loaded to unity and then launched or saved as standalone games.
Or loaded to vpengine and then launched. A little confused about this

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#143 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 03 March 2020 - 08:32 PM

The idea is that we create a "game" application, aka player, which is able to load and play normal and "extended" VPX files. This application uses the VPE library most of the time. There will probably be stuff that isn't in the library, like settings dialogs and general interface-related things, but the core would be provided by VPE. It would also include VR support.

 

The game application doesn't exist yet, during development we use the Unity editor directly to launch the game. There will however be a project at some point once we figure out how to deal with the runtime, packaging, how to include non-standard assets, deal with scripting and so on.

 

I hope that clears it up!


Edited by freezy, 03 March 2020 - 08:32 PM.


#144 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,170 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 03 March 2020 - 09:46 PM

Sweet. I'm looking forward to this, i want to start making some tables again but i will wait for this. Very impressive. Been following your github page

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#145 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 03 March 2020 - 11:12 PM

Yeah it's been fun so far and I'm learning a lot of new stuff. That's also why I haven't given a lot of updates. I'm currently trying to port the physics engine in a way it's multi-threaded and dynamic (in order to eliminate all the collider toggles in the scripts), so I'm not rushing. I'm also very happy that @ravarcade joined the project, he's been a huge help so far.

 

Right now we're battling package dependency hell, meaning no visuals to show off, but we'll post as soon as there is something. :)



#146 hlr53

hlr53

    Pinball Fan

  • Gold Supporter
  • 683 posts
  • Location:Kettering OH

  • Flag: United States of America

  • Favorite Pinball: 1964 Williams Palooka Joe

Posted 03 March 2020 - 11:49 PM

ECS and Burst?


Former Cab: 40" Haier, 28" I-INC, i7-6700, 1080 GPU, v3DMD, 4D7 solenoids. Altec-Lansing speakers and sub. Artwork by Stuzza. Printing by Brad Bowman. VR HP reverb


#147 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 03 March 2020 - 11:51 PM

Yes.



#148 Ben Logan

Ben Logan

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 2,275 posts
  • Location:California

  • Flag: ---------

  • Favorite Pinball: System 11

Posted 04 March 2020 - 03:04 AM

Awesome to have ravarcade in the mix. Always inspiring to see such talented people collaborating. Thanks, guys!



#149 Mr H

Mr H

    Enthusiast

  • Members
  • PipPipPip
  • 96 posts

  • Flag: Australia

  • Favorite Pinball: Monsterbash

Posted 04 March 2020 - 03:33 AM

Just thinking out loud. Wondering if the camera in Unity will be able to improve POV for cab users and make it look more deeper with a realistic perspective at the back. Always feel that the camera or table itself needs to be skewed at the top of the playfield further way?!

And if it can produce better flipper physics eg a tap pass


Edited by Mr H, 04 March 2020 - 03:49 AM.


#150 rothbauerw

rothbauerw

    Enthusiast

  • Members
  • PipPipPip
  • 345 posts
  • Location:Wisconsin - USA

  • Flag: United States of America

  • Favorite Pinball: Dr Who, Tee'd Off, Jive Time

Posted 04 March 2020 - 07:21 PM

And if it can produce better flipper physics eg a tap pass

 

From what I've read here, physics will be ported from VPX, so the core VPX physics engine would need to be enhanced. 

 

I recently did a fairly in depth analysis of flipper behavior and identified a number of areas the current engine either doesn't handle or doesn't handle sufficiently.  I've been able to solve a number of those deficiencies through scripting, although building them into the engine at some point would be ideal.  For example, coil ramp up is linear in VP, while in reality, it should be non-linear.  

 

If you look at Flupper's Totan, Skitso's latest Medival Madness & Twilight Zone, or some of bord's newer tables, tap passes (and a number of other flipper tricks) work on all of those tables.



#151 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 04 March 2020 - 07:53 PM

@rothbauerw ping me for a Discord invite if you want to tune flipper physics. They're moving now, multi-threaded, but I'm still working on collision. Here's how I compared them with VPX:

unknown.png

If there are parameters you'd like to have more control over in the engine (while keeping backwards compatibility), it would be interesting to know about.



#152 Ben Logan

Ben Logan

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 2,275 posts
  • Location:California

  • Flag: ---------

  • Favorite Pinball: System 11

Posted 04 March 2020 - 08:35 PM

Can I give a potentially controversial opinion on tap-pass functionality? Flick pass functionality is great: It's nice to give the ball a little "flick" by micro-flipping the flipper when it's at its fully extended position as the ball rolls from the fat part of the bat toward the tip. Flick passes are useful for jumping the gap between flippers. They're useful for loop passes, etc. You guys already know all this, of course.

 

Tap passes, on the other hand, aren't worth trade-off in terms of latency, in my opinion. They're rarely done, even by the pros. Super dangerous move! I watch tons of EM gameplay on PAPA TV (an embarrassing amount, really). I've never once seen a tap pass -- either in PAPA casual or competition videos. Even Bowen Kerins talks about why he never tries them in Drop Target magazine. I promise I'm not trying to sound like a know-it-all, here!

 

It'd be a cool novelty to have built in, But, to read a tap pass, the flipper physics engine necessarily has to "poll" each press to distinguish between "Is this a 'full flip' being called for here, or a tap pass?" That takes time and adds latency, right? Maybe I'm misunderstaning. If so, someone set me straight!

 

I made this same argument on the Zen forums. Latency is the enemy of digital pinball realism. They were showing off new tap pass functionality. I argued it wasn't worth it to slow down flippers on every flip, for the odd chance that someone is able to "Shatz the inlane" once on an EM, e.g.

 

All this is meant with the utmost respect for rothbauerw, and many others who've made countless refinements to flipper feel and accuracy. Like many of you guys, I've got a bunch of real machines (six big headaches!) in the garage. It's really astounding how close we're getting in terms of accuracy with VPX.


Tap pass:

 

https://funwithbonus...onary-tap-pass/

 

Here's a tap pass gif:

 

https://funwithbonus...ip-TAP-PASS.gif

 

DeadFlip-TAP-PASS.gif

 

 

 

Flick pass, in contrast is a must have! Note, any added latency here comes after the flipper is already fully extended. Much less noticeable in terms of "snappy" feel reduction. Here's a flick pass gif:

 

https://images.squar.../FLICK-PASS.gif

 

FLICK-PASS.gif

 

 

Totally ok if you guys disagree! Just stating a personal preference here.


Edited by Ben Logan, 04 March 2020 - 08:44 PM.


#153 ludovids

ludovids

    Enthusiast

  • Validating
  • PipPipPip
  • 181 posts
  • Location:Owego, NY

  • Flag: United States of America

  • Favorite Pinball: LOTR IJ MM TAF Tommy TOTAN TZ

Posted 04 March 2020 - 10:43 PM

Great post, Ben.


Edited by ludovids, 05 March 2020 - 11:36 PM.

ASRock Z270M Extreme4, i5-7600K, 16GB G.SKILL TridentZ DDR4 3200, EVGA GeForce GTX 1070 SC

Samsung 850 EVO M.2, Samsung UN40JU7100 4K playfield, Samsung SynchMaster 2232 backglass, Pinscape on VirtuaPin Plunger Kit v3


#154 rothbauerw

rothbauerw

    Enthusiast

  • Members
  • PipPipPip
  • 345 posts
  • Location:Wisconsin - USA

  • Flag: United States of America

  • Favorite Pinball: Dr Who, Tee'd Off, Jive Time

Posted 05 March 2020 - 12:04 AM

Can I give a potentially controversial opinion on tap-pass functionality? Flick pass functionality is great: It's nice to give the ball a little "flick" by micro-flipping the flipper when it's at its fully extended position as the ball rolls from the fat part of the bat toward the tip. Flick passes are useful for jumping the gap between flippers. They're useful for loop passes, etc. You guys already know all this, of course.

 

Tap passes, on the other hand, aren't worth trade-off in terms of latency, in my opinion. They're rarely done, even by the pros. Super dangerous move! I watch tons of EM gameplay on PAPA TV (an embarrassing amount, really). I've never once seen a tap pass -- either in PAPA casual or competition videos. Even Bowen Kerins talks about why he never tries them in Drop Target magazine. I promise I'm not trying to sound like a know-it-all, here!

 

It'd be a cool novelty to have built in, But, to read a tap pass, the flipper physics engine necessarily has to "poll" each press to distinguish between "Is this a 'full flip' being called for here, or a tap pass?" That takes time and adds latency, right? Maybe I'm misunderstaning. If so, someone set me straight!

 

I made this same argument on the Zen forums. Latency is the enemy of digital pinball realism. They were showing off new tap pass functionality. I argued it wasn't worth it to slow down flippers on every flip, for the odd chance that someone is able to "Shatz the inlane" once on an EM, e.g.

 

All this is meant with the utmost respect for rothbauerw, and many others who've made countless refinements to flipper feel and accuracy. Like many of you guys, I've got a bunch of real machines (six big headaches!) in the garage. It's really astounding how close we're getting in terms of accuracy with VPX.


Tap pass:

 

https://funwithbonus...onary-tap-pass/

 

Flick pass, in contrast is a must have! Note, any added latency here comes after the flipper is already fully extended. Much less noticeable in terms of "snappy" feel reduction. Here's a flick pass gif:

 

Totally ok if you guys disagree! Just stating a personal preference here.

 

I appreciate you chiming in Ben.  I will agree with you on a couple of points and I disagree or have a different point of view on some others.  

 

I agree that tap passes are not practical and are seldom if ever used.  And they should not be implemented if they add unrealistic latency.

 

My goal has always been and will always be to simulate real flipper behavior.  Flipper skills should seamlessly transition from digital to real pinball.

 

Behaviors that need to accurately accounted for include:

 

  • The time it takes for the flipper to reach end of stroke from button push
  • The trajectory of various shots
  • The time it takes for the flipper to drop from button release
  • The decrease in elasticity when the ball strikes a flipper in the down position due to play in the linkages
  • The flipper extending past the end angle and bouncing back at the end of stroke due to momentum and play in the linkages
  • The change in rate of flipper acceleration due to the ramp up of current in the flipper coil.
  • Etc

Much of this was thought about in the VPX physics engine but is not always satisfactorily accounted for.

 

Regarding tap passes.  The physics engine doesn't have to do anything magical regarding how it polling a button press.  It just needs to read when the button was pressed and when the button was released.  The issue with tap passes in VP has typically been that regardless of how long the button was pressed, the strength of the flip ramps up too quickly resulting in a full or mostly full flip.  Coil ramp up can be used to slow the ramp up of flip strength when the button is pressed, but setting that value high enough to allow for tap passes usually results in high latency and slow flippers.  With a little scripting magic, we can change the coil ramp-up on the fly creating a more realistic coil ramp up curve in the first few micro seconds of the flip.  This results in a slower ramp up in flipper strength in the first few microseconds and allows for a partial flip and more closely simulating real flipper behavior without introducing unrealistic latency.  In fact, I'd argue that the overall timing of the flip is more realistic.

 

So to me, it's less about whether you can or will use a tap pass and more about is the flipper acting the way it should based on the players input.  A tap pass is a great boundary test to make sure the flipper is behaving properly in the first few microseconds of the flip.

 

With that said, if you think the latest iterations of the flippers have too much lag, I'm all ears.  I've tested based on feel as well as run timing simulations and both indicate to me that's not the case.



#155 Ben Logan

Ben Logan

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 2,275 posts
  • Location:California

  • Flag: ---------

  • Favorite Pinball: System 11

Posted 05 March 2020 - 03:50 AM

Totally brilliant and clear explanation, rothbauerw. Really appreciate you for taking time to explain. Makes sense. Super thankful that we have such intelligent and creative people collaborating here. Your contribution to VP has been and continues to be outstanding, sir! 



#156 Fleep

Fleep

    Enthusiast

  • Members
  • PipPipPip
  • 163 posts

  • Flag: ---------

  • Favorite Pinball: Theatre of Magic

Posted 05 March 2020 - 05:28 AM

Totally brilliant and clear explanation, rothbauerw. Really appreciate you for taking time to explain. Makes sense. Super thankful that we have such intelligent and creative people collaborating here. Your contribution to VP has been and continues to be outstanding, sir! 


rothbauerw is the man :-)


Sent from my iPhone using Tapatalk
"..Make the ball vanish!.."

#157 Mr H

Mr H

    Enthusiast

  • Members
  • PipPipPip
  • 96 posts

  • Flag: Australia

  • Favorite Pinball: Monsterbash

Posted 05 March 2020 - 05:59 AM

Nicely written Rothbauerw, everything you said is spot on. And thanks a bunch for everything you have done for this community in particular of recent times with the physics, I feel its making massive difference. I'm no super pinball pro (and unfortunately where I grew up pinball was pretty much non existent so these days I'm making up for lost time mostly with my vpcab), but I do notice the button press\flipper strength difference between a virtual v's a real pin, and can't wait for the day where people who play a lot of both say 'yep its pretty much the same feel these days'. Loving being a part of this community, particularly right now with these progressions. Exciting times.


Edited by Mr H, 05 March 2020 - 06:26 AM.


#158 dbknightx

dbknightx

    Hobbyist

  • Members
  • PipPip
  • 26 posts

  • Flag: United States of America

  • Favorite Pinball: Lord of the Rings

Posted 07 March 2020 - 03:10 PM

Awesome discussion around flipper physics, and I’m glad to see the desire to push things to be more accurate.  One question I have is around coil strength.  Is that something that could be made configurable by table authors?  For example, I own a LOTR and it is famous for requiring just the right type of coil to reliably hit the ring ramp but not go flying off the Legolas ramp.  Modern Sterns are famous for having stronger flippers than 90’s Bally/Williams.  I’m no expert but it seems like there would need to be some variability.

 

TOTAN was mentioned above and I agree completely.  The flippers are perfect on that game - makes that ramp shot just as annoying to make as on the real machine ;)

 

Thanks again to everybody helping to improve VP physics.  I agree this is such an exciting time!



#159 Nate D

Nate D

    Enthusiast

  • Members
  • PipPipPip
  • 116 posts
  • Location:Champaign, IL USA

  • Flag: United States of America

  • Favorite Pinball: Black Knight 2000

Posted 08 March 2020 - 04:39 AM

 


 

I appreciate you chiming in Ben.  I will agree with you on a couple of points and I disagree or have a different point of view on some others.  

 

I agree that tap passes are not practical and are seldom if ever used.  And they should not be implemented if they add unrealistic latency.

 

My goal has always been and will always be to simulate real flipper behavior.  Flipper skills should seamlessly transition from digital to real pinball.

 

Behaviors that need to accurately accounted for include:

 

  • The time it takes for the flipper to reach end of stroke from button push
  • The trajectory of various shots
  • The time it takes for the flipper to drop from button release
  • The decrease in elasticity when the ball strikes a flipper in the down position due to play in the linkages
  • The flipper extending past the end angle and bouncing back at the end of stroke due to momentum and play in the linkages
  • The change in rate of flipper acceleration due to the ramp up of current in the flipper coil.
  • Etc

Much of this was thought about in the VPX physics engine but is not always satisfactorily accounted for.

 

Regarding tap passes.  The physics engine doesn't have to do anything magical regarding how it polling a button press.  It just needs to read when the button was pressed and when the button was released.  The issue with tap passes in VP has typically been that regardless of how long the button was pressed, the strength of the flip ramps up too quickly resulting in a full or mostly full flip.  Coil ramp up can be used to slow the ramp up of flip strength when the button is pressed, but setting that value high enough to allow for tap passes usually results in high latency and slow flippers.  With a little scripting magic, we can change the coil ramp-up on the fly creating a more realistic coil ramp up curve in the first few micro seconds of the flip.  This results in a slower ramp up in flipper strength in the first few microseconds and allows for a partial flip and more closely simulating real flipper behavior without introducing unrealistic latency.  In fact, I'd argue that the overall timing of the flip is more realistic.

 

So to me, it's less about whether you can or will use a tap pass and more about is the flipper acting the way it should based on the players input.  A tap pass is a great boundary test to make sure the flipper is behaving properly in the first few microseconds of the flip.

 

With that said, if you think the latest iterations of the flippers have too much lag, I'm all ears.  I've tested based on feel as well as run timing simulations and both indicate to me that's not the case.

 

 

and bge with last 2.82 ? realistic simulation (bullet ) or future new bge based on  eevee ?

 

 

and for gameplay, what is the equivalent in python of this script ?

' *********************************************************************
' **                                                                 **
' **                        FUTURE PINBALL                           **
' **                                                                 **
' **                   Generic Table Script v1.0                     **
' **                                                                 **
' **     (C) 2007 Chris Leathley - BSP Software Design Solutions     **
' **                                                                 **
' ** This script should provide a simple frame work you can use in   **
' ** your own tables as a starting point.                            **
' **                                                                 **
' *********************************************************************

Option Explicit				' Force explicit variable declaration


' Define any Constants 
Const constMaxPlayers 		= 4 		' Maximum number of players per game (between 1 and 4)
Const constBallSaverTime	= 5000	' Time in which a free ball is given if it lost very quickly
												' Set this to 0 if you don't want this feature
Const constMaxMultiplier	= 6		' Defines the maximum bonus multiplier level

' Define Global Variables
'
Dim PlayersPlayingGame		' number of players playing the current game
Dim CurrentPlayer				' current player (1-4) playing the game
Dim BonusPoints(4)			' Bonus Points for the current player
Dim BonusMultiplier(4)		' Bonus Multiplier for the current player
Dim BallsRemaining(4)		' Balls remaining to play (inclusive) for each player
Dim ExtraBallsAwards(4)		' number of EB's out-standing (for each player)

' Define Game Control Variables
Dim LastSwitchHit				' Id of last switch hit
Dim BallsOnPlayfield			' number of balls on playfield (multiball exclusive)
Dim BallsInLock				' number of balls in multi-ball lock

' Define Game Flags
Dim bFreePlay					' Either in Free Play or Handling Credits
Dim bOnTheFirstBall			' First Ball (player one). Used for Adding New Players
Dim bBallInPlungerLane		' is there a ball in the plunger lane
Dim bBallSaverActive			' is the ball saver active 
Dim bMultiBallMode			' multiball mode active ?
Dim bEnteringAHighScore		' player is entering their name into the high score table



' *********************************************************************
' **                                                                 **
' **               Future Pinball Defined Script Events              **
' **                                                                 **
' *********************************************************************


' The Method Is Called Immediately the Game Engine is Ready to 
' Start Processing the Script.
'
Sub FuturePinball_BeginPlay()
	' seed the randomiser (rnd(1) function)
	Randomize

	' initalise the player display reel to the last known player scores 
	Player1Reel.SetValue(nvScore1)
	Player2Reel.SetValue(nvScore2)
	Player3Reel.SetValue(nvScore3)
	Player4Reel.SetValue(nvScore4)

	' We want the player to put in credits (Change this 
	bFreePlay = FALSE

	' kill the last switch hit (this this variable is very usefull for game control)
	set LastSwitchHit = DummyTrigger

	' initialse any other flags
	bOnTheFirstBall = FALSE
	bEnteringAHighScore	= FALSE
	BallsOnPlayfield = 0
	BallsInLock	= 0

	EndOfGame()
End Sub


' This Method is Called when the user has exited the Game Player. It should
' save any RAM variables that need to be persistant.
'
Sub FuturePinball_EndPlay()
End Sub


' The User Has Pressed A Key on the Keyboard..
'
Sub FuturePinball_KeyPressed(ByVal KeyCode)
	'AddDebugText "KeyCode = " & KeyCode
	'AddDebugText "Titled = " & fpTilted
	'
	' Process any keys which are valid at all times
	'

	' The Player has Inserted a Coin
	If (KeyCode = GetKeyCode(InsertCoinKey)) Then
		PlaySound "CoinIn"
		nvCredits = nvCredits + 1
		'AddDebugText "Insert Coin, Credits = " & nvCredits
		' If not Tilted, then give some feed back to the player
		If (fpTilted = FALSE) Then
			' Flash the Slingshot Bulbs. This is rather Common on Pinball machines
			' though you can do anything at this point
			LeftSlingshotBulb1.FlashForMs  200, 100, BulbOff
			LeftSlingshotBulb2.FlashForMs  200, 100, BulbOff
			RightSlingshotBulb1.FlashForMs 200, 100, BulbOff
			RightSlingshotBulb2.FlashForMs 200, 100, BulbOff
			' Maybe play a sound at this point or put something on the display
		End If
	End If

	' The Player is Pulling back the Plunger
	If (KeyCode = GetKeyCode(PlungerKey)) Then
		Plunger.Pull
	End If


	'
	' Process The Next set of keys depeding of wether there is a game in progress or not
	'

	' Is A Game in Progress?
	If (fpGameInPlay = TRUE) Then
		' and not Tilted ?
		If (fpTilted = FALSE) Then

			' If the Left Flipper Key Has Been Press, Activate The Left Flipper(s)
			If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
				LeftFlipper.SolenoidOn
				PlaySound "Flipper"
			End If

			' If the Right Flipper Key Has Been Press, Activate The Right Flipper(s)
			If (KeyCode = GetKeyCode(RightFlipperKey)) Then
				RightFlipper.SolenoidOn
				PlaySound "Flipper"
			End If

			' Another player starting?
			If (KeyCode = GetKeyCode(StartGameKey)) Then
				' must be less than max players and must be on the the very first ball of the game
				If ((PlayersPlayingGame < constMaxPlayers) And (bOnTheFirstBall = TRUE)) Then
					' free play or credits
					If (bFreePlay = TRUE) Then
						' add the extra player
						PlayersPlayingGame = PlayersPlayingGame + 1
						'AddDebugText "Extra Player (Free Play)" & PlayersPlayingGame
						' Update the stats
						nvTotalGamesPlayed = nvTotalGamesPlayed + 1
					Else
						If (nvCredits > 0) then
							PlayersPlayingGame = PlayersPlayingGame + 1
							'AddDebugText "Extra Player (Credits)" & PlayersPlayingGame
							' update the stats
							nvTotalGamesPlayed = nvTotalGamesPlayed + 1
							nvCredits = nvCredits - 1
						Else
							' Not Enough Credits to start a game.  
							' Maybe Play a Sound or put "Insert Coin" on a display
						End If
					End If
				End If
			End If
		End If ' If (fpTilted)

	Else	' If (fpGameInPlay)
		
		' there isn't a game in play (we are in the attract mode)
      ' wait for the start key to be pressed and start a new game
      If (KeyCode = GetKeyCode(StartGameKey)) Then
			' Free Play Mode ?
			If (bFreePlay = TRUE) Then
				' Yep.  Only allow a game to Start if there are no balls on the playfield.
				' This can happen if the player starts a game too quick after finishing the
				' last game and the machine is ejecting any locked balls.
				If (BallsOnPlayfield = 0) Then
					' A Game is now in progress, reset the table for a new Game
					ResetForNewGame()
				End If
			Else
				' paying by credits, do we have any ?
				If (nvCredits > 0) Then
					' Yep.  Only allow a game to start if there are no balls on the playfield
					If (BallsOnPlayfield = 0) Then
						' remove a credit
						nvCredits = nvCredits - 1
						' much the same as above
						ResetForNewGame()
					End If
				Else
					' Not Enough Credits to start a game.  
					' Maybe Play a Sound or put "Insert Coin" on a display
				End If
			End If
		End If

	End If ' If (fpGameInPlay)
End Sub


' The User Has Released A Key on the Keyboard..
'
Sub FuturePinball_KeyReleased(ByVal KeyCode)

	'
	' Process any keys which are valid at all times
	'

	' The Player has released the Plunger, Let it go..
	If (KeyCode = GetKeyCode(PlungerKey)) Then
		Plunger.LetGo
		PlaySound "PlungerRelease"
	End If

	'
	' Process The Next set of keys depeding of wether there is a game in progress or not
	'

	' Is A Game in Progress?
	If (fpGameInPlay = TRUE) Then
		' and not tilted
		If (fpTilted = FALSE) Then

			' The Left Flipper Key has been released, Turn Off the Left Flipper(s)
			If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
				LeftFlipper.SolenoidOff
			End If

			' The Right Flipper Key has been released, Turn Off the Right Flipper(s)
			If (KeyCode = GetKeyCode(RightFlipperKey)) Then
				RightFlipper.SolenoidOff
			End If
		End If
	End If
End Sub


' The User Has Paused The Game.. 
'
Sub FuturePinball_Paused()
End Sub


' The User Has UnPaused (Resumed) The Game.. 
'
Sub FuturePinball_UnPaused()
End Sub


' The Played has Nudged the Table a little too hard/much and a Warning
' must be given to the player
'
Sub FuturePinball_TiltWarning(ByVal Warnings)
	'AddDebugText "Tilt Warning" & Warnings

	' play a sound at this point and put something on a display
End Sub


' The Player has tilted the machine (Too Many Warnings)
'
Sub FuturePinball_Tilted()
	'AddDebugText "**Tilted**"

	' play a sound
	PlaySound "Tilt"

	' ensure that the flippers are down (as the keys won't work from now on)
	LeftFlipper.SolenoidOff
	RightFlipper.SolenoidOff

	' you may wish to turn off any lights at this point. (The Light Sequencer
	' will make this very easy)

	' start the tilt recovery timer which waits until all balls have drained
	' before doing the end of ball sequence (or end of game)
	TiltRecoveryTimer.Interval = 2000
	TiltRecoveryTimer.Enabled	= TRUE
End Sub


' A Music Channel has finished Playing. 
'
' Channel is set to the channel number that has finished.
'
Sub FuturePinball_MusicFinished(ByVal Channel)
End Sub


' High Score entry has been completed by the player. 
'
' Position is set to the position in the high score table (1 - 4)
' if it is set to 0 then there was no new High Score
'
' Special is set to 1 if the Special High Score was beaten
'
Sub FuturePinball_NameEntryComplete(ByVal Position, ByVal Special)
	' has the player beaten a high score
	If (Position <> 0) Then
		' maybe award something (like an extra credit) based on the high score position
	End If

	' has the player beaten the special score (if applicable)
	If (Special <> 0) Then
	End If

	bEnteringAHighScore = FALSE

	' check to see if there are any more players playing to the current game
	EndOfBallComplete()
End Sub



' *********************************************************************
' **                                                                 **
' **                     User Defined Script Events                  **
' **                                                                 **
' *********************************************************************

' Initialise the Table for a new Game
'
Sub ResetForNewGame()
	Dim	i

	'AddDebugText "ResetForNewGame"

	' get Future Pinball to zero out the nvScore (and nvSpecialScore) Variables
	' aswell and ensure the camera is looking in the right direction.
	' this also Sets the fpGameInPlay flag
	BeginGame()

	Player1Reel.ResetToZero
	Player2Reel.ResetToZero
	Player3Reel.ResetToZero
	Player4Reel.ResetToZero

	' increment the total number of games played
   nvTotalGamesPlayed = nvTotalGamesPlayed + 1

	' Start with player 1
	CurrentPlayer = 1

	' Single player (for now, more can be added in later)
	PlayersPlayingGame = 1

	' We are on the First Ball (for Player One)
	bOnTheFirstBall = TRUE

	' initialise all the variables which are used for the duration of the game
	' (do all players incase any new ones start a game)
	For i = 1 To constMaxPlayers
		' Bonus Points for the current player
		BonusPoints(i)	= 0
		' Initial Bonus Multiplier
		BonusMultiplier(i) = 1
		' Balls Per Game
		BallsRemaining(i) = nvBallsPerGame 
		' Number of EB's out-standing
		ExtraBallsAwards(i) = 0
	Next

	' initialise any other flags
	bMultiBallMode = FALSE

	' you may wish to start some music, play a sound, do whatever at this point

	' set up the start delay to handle any Start of Game Attract Sequence
	FirstBallDelayTimer.Interval = 500
	FirstBallDelayTimer.Enabled = TRUE
End Sub


' This Timer is used to delay the start of a game to allow any attract sequence to 
' complete.  When it expires it creates a ball for the player to start playing with
'
Sub FirstBallDelayTimer_Expired()
	' stop the timer
	FirstBallDelayTimer.Enabled = FALSE

	' reset the table for a new ball
	ResetForNewPlayerBall()

	' create a new ball in the shooters lane
	CreateNewBall()
End Sub


' (Re-)Initialise the Table for a new ball (either a new ball after the player has 
' lost one or we have moved onto the next player (if multiple are playing))
'
Sub ResetForNewPlayerBall()
	' make sure the correct display is upto date
	AddScore(0)

	' set the current players bonus multiplier back down to 1X
	SetBonusMultiplier(1)

	' reset any drop targets, lights, game modes etc..
	ShootAgainLight.State = BulbOff
End Sub


' Create a new ball on the Playfield
'
Sub CreateNewBall()
	' create a ball in the plunger lane kicker.
	PlungerKicker.CreateBall

	' There is a (or another) ball on the playfield
	BallsOnPlayfield = BallsOnPlayfield + 1

	' kick it out..
	PlungerKicker.SolenoidPulse
End Sub


' The Player has lost his ball (there are no more balls on the playfield).
' Handle any bonus points awarded
'
Sub EndOfBall()
	Dim BonusDelayTime

	'AddDebugText "EndOfBall"

	' the first ball has been lost. From this point on no new players can join in
	bOnTheFirstBall = FALSE

	' only process any of this if the table is not tilted.  (the tilt recovery 
	' mechanism will handle any extra balls or end of game)
	If (fpTilted = FALSE) Then
		Dim AwardPoints

		' add in any bonus points (multipled by the bunus multiplier)
		AwardPoints = BonusPoints(CurrentPlayer) * BonusMultiplier(CurrentPlayer)
		AddScore(AwardPoints)
		'AddDebugText "Bonus Points = " & AwardPoints

		' you may wish to do some sort of display effects which the bonus is 
		' being added to the players score

		' add a bit of a delay to allow for the bonus points to be added up
		BonusDelayTime = 1000
	Else
		' no bonus, so move to the next state quickly
		BonusDelayTime = 20
	End If

	' start the end of ball timer which allows you to add a delay at this point
	EndOfBallTimer.Interval = BonusDelayTime
	EndOfBallTimer.Enabled = TRUE
End Sub


' The Timer which delays the machine to allow any bonus points to be added up
' has expired.  Check to see if there are any extra balls for this player.
' if not, then check to see if this was the last ball (of the currentplayer)
'
Sub EndOfBallTimer_Expired()
	' disable the timer
	EndOfBallTimer.Enabled = FALSE

	' if were tilted, reset the internal tilted flag (this will also 
	' set fpTiltWarnings back to zero) which is useful if we are changing player LOL
	fpTilted = FALSE

	' has the player won an extra-ball ? (might be multiple outstanding)
	If (ExtraBallsAwards(CurrentPlayer) <> 0) Then

		'AddDebugText "Extra Ball"

		' yep got to give it to them
		ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) - 1

		' if no more EB's then turn off any shoot again light
		If (ExtraBallsAwards(CurrentPlayer) = 0) Then
			ShootAgainLight.State = BulbOff
		End If

		' You may wish to do a bit of a song and dance at this point

		' Create a new ball in the shooters lane
		CreateNewBall()

	Else	' no extra balls

		BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer) - 1

		' was that the last ball ?
		If (BallsRemaining(CurrentPlayer) <= 0) Then

			'AddDebugText "No More Balls, High Score Entry"

			' Submit the currentplayers score to the High Score system built into Future Pinball
			' if they have gotten a high score then it will ask them for their initials.  If not
			' it will call the FuturePinball_NameEntryComplete right away
			bEnteringAHighScore = TRUE
			EnterHighScore(CurrentPlayer)
			' you may wish to play some music at this point

		Else

			' not the last ball (for that player)
			' if multiple players are playing then move onto the next one
			EndOfBallComplete()

		End If
	End If
End Sub


' This function is called when the end of bonus display
' (or high score entry finished) and it either end the game or
' move onto the next player (or the next ball of the same player)
'
Sub EndOfBallComplete()
  Dim NextPlayer

	'AddDebugText "EndOfBall - Complete"

	' are there multiple players playing this game ?
	If (PlayersPlayingGame > 1) Then
		' then move to the next player
		NextPlayer = CurrentPlayer + 1
		' are we going from the last player back to the first
		' (ie say from player 4 back to player 1)
		If (NextPlayer > PlayersPlayingGame) Then
			NextPlayer = 1
		End If
	Else
		NextPlayer = CurrentPlayer
	End If

	'AddDebugText "Next Player = " & NextPlayer

   ' is it the end of the game ? (all balls been lost for all players)
	If ((BallsRemaining(CurrentPlayer) <= 0) And (BallsRemaining(NextPlayer) <= 0)) Then
		' you may wish to do some sort of Point Match free game award here
		' generally only done when not in free play mode

		' set the machine into game over mode
      EndOfGame()

		' you may wish to put a Game Over message on the 

	Else
		' set the next player
		CurrentPlayer = NextPlayer

		' make sure the correct display is upto date
		AddScore(0)

		' reset the playfield for the new player (or new ball)
		ResetForNewPlayerBall()

		' and create a new ball
		CreateNewBall()

	End If
End Sub


' This frunction is called at the End of the Game, it should reset all
' Drop targets, and eject any 'held' balls, start any attract sequences etc..
Sub EndOfGame()
	'AddDebugText "End Of Game"

	' let Future Pinball know that the game has finished.  
	' This also clear the fpGameInPlay flag.
	EndGame()

	' ensure that the flippers are down
	LeftFlipper.SolenoidOff
	RightFlipper.SolenoidOff

	' turn off the reel bulbs
	Player1Reel.State = BulbOff
	Player2Reel.State = BulbOff
	Player3Reel.State = BulbOff
	Player4Reel.State = BulbOff

	' set any lights for the attract mode
	SetAllLightsForAttractMode()

	' you may wish to light any Game Over Light you may have
End Sub


' The tilt recovery timer waits for all the balls to drain before continuing on 
' as per normal
'
Sub TiltRecoveryTimer_Expired()
	' disable the timer
	TiltRecoveryTimer.Enabled	= FALSE
	' if all the balls have been drained then..
	If (BallsOnPlayfield = 0) Then
		' do the normal end of ball thing (this dosn't give a bonus if the table is tilted)
		EndOfBall()
	Else
		' else retry (checks again in another second)
		TiltRecoveryTimer.Interval = 1000
		TiltRecoveryTimer.Enabled = TRUE
	End If
End Sub


' Set any lights for the Attract Mode.
'
Sub SetAllLightsForAttractMode()
	ShootAgainLight.State = BulbBlink
End Sub



' *********************************************************************
' **                                                                 **
' **                   Drain / Plunger Functions                     **
' **                                                                 **
' *********************************************************************

' lost a ball ;-( check to see how many balls are on the playfield.
' if only one then decrement the remaining count and test for End of game
' if more than 1 ball (multi-ball) then kill of the ball but don't create
' a new one
'
Sub Drain_Hit()
	' Destroy the ball
	Drain.DestroyBall
	BallsOnPlayfield = BallsOnPlayfield - 1
	' pretend to knock the ball into the ball storage mech
	PlaySound "Drain"

	' if there is a game in progress and 
	If (fpGameInPlay = TRUE) And (fpTilted = FALSE) Then

		' is the ball saver active,
		If (bBallSaverActive = TRUE) Then

			' yep, create a new ball in the shooters lane
			CreateNewBall()
			' you may wish to put something on a display or play a sound at this point

		Else

			' cancel any multiball if on last ball (ie. lost all other balls)
			'
			If (BallsOnPlayfield = 1) Then
				' and in a multi-ball??
				If (bMultiBallMode = True) then
					' not in multiball mode any more
					bMultiBallMode = False
					' you may wish to change any music over at this point and
					' turn off any multiball specific lights
				End If
			End If

			' was that the last ball on the playfield
			If (BallsOnPlayfield = 0) Then
				' handle the end of ball (change player, high score entry etc..)
				EndOfBall()
			End If

		End If
	End If
End Sub


' A ball is pressing down the trigger in the shooters lane
'
Sub PlungerLaneTrigger_Hit()
	bBallInPlungerLane = TRUE

	' remember last trigger hit by the ball
	set LastSwitchHit = PlungerLaneTrigger
End Sub


' A Ball may of rolled into the Plunger Lane Kicker, if so then kick it 
' back out again
'
Sub PlungerKicker_Hit()
	PlungerKicker.SolenoidPulse
End Sub


' The Ball has rolled out of the Plunger Lane.  Check to see if a ball saver machanisim
' is needed and if so fire it up.
'
Sub PlungerLaneGate_Hit()
	' if there is a need for a ball saver, then start off a timer
	' only start if it is currently not running, else it will reset the time period
	If (constBallSaverTime <> 0) And (bBallSaverActive <> TRUE) Then
		' and only if the last trigger hit was the plunger wire. 
		' (ball in the shooters lane)
		If (LastSwitchHit.Name = "PlungerLaneTrigger") Then
			' set our game flag
			bBallSaverActive = TRUE
			' start the timer
			BallSaverTimer.Enabled = FALSE
			BallSaverTimer.Interval = constBallSaverTime
			BallSaverTimer.Enabled = TRUE
			' if you have a ball saver light you might want to turn it on at this 
			' point (or make it flash)
		End If
	End If
End Sub


' The ball saver timer has expired.  Turn it off and reset the game flag
'
Sub BallSaverTimer_Expired()
	' stop the timer from repeating
	BallSaverTimer.Enabled = FALSE
	' clear the flag
	bBallSaverActive = FALSE
	' if you have a ball saver light then turn it off at this point
End Sub



' *********************************************************************
' **                                                                 **
' **                   Supporting Score Functions                    **
' **                                                                 **
' *********************************************************************

' Add points to the score and update the score board
'
Sub AddScore(points)
	If (fpTilted = FALSE) Then
		' add the points to the current players score variable
		nvScore(CurrentPlayer) = nvScore(CurrentPlayer) + points

		' update the score displays

		Player1Reel.State = BulbOff
		Player2Reel.State = BulbOff
		Player3Reel.State = BulbOff
		Player4Reel.State = BulbOff

		' add the points to the correct display and light the current players display
		Select Case (CurrentPlayer)
			Case 1:	Player1Reel.AddValue(points)
						Player1Reel.State = BulbOn

			Case 2:	Player2Reel.AddValue(points)
						Player2Reel.State = BulbOn

			Case 3:	Player3Reel.AddValue(points)
						Player3Reel.State = BulbOn

			Case 4:	Player4Reel.AddValue(points)
						Player4Reel.State = BulbOn
		End Select
	End if

	' you may wish to check to see if the player has gotten a replay
End Sub


' Add some points to the current Jackpot.
'
Sub AddJackpot(points)
	' Jackpots only generally increment in multiball mode and not tilted
	' but this dosn't have to tbe the case
	If (fpTilted = False) Then

		If (bMultiBallMode = TRUE) Then
			nvJackpot = nvJackpot + points
			' you may wish to limit the jackpot to a upper limit, ie..
			'	If (nvJackpot >= 6000) Then
			'		nvJackpot = 6000
			' 	End if
		End if
	End if
End Sub


' Will increment the Bonus Multiplier to the next level
'
Sub IncrementBonusMultiplier()
	Dim NewBonusLevel

	' if not at the maximum bonus level
	if (BonusMultiplier(CurrentPlayer) < constMaxMultiplier) then
		' then set it the next next one and set the lights
		NewBonusLevel = BonusMultiplier(CurrentPlayer) + 1
		SetBonusMultiplier(NewBonusLevel)
   End if
End Sub


' Set the Bonus Multiplier to the specified level and set any lights accordingly
'
Sub SetBonusMultiplier(Level)
	' Set the multiplier to the specified level
	BonusMultiplier(CurrentPlayer) = Level

	' If the multiplier is 1 then turn off all the bonus lights
	If (BonusMultiplier(CurrentPlayer) = 1) Then
		' insert your own code here
	Else
		' there is a bonus, turn on all the lights upto the current level
		If (BonusMultiplier(CurrentPlayer) >= 2) Then
			' insert your own code here
		End If
		' etc..
	End If
End Sub



' *********************************************************************
' **                                                                 **
' **                     Table Object Script Events                  **
' **                                                                 **
' *********************************************************************

' The Left Slingshot has been Hit, Add Some Points and Flash the Slingshot Lights
'
Sub LeftSlingshotRubber_Hit()
	' add some points
	AddScore(5)
	' flash the lights around the slingshot
	LeftSlingshotBulb1.FlashForMs 100, 50, BulbOff
	LeftSlingshotBulb2.FlashForMs 100, 50, BulbOff
End Sub


' The Right Slingshot has been Hit, Add Some Points and Flash the Slingshot Lights
'
Sub RightSlingshotRubber_Hit()
	' add some points
	AddScore(5)
	' flash the lights around the slingshot
	RightSlingshotBulb1.FlashForMs 100, 50, BulbOff
	RightSlingshotBulb2.FlashForMs 100, 50, BulbOff
End Sub


' The Left InLane trigger has been Hit
'
Sub LeftInLaneTrigger_Hit()
	' add some points
	AddScore(1)
	' remember last trigger hit by the ball
	set LastSwitchHit = LeftInLaneTrigger
End Sub


' The Right InLane trigger has been Hit
'
Sub RightInLaneTrigger_Hit()
	' add some points
	AddScore(1)
	' remember last trigger hit by the ball
	set LastSwitchHit = RightInLaneTrigger
End Sub


' The Left OutLane trigger has been Hit
'
Sub LeftOutLaneTrigger_Hit()
	' add some points
	AddScore(10)
	' remember last trigger hit by the ball
	set LastSwitchHit = LeftOutLaneTrigger
End Sub


' The Right OutLane trigger has been Hit
'
Sub RightOutLaneTrigger_Hit()
	' add some points
	AddScore(10)
	' remember last trigger hit by the ball
	set LastSwitchHit = RightOutLaneTrigger
End Sub

oop.jpg
 

 

 

Do you realize that there's a 2.8x version of Blender out now? I say this out of curiosity.......



#160 Itchigo

Itchigo

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 2,706 posts
  • Location:Chicago, Illinois

  • Flag: United States of America

  • Favorite Pinball: All




  • Trophies:

Posted 08 March 2020 - 06:01 AM

 

 

Tap passes, on the other hand, aren't worth trade-off in terms of latency, in my opinion. They're rarely done, even by the pros. Super dangerous move!


 


 

 

 

I can't speak for everyone else, but I did them as a kid in tournaments all the time.


Founder of Rogue Pinball! https://roguepinball.com/index.php                 Making Pinball great again!!

 

partylikeits1776-.jpg