SummaryGame Maker Studio includes a built in high score system to record the top 10 places. Sometimes however it is desirable to store more than just a Name and a Score or customize the display to be more in keeping with your game.

This tutorial was created specifically for GM Studio to achieve just this and more.

The illustration above depicts a Custom High Score layout showing Name, Money and Score. It is easy to customize and add to your games and does not freeze the game action. It can also add a thousands separator to the scores (to make them easier to read) and allows you to set decimal places for the additional score date (useful for collecting money amounts). The best part is you don't need to be a "wiz" to learn how.

DescriptionThis tutorial will teach you how to make and add a custom high score system to your game. It is aimed primarily at novice GM learners but experienced users may find it simpler than writing their own from scratch.

The High Score Example supplied with this tutorial shows how the Custom High Score System operates by simulating a game. It allows for a Name, Amount and a Score, the headings for each can be easily changed to suit your game. You can also specify the number of decimal places to display for the amount (useful for currency values) and whether to add commas as a thousands separator to the score.

The Example serves to illustrate how it works, allowing you to experiment with it before adding it to your game. The default image sets are unlikely to be in keeping with your game and alternative image sets are also supplied which you can edit or replace with your own.

The download also includes an example game together with a tutorial with step by step instructions to explain how to replace the example game's default high score system with the custom one. Knowledge of GML is an advantage but not a requirement; customizations can be done without coding knowledge.

The default GM high score system only saves a name and the score attained; this Custom display permits you to save an extra numeric field which can be used as a level counter, money earned, rank attained etc. It uses the default Game Maker high score system to store the top ten scores in the registry, so they are still maintained between game runs without the need to save any files.

This uses data structures and files to save data and is in-keeping with sandbox policies. (Compatible with GM S:Versions1.2 and 1.3)

The high scores are for each game so are independent of each other. The custom part refers to the amount of data stored against each entry and the way it is displayed in the game. The GM default stores a name against each score. This allows you to record additional data and display it without halting the game.

You can implement an all time high score as well but you would need a server and a little PHP and MySQL knowledge. Those playing the game would need to permit the game Internet access in order to retrieve and / or record the scores.

Are you sure you initialized the high score system when the game starts?

hiscore_initialize();

This is one of two scripts. It creates the variables the high score system will use and also allows you to customize things like the type of extra data and headings that get displayed when showing the scores.

It will cope with three rooms but not 3 different sets of high scores. This still uses the default GM high scores from the registry so it can still only store 10 scores. To allow more than one high score you would need to create a high score store for each and use those instead of the GM high score functions.

Thanks for the tutorial! I tried it and it's just so good I think... Cause everytime i run it, it keeps showing me Error messages. Can someone help me?

___________________________________________
ERROR in
action number 1
of Create Event
for object obj_highscore_control:

Error in function real().

___________________________________________

Are you sure you initialized the high score system when the game starts?

hiscore_initialize();

This is one of two scripts. It creates the variables the high score system will use and also allows you to customize things like the type of extra data and headings that get displayed when showing the scores.

I am getting same "Error in function real()" error, but I have initialized the high score system at the start of my game. When I do it like in the example (making the Start game event call the hiscore_initialize script) I get tons of errors that the variables are not defined and this is why I putted the code into my loader object, but then I get the Error in function real().

Hi, thanks for the tutorial. I am running the "CustomHiScore.gmz" file. I read in the .pdf instructions: "As supplied the Custom High Score will run as-is so if you have not
done so already, import the GMZ into Studio and run it to see it in action". When i do run it without changing anything I get the following error:

___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Other Event: Game Start
for object obj_loader:

The GM8.x version uses the built-in high score array (which uses the Windows registry) and is fixed to 10 top scores. These cannot be altered as it is fixed by GM. The Studio version however uses data structures, thus these can be any number you want. It is also possible to convert the Studio version to use with registered legacy GM versions (GM8 Pro or GM8.1 Standard).

I have just used this tutorial/example to get a highscore table in my game. Everything seems to work just fine, except for the text in the table itself. The text from the table and the text from the button is not drawn into the correct position:

It looks like you have something setting draw_text_halign and / or draw_text_valign which doesn't reset them afterwards or you are using the GUI layer which isn't scaled the same as the game window. Not easy to tell from a screenshot but the pixalation indicates some scaling is involved.