High Scores

Related Config File Sections
high_score:

MPF includes support for high scores which is where players can enter their names (or initials) when they’ve achieved a high score. Features include:

  • Set any player variable as a high score option. So in addition to score you could set high score entries for loops, ramps, aliens destroyed, etc.
  • Set how many of each high score type are tracked (Top 5 for high scores, Top 3 for loops, Top 1 for aliens, etc.)
  • Set what each “award name” is called. (The highest score is “GRAND CHAMPION,” the second highest score is “HIGH SCORE 1”, the highest loop score is “MAJOR LOOPER”, etc.)
  • How many characters a player can enter for their name.
  • A list of valid characters the player can choose from
  • The layout of the display for entering their names and show their rewards.
  • Events for high score awards and entry, so you can configure high score entry screens.

Don’t have a display to enter initials? See High Scores in EM Machines for how to use the high score mode without entering initials.

This is an example (for machines with display):

# modes/high_score/config/high_score.yaml
mode:
  priority: 500
  start_events: game_ending, start_high_score
  use_wait_queue: true

high_score:
  _overwrite: True
  enter_initials_timeout: 60
  award_slide_display_time: 4s

  # define your high score categories and the awards
  categories: !!omap
  - score:
      - GRAND CHAMPION
      - HIGH SCORE 1
      - HIGH SCORE 2
      - HIGH SCORE 3
      - HIGH SCORE 4
      - HIGH SCORE 5
      - HIGH SCORE 6
      - HIGH SCORE 7
      - HIGH SCORE 8
  - loops:
      - LOOP CHAMP

  # set the defaults
  defaults:
    score:
      - MPF: 1000000
      - BRI: 900000
      - JAN: 800000
      - QUI: 700000
      - MAR: 600000
      - JOH: 500000
      - ELI: 400000
      - MIK: 300000
      - ANT: 200000
    loops:
      - JAN: 42

# optional: change the slides (you can omit all the following)
slide_player:
  _overwrite: True
  high_score_enter_initials: high_score_enter_initials
  high_score_award_display: high_score_award_display

slides:
  _overwrite: True
  high_score_enter_initials:
  - type: text
    style: tall_title
    font_size: 18
    text: PLAYER (player_num)
    color: ffff00
    x: 105
    y: 90

  - type: text
    style: tall_title
    font_size: 18
    text: (award)
    color: f0f0f0
    x: 105
    y: 70

  - type: text_input
    initial_char: A
    dynamic_x: false
    key: high_score
    style: tall_title
    font_size: 18
    max_chars: 3
    x: 105
    y: 20
    shift_left_event: sw_lower_left_flipper
    shift_right_event: sw_lower_right_flipper
    select_event: sw_start
    color: ff0000

  - type: text
    style: tall_title
    text: '<       >'
    font_size: 18
    x: 105
    y: 20
    color: ff0000


  - type: text
    text: ''
    key: high_score
    font_size: 18
    style: tall_title
    x: 105
    y: 50
    color: ff00ff
    animations:
      show_slide:
      - property: opacity
        value: 1
        duration: 0.3s
        easing: in_out_quint
      - property: opacity
        value: 0
        duration: 0.3s
        repeat: true
        easing: in_out_quint

  high_score_award_display:
  - type: text
    text: (player_name)
    font_size: 18
    style: tall_title
    anchor_y: middle
    anchor_x: middle
    x: middle
    y: middle
    color: 00ff00
    animations:
      show_slide:
      - property: opacity
        value: 1
        duration: 0.05s
      - property: opacity
        value: 0
        duration: 0.05s
        repeat: true
  - type: text
    text: (award)
    font_size: 18
    style: tall_title
    x: 105
    y: 110
    color: 0000ff
  - type: text
    text: (value)
    style: tall_title
    x: 105
    y: 30
    color: 4040FF
    font_size: 20
    number_grouping: true
    min_digits: 2

High score mode will also create a few machine variables for you:

In this case this will be score1_value, score1_name and score1_label (till score9_value, score9_name and score9_label). Additionally, there will be loop1_label, loop1_value and loop1_name. You can use those in your attract slides to show previous high scores.

Related How To Guides
Scoring
How to design a game in MPF using Modes
Related Events
mode_high_score_started
mode_high_score_stopped