Skip to content

How to design a game in MPF using Modes

This section assumes that you already configured all your hardware devices (especially all your ball device). If you did not configure your hardware please do that first. You can go through the tutorial or have a look a the mechs section.

Video about how to structure your modes:

Video about state machines (often used to implement logic in your mode):

Video about events in MPF:

This section is about laying out your modes and actually designing your game logic. It is structured into the following subsections:

Mode Selection and Game Startup

Questions answered in this section:

  • How to select modes/players during start?
  • How to implement a (timed) skill shot?
  • How does a player qualify for a mode?
  • How to start the mode?
  • Can multiple modes run at once?

  • Mode Selection

Game Mode

Questions answered in this section:

  • How to track progress inside a mode?
  • How does it end?
  • Will it always succeed?
  • Can it timeout?
  • Can it restart if it failed?
  • Where will it continue on restart?
  • How to implement roll over lanes in a mode?
  • How to implement a mystery award mode?
  • How to implement a stand-up target bank mode?

  • Game Mode

Wizard Modes

Questions answered in this section:

  • How to track achievements towards one or multiple wizard modes?
  • How to start a wizard mode?
  • What to do after wizard mode?

  • Wizard Modes

Ball End Modes

Questions answered in this section:

  • How to start a mode after the ball for a player drained?
  • How to implement a bonus mode?

  • Ball End Modes

Game End Modes

Questions answered in this section:

  • How to start a mode after the last player drain his ball?
  • How to implement a highscore mode?
  • How to implement a match mode?

  • Game End Modes

Other modes

Questions answered in this section:

  • Which modes run outside of a game?
  • How to control attract?
  • How do credits work?
  • How does tilt work?
  • What is the service mode?

  • Other Modes

Layering Modes Example

Examples given in this section:

  • How to define mode categories and helper modes
  • How to move in and out of game and wizard modes
  • How to track and persist progress outside of modes

  • Layering Modes Example


Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results