MGS

From MSX Game Library

Revision as of 18:24, 26 May 2025 by Aoineko (talk | contribs)

MSX Game Scores (MGS) is an online leaderboard platform for MSX games: https://aoineko.org/mgs.

It allows players to submit their high scores using codes generated by the games themselves. Developers can integrate score encoding into their games, and once submitted, the scores are verified server-side and displayed on public leaderboards. The goal is to bring a modern, competitive scoring system to new MSX games.

Note: The MGS site has the same author but is not directly linked to MSXgl, even though this library includes tools to help generate score code.

How do I add my game to MGS?

Generate a score code

The basic idea is that your MSX game must generate a code that encodes the relevant data:

  • the score,
  • the corresponding leaderboard (if there are several),
  • and any other useful information for your game.

For example, in a racing game, besides the time to complete the race (the score) and the track (the leaderboard), you might also want to record the car type used, whether the player used a manual or automatic gearbox, etc.

You are free to use any technique you want to encrypt your data. Just make sure the encoding is strong enough to prevent someone from inputting random codes and getting a valid score. MSXgl provides a C module for encoding data.

As the score code will be decrypted on the server side, so the function that decrypts your code will have to be written in PHP (a language that looks a lot like C).<>

Add your game to MGS

After that, the game and its leaderboards have to be added to the MGS site. For now, this is a manual process that is handled directly by the site owner (MRC user Aoineko).


Finally, the interface needs to be created: this is PHP code that checks the validity of the submitted code and, if valid, generates the entry to be added to the leaderboard.

I have some example PHP functions available, but I can also write them for you if needed. To decode the score code, you’ll need to write in PHP the inverse function of the one used on MSX. If you use the MSXgl score encoding function, the corresponding PHP decoding function is already available.

// Decode a string and if valide, output a data stream and return true
// Parameters:
// - code : Input crypted code
// - key  : Input decoder key
// - data : Output data stream (bytes array)
// Return: true if decode succeed
function Decode(string $code, string $key, array &$data): bool {}