eadmaster / console_hiscore

Hiscore support for console games
4 stars 0 forks source link

ideas for a better hiscore file format #1

Open eadmaster opened 4 years ago

eadmaster commented 4 years ago

An ideal file format should:

solution 1 using json:

{
    "supported_content" : [ {
            "system" : "nes",
            "content_name" : "Super Mario Bros. (W) [!]",
            "content_crc32: "3337ec46"
        }, ...  // more games can follow
    ],
    "content_memory_patches": [ {
            "cputag": "maincpu",
            "addressspace": "program",
            "address": 0x7df,
            "length": 0x04,
            "first_byte": 0x00,
            "last_byte": 0x00,
        }, ...  // more patches can follow
    ],
    "hiscore_data": "AAEHAA==",  // base64-encoded or hexdump?
    "hiscore_data_crc32": "6fc723ec"
}

solution 2 using existing binary file patching formats:

Unlike the json solution they are not easily editable and could lead to confusion since they are often used for static ROM patching as well.

DreamPlusInfinity commented 4 years ago

I suggest the following.

Addition of new entries to the format

Type

There's potentially more types, to be added and supported as they are encountered in games.

Order

Multiplication Factor Some games add extra zeroes to the right, but they're not actually included in the internal score tally.

Improvements to existing entries

The CPU memory format may be insufficient for consoles with bankswitching. I recommend adding an optional entry for banks.

Exporting Scores to Leaderboards / Updating Hi-Scores Ingame

I suggest adding for each game an optional list of preset events. The events will be memory offsets (space, address, bank) to ASM, and will have watchpoints tied to them that will trigger actions.

Sessions may be flagged with these flags, which will appear next to scores in listings:

Leaderboards may be three lists. Might be good to look into separating leaderboards further to separate difficulty settings.

Now for the events and associated actions whenever their execution watchpoints are tripped:

  1. Game loads Scores from Save Data (SRAM) to "RAM Game Hi-Score". 1'. Game loads preset score to "RAM Game Hi-Score" Action: If first time only, Update "RA Game LB" with RAM Game Hi-Score(s). On subsequent times, overwrite RAM Game Hi-Score(s) with "RA Game LB" contents (might be better to make this overwriting optional and up to the player)

  2. Initiating New Game. Action: Begin Player Session. Flag Session Flag as 1CC.

  3. Initiating Attract Mode. Action: Abort Player Session.

  4. Game Over / Continue Screen Action: Conclude Player Session. Session Flag 1CC disabled.

  5. Choose "Yes" on Continue Screen Action: Begin Player Session.

  6. Ending (may be multiple) Action: Conclude Player Session Session Flag Clear enabled IF 1CC disabled.

  7. Accessed ingame cheat codes / debug modes Action: Session Flag "Improper" enabled.

Fallback Events and Actions:

  1. Current Score is zeroed out (only if the above aren't specified) Action: Disable all flags, except "Improper" if enabled. Conclude Player Session.
  2. Game Closed / Game Reset / Emulator shut down Action: Disable all flags, except "Improper" if enabled. Conclude Player Session.
  3. Emulator Cheat Codes enabled Action: Enable Flag "Improper".
eadmaster commented 4 years ago

Addition of new entries to the format: Type field

this could be useful to keep hiscores with games with no native support (https://github.com/eadmaster/console_hiscore/issues/2), but i think it would be better using string constants to describe them (e.g. lsb_value, msb_value, etc.)

Improvements to existing entries The CPU memory format may be insufficient for consoles with bankswitching. I recommend adding an optional entry for banks.

So far i've found no problems with NES games using bankswitching as they are mapped automatically by the emulator cores as "virtual" main memory.

Exporting Scores to Leaderboards / Updating Hi-Scores Ingame I suggest adding for each game an optional list of preset events.

I think this exceeds the aims of this project and also overlaps with RetroAchivements.

I'll try to keep things as simple as possible here so it would be easy to re-implement hiscore support in other 3rd party projects (emulators, flashcarts, etc.).