Skip to content

Introduction

This introduction chapter should give you a quick start into extending MPF.

Mode custom code vs. machine custom code

Note that MPF also has the ability to run custom mode code which is code that is associated with a certain game mode and is generally only active when the mode it’s in is active. So if you just want to write your own custom game logic, you’ll probably use mode code. MPF has well the ability to run machine wide code, which is active as long as MPF is running regardless of the mode you are in. You need to decide what code extension you need.

Follow either the examples for the machine wide extension or the mode wide extension. In the next step most extensions probably have to deal in one or the other way with variables, follow this variable guide to learn how to deal with MPF variables in your own code.

As long as you only write smaller extensions you don't have to setup a full Python development environment. Of course you can and the more complex your development gets the more handy it might be. The setup guide you only have to follow if you really want to develop MPF itself and not only to write an extension for your game.

Last but not least of course the API Reference is very important for you.


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