Highscore for NES-games?

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.
User avatar
oRBIT2002
Posts: 706
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Highscore for NES-games?

Post by oRBIT2002 »

One of the most boring things about our loved 8-bit classics is that highscorelists are missing almost everywhere (most likely due to lack of batterybackup back then). I'd really love to have a highscore tables in quite a few our my favourite NES-games but they are not there. I've played with the idea of hack a highscore-table in place, however this will mean massive amounts of work (register initials, dealing with scores/sorting, gfx, injecting into existing code, writing new code etc etc.).
Does anyone have any clever ideas concerning this area (that doesn't involve emulators reading/saving highscores) to perhaps reduce the amount of work in someway?
User avatar
RJM
Posts: 60
Joined: Mon Jul 27, 2020 11:56 am
Location: Rzeszów, Poland

Re: Highscore for NES-games?

Post by RJM »

It doesn't sound like a lot of hustle to be fair if you are only thinking about having a high score for a single game.
Indeed, you'd need to write some code, i.e. Lua script in Mesen to pull out the memory values, store them on the disk, and possibly draw an overlay to show it on the top of your game. This is seriously not that much work and can be done as a weekend project if you have experience with Mesen's Lua API - for a single game only.

Now let's say you want to have some smart way of having a high score overlay for ANY game.
Things get a little bit harder, but not impossible.
In a nutshell, I'd still try to use an existing emulator with scripting support.
I'd then try to bind the mouse area selection to trigger a snapshot of that area - this is how I'll mark the score area in any game.
I'll run OCR on the snapshot ( Lua can call an OCR engine preinstalled on your machine ).
This will give me the score, which I can associate with the emulated rom file and store on the disk.
You can then bind different key action to display the screen overlay with the high score.
In the past, I've done all of the pieces of this solution in various situations - it is 100% doable with the current Mesen api.

Option 2 should in theory work for any game, but obviously, more work is needed and does require 3rd party OCR engine.
User avatar
oRBIT2002
Posts: 706
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Re: Highscore for NES-games?

Post by oRBIT2002 »

I have no idea about most of the stuff you just wrote. :)
However, I was more thinking of doing it within the ROM itself, hacking a highscoresystem in place. Using 6502 assembler.
User avatar
matthughson
Formerly Goose2k
Posts: 349
Joined: Wed May 13, 2020 8:31 am

Re: Highscore for NES-games?

Post by matthughson »

Maybe you could pick some games that already have high-scores, but don't have battery-backed RAM, and the hack could simply be to add SRAM, and move the high score data there.

I believe technically, even NROM can have a SRAM (I think Famicom Basic does this if I remember correctly).
User avatar
segaloco
Posts: 959
Joined: Fri Aug 25, 2023 11:56 am

Re: Highscore for NES-games?

Post by segaloco »

So you have a few concerns involved:

- Score tallying
- Recording a score in variable X if that score exceeds X
- Loading X initially from SRAM on start
- Storing X to SRAM at a predictable, safe time

The first two are easy to glean from numerous titles. If you keep the concern of mathematics and SRAM I/O cleanly separated then the fact that you're saving/restoring the top score should have no bearing on the rest of score handling.

Also if you're storing multiple then you would also need a system to sort the scores and keep X entries while deleting the lowest X+1 entry.

For the record Nintendo opts towards BCD storage of scores in many games. That makes it easier to just use each nybble to select the digit tile to display.