Displaying high score with Godot

79 views
Skip to first unread message

Mike Grandinetti

unread,
Jun 20, 2025, 11:11:30 AMJun 20
to MPF Users
Hello all, I'm currently working on my high score slide, the one to enter initials (or name) and I'm using the example included in the addons folder as a starting point when using Godot. 

I've managed to accomplish about 95% of what I had in mind for the slide, but I'm running into trouble identifying which variables to use in order to display the high scores that triggered the slide. So far, the only combination that’s worked for me is setting the Variable Type to "Current Player" with Variable Name to  "score," which works great for single-player games, because it's the only player, but if it a  multiplayer game it displays the last current player score which may or may not be a  high score. 

If anyone has insights or suggestions on how to display the triggering high scores for multiplayer game, I'd really appreciate the help.

Jason Brands

unread,
Jun 21, 2025, 8:55:38 PMJun 21
to MPF Users
I haven't tried it, but I would assume it's these machine variables.  https://missionpinball.org/latest/game_logic/high_scores/

Mike G

unread,
Jun 21, 2025, 11:21:37 PMJun 21
to MPF Users

Hi Jbra— Thank you for the reply. I do think you are correct; however, I'm not sure where to look to find the variable name that is used before entering your initials for the new high score. After entering your initials, the machine variable for the high score would be score1_value for GRAND CHAMPION (in my case) or score2_value for HIGH SCORE 2 (and so on for each high score you're recording). The log section below is the only reference I can find that seems to trigger the high score slide, which does show a reference to the high score, which in this case is listed as Value: 12100, but I don't see a variable name I can use. I must be missing something. Would you (or anyone) have a thought about the variable name that could be referenced?


2025-06-21 21:19:19,889 : INFO : EventManager : Event: ======'mode_high_score_will_start'====== Args={'queue': <QueuedEvent>}
2025-06-21 21:19:19,889 : INFO : Timer.high_score_entry_timer : Starting Timer.
2025-06-21 21:19:19,890 : INFO : EventManager : Event: ======'timer_high_score_entry_timer_started'====== Args={'ticks': 60, 'ticks_remaining': 60}
2025-06-21 21:19:19,890 : INFO : EventManager : Event: ======'timer_high_score_entry_timer_tick'====== Args={'ticks': 60, 'ticks_remaining': 60}
2025-06-21 21:19:19,890 : INFO : EventManager : Event: ======'mode_high_score_starting'====== Args={'queue': <QueuedEvent>}
2025-06-21 21:19:19,891 : INFO : Mode.high_score : Started. Priority: 1500
2025-06-21 21:19:19,891 : INFO : EventManager : Event: ======'modes_active_modes_changed'====== Args={}
2025-06-21 21:19:19,891 : INFO : EventManager : Event: ======'mode_high_score_started'====== Args={'queue': <QueuedEvent>}
2025-06-21 21:19:19,903 : INFO : Mode.high_score : New high score. Player: <Player 1>, award_label: GRAND CHAMPION, Value: 12100
2025-06-21 21:19:19,903 : INFO : EventManager : Event: ======'high_score_enter_initials'====== Args={'award': 'GRAND CHAMPION', 'player_num': 1, 'value': 12100}
2025-06-21 21:19:19,942 : INFO : EventManager : Event: ======'slide_high_score_created'====== Args={'_from_bcp': True}
2025-06-21 21:19:19,983 : INFO : EventManager : Event: ======'slide_base_inactive'====== Args={'is_removing': True, '_from_bcp': True}
2025-06-21 21:19:19,983 : INFO : EventManager : Event: ======'slide_high_score_active'====== Args={'original_context': 'high_score', 'original_calling_context': 'mode_high_score_started', 'priority': 1500.0, 'queue': '<QueuedEvent>', 'cmd': 'slides_play', '_from_bcp': True}

Alex L

unread,
Jun 22, 2025, 1:21:26 AMJun 22
to MPF Users
If you are using the built-in high_score mode, the slide_player hook event is `high_score_enter_initials`, per https://github.com/missionpinball/mpf/blob/8d369b94366e77540d38efa2d5305adb07f3d9f8/mpf/modes/high_score/config/high_score.yaml#L31

This event actually comes with the parameters "award" (the specific record being entered, like "Grand Champion"), "player_num" (1-4), and "value" (score), so you can make variable nodes using the "Event Arg" type and each of those three parameter names, if you want to show the values.

Samuel Chauviere

unread,
Jun 22, 2025, 5:46:44 AMJun 22
to MPF Users
Yes, and you can also use "player_name" on the high_score_award_display slide

Capture.PNG

Mike G

unread,
Jun 24, 2025, 12:01:13 AMJun 24
to MPF Users
Thank you all for the support—you truly kept me from giving up. I was able to show the high scores along with the corresponding players exactly as needed.
Reply all
Reply to author
Forward
0 new messages