# High Scores

PinballY automatically displays the "live" high score information for the currently selected game. The high scores are displayed in the video DMD window and on the real DMD device, if you have one.

Scores are displayed in rotation with the game's regular background media for the DMD window or device. If you've supplied a static image for the DMD, the image will be displayed for about 7 seconds at a time, and then the high scores will be displayed, then the image will be displayed again, etc. If the game has a DMD video, the video will be displayed all the way through, then the scores will be displayed, then the video will play again, and so on.

## How PinballY reads high scores, part I: PINemHI

For most games, PinballY uses a separate program called PINemHi, written by vpforums member DnaDisturber. (PINemHi is included in the PinballY distribution with the author's permission, so there's no need to install it separately.)

PINemHi reads special files known as NVRAM (for Non-Volatile RAM) files. These are created by Visual Pinball (more technically, by VPinMAME) and by Future Pinball when you play games through those systems, and they store information that the simulated pinball machines would have stored in real life in their on-board memory chips. The stored information includes things like operator settings (for example, whether or not the game is in Free Play mode, how many balls per game it's configured to use, and so on) and audit counts (how many times the game has been played, how many coins it's collected), as well as the latest high scores. PINemHi is programmed to parse the NVRAM files for almost all of the VPinMAME and Future Pinball games in existence to pick out the high score information and format it for display.

PINemHi works with almost all games that use VPinMAME to play back original ROMs, and with almost all Future Pinball games. PINemHi doesn't work with Visual Pinball games that don't use ROMs, such as original VP creations, and re-creations of games from the electromechanical (EM) era.

## How PinballY reads high scores, part II: ad hoc score files

For games that PINemHi doesn't work with, PinballY provides its own supplemental way to provide the high scores, using ad hoc score files. This requires specific code to be added to each table to write the ad hoc file, so it will only work with tables that have been specifically programmed to support it.

Here's how this works:

- PinballY always starts by trying PINemHi. If that works, the PINemHi results are used, skipping the rest of the steps below.
- If PINemHi can't retrieve high scores for the game, PinballY looks for a file that has the exact same name and location as the table file for the game (for example, the .vpx file for a Visual Pinball X game), but with the filename extension replaced with .pinballyHighScores. For example, if the table file is `c:\VisualPinball\Tables\Fireball_v2_7.vpx`, PinballY will look for the scores in a file called `c:\VisualPinball\Tables\Fireball_v2_7.pinballyHighScores`.
- If the high scores file exists, PinballY reads it into memory as a plain ASCII text file. Each line in the file corresponds to one line on the DMD high score display. Blank lines separate groups of messages that are shown together on one screen.

## Display styles

PinballY offers three display styles for the generated high score graphics:

- DMD style. This simulates the 128x32 dot matrix display used in most machines from the 1990s onwards. By default, the dots are displayed in an amber color simulating the original plasma displays in the 1990s machines. For games with VPinMAME ROMs, however, any color customizations you've made in the VPinMAME settings will be respected and used instead. This should make the generated high-score screens harmonize with captured DMD video.
- Alphanumeric style. This simulates the 16-segment plasma LED displays used in most games from the late 1980s.
- Typewriter style. This simulates a paper note card printed with the high score information. This is meant to provide something appropriate to the era for electromechanical tables, which didn't (usually) have any way to record the high scores themselves. The closest equivalent of a high score display for those old machines was for someone to stick a paper note to the machine commemorating champion scores. This format is designed to simulate that approach.

By default, the program picks the display style for each game automatically based on the table's metadata, as stored in the XML table database. (You can edit this information via the Game Details dialog.)

- Any table from before 1978 uses the Typewriter style, since virtually all known games up to that point were EM tables
- Machines from 1978 to 1990 use the Alphanumeric style, since almost all of the real machines produced during these years used either 7-segment numeric displays or 16-segment alphanumeric displays
- Any machine from 1990 or earlier that's set to table type "SS" (solid state) in its metadata uses the Alphanumeric style
- Games from 1991 with any of the titles "Funhouse", "Harley-Davidson", and "The Machine: Bride of Pinbot" use the Alphanumeric style; these three titles are special cases, because they're the only games from 1991 or later that I know of that didn't have full DMDs
- Anything else uses the DMD style

You can override the default style on a game-by-game basis in the Edit Game Details dialog. That lets you fix any games that the rules above classify in the wrong category, or any that you just want to change for other reasons.

## Customizing the "Typewriter" display style

The Typewriter style normally uses an image of an index card as the background, with black text in the Courier New font to display the score information. You can customize both of these aspects of the display:

- See "TT" High Score Backgrounds to find out how to change the background image
- The font and text color can be customized using the Fonts & Colors section in the Settings dialog

## Editing captured DMD video

If you're creating your own DMD video for a game based on captured video from the game's "live" DMD, you can get the best effect in PinballY by editing the captured video to clip out the portion that shows the high scores.

Most electronic games from the late 1980s onward display a series of "attract mode" messages between games, and these usually include the high scores. So if you capture video from the DMD during the game's attract mode, it will probably include the high scores. Those high scores will be the ones that were current at the time you captured the video, though! If you leave them in the video, the video playback will forever show those same scores, even if you beat them on later games. That's why it's best to edit them out.

Since PinballY automatically generates graphics with the current high scores, and interleaves them with the captured DMD video, you can create an almost seamless effect showing the live scores. The trick is to edit the captured video so that it starts just after the high scores are displayed in the video, and ends just before the high scores are displayed again on the next cycle. That way, PinballY will insert the live high score screens at just the right point in the video, simulating the original rotation, but always up to date with the latest high scores saved on disk.

## Customizing high scores through Javascript

The Javascript system includes an event class, HighScoresEvent, that lets you intercept PinballY's communications with PINemHi to supplement or replace the high scores that PINemHi provides. This could be used to change the format of the high scores for certain games, for example, or to provide your own external source of high scores for games that PINemHi doesn't work with. See the event class documentation for more details.