Jump to: navigation, search

Rule Flow

Regardless of the language, framework or code used for a game, there is a basic flow to how most pinball control software works. The following is a flow layout in plain language that can be used as a guideline when creating code.

Power On Mode
=============
---> Hardware initialization
---> Initiate software driven self tests
---> Load/set software defaults
---> Load user configuration changes (ie: credits left, freeplay etc)
---> Go into attract mode

Attract Mode
============
---> Light show
---> Play sound/music
---> Is coin door open?
	---> Yes
		---> Start Diagnostic Mode

---> Coin switch hit?
	---> Yes
		---> Increment credit count
		---> Update credit display
		---> Play credit sound
		---> Return to Attract Mode

---> Start pressed?
	---> Yes
		---> Game in Freeplay mode?
			---> Yes
				---> Increment Player count 
				---> Start Main Game Mode
			---> No
				---> Credit count > 0?
					---> Yes
						---> Decrement Coin count
						---> Update credit display
						---> Increment Player count 
						---> Start Main Game Mode
					---> No
						---> Show "More Credits" display
						---> Return to Attract Mode
						
---> Flipper buttons pressed?
	---> Display scores for previous four players
	
Diagnostic Mode
===============
---> Display Diagnostic Options
	---> Option selected?
		---> Yes
			---> Start Item Mode
	---> Next pressed?
		---> Yes
			---> Advance one option
	---> Previous pressed?
		---> Yes
			---> Back up one option
	---> Exit pressed?
		---> Return to previous Mode

Game Mode
=========
---> Is coin door open?
	---> Yes
		---> Start Diagnostic Mode
		
---> Current score - Ball start score < 1000?
	---> Yes
		---> Disable Ball Save Timer

---> All balls in ball trough?
	---> Yes
		---> All player Total Balls Played < 3?
			---> Yes
				---> Ball in play?
					---> Yes
						---> Ball Save Timer < 10 seconds?
							---> Yes
								---> Ball Saved count < 1
									---> Yes
										---> Put ball onto Shooter Lane
										---> Increment Ball Saved count
										---> Return to Game Mode
									---> No
										---> End turn
										---> Bonus count
										---> Display score
										---> Shift to Next player
										---> Return to Game Mode
							---> No
								---> End turn
								---> Bonus count
								---> Display score
								---> Shift to Next player
								---> Return to Game Mode
					---> No
						---> Put ball onto Shooter Lane
						---> Reset Ball Saved count to 0
						---> Save Ball Start score
			---> No
				---> Play "Game Over" sound
				---> Return to Attract Mode

		---> Start button pressed?
			---> Yes
				---> Player 1 on ball 1?
					---> Yes
						---> Player count less than 4?
							---> Yes
								---> Freeplay?
									---> Yes
										---> Increment player count
										---> Zero new player score
									---> No
										---> Credit count > 0?
											---> Yes
												---> Decrement Coin count
												---> Update credit display
												---> Increment Player count 
												---> Zero new player score
											---> No
												---> Show "More Credits" display

	---> Coin switch hit?
		---> Yes
			---> Increment credit count
			---> Play credit sound

	---> Shooter Lane switch active?
		---> Yes
			---> Autolauncher disabled
				---> Yes
					---> Set Shooter Lane sound flag to true
		---> No
			---> Shooter Lane sound flag = true
				---> Yes
					---> Play "Ball Launch" sound
					---> Display Shooter Lane animation
					---> Clear Shooter Lane flag
					---> Start Ball Save Timer

	---> Both Flipper buttons pressed continuously for 15 seconds?
		---> Display status
		
	---> Displaying status screen?
		---> Yes
			---> Any Flipper held?
				---> Yes
					---> Other Flipper pressed?
						---> Yes
							---> Cycle Status screen
				---> No
					---> Return to Game Mode

	---> Left Flipper button pressed
		---> Yes
			---> Fire Left Flipper Coil
			---> Cycle Inlane / Outlane lamps left

	---> Right Flipper button pressed
		---> Yes
			---> Fire Right Flipper Coil
			---> Cycle Inlane / Outlane lamps right

	---> Left Slingshot hit?
		---> Yes
			---> Fire Left Slingshot Coil
			---> Increment score by Left Slingshot value
				
	---> Right Slingshot hit?
		---> Yes
			---> Fire Right Slingshot Coil
			---> Increment score by Reft Slingshot value

	---> Left Outlane switch hit?
		---> Yes
			---> Light Left Outlane lamp
				---> Increment score by Left Outlane value
				---> All 4 lane lamps lit?
					---> Yes
						---> Increment score by 1000
						---> Clear all lane lamps
			---> Special when Lit lamp?
				---> Yes
					---> Increment credit count
					---> Play "Special" sound

	---> Right Outlane switch hit?
		---> Yes
			---> Light Right Outlane lamp
			---> Increment score by Right Outlane value
			---> All 4 lane lamps lit?
				---> Yes
					---> Increment score by 1000
					---> Clear all lane lamps
			---> Special when Lit lamp?
				---> Yes
					---> Increment credit count
					---> Play "Special" sound

	---> Left Inlane switch hit?
		---> Yes
			---> Light Left Inlane lamp
			---> Increment score by 10
			---> All 4 lane lamps lit?
				---> Yes
					---> Increment score by 1000
					---> Clear all lane lamps

	---> Right Inlane switch hit?
		---> Yes
			---> Light Right Inlane lamp
			---> Increment score by 10
			---> All 4 lane lamps lit?
				---> Yes
					---> Increment score by 1000
					---> Clear all lane lamps

	---> Pop Bumper hit?
		---> Yes
			---> Now - Pop Bumper hit time > 200ms
				---> Yes
					---> Trigger Pop Bumper Coil
					---> Save Pop Bumper hit time
					---> Increment score by 10