Kroc / elite-harmless

Disassembly (CA65) of the Commodore 64 port of the seminal space-sim Elite, by Ian Bell / David Braben.
https://discord.gg/ZYnQr5S
Other
93 stars 12 forks source link

Text storage optimisations #18

Open Kroc opened 6 years ago

Kroc commented 6 years ago

The game's text was copied as-is from the BBC which adds some level of indirection. The font glyphs are in ASCII order rather than PETSCII (though this matters little) and the letter codes have to go under some translation before being drawn to the bitmap.

If the text data is re-calculated to be direct, 0-based indices into the font rather than ASCII codes, rendering can be sped up, removing some pointless translation that every character undergoes before being painted on screen.

Also there are two separate text stores, decoders, and compression formats: a common one and one for docked situations like mission text, because the BBC loaded separate modules for flight state and docked state. This should be replaced with a singular compression & decoding scheme.

The compression used is messy, very slow, and not that effective. Speed of decoding is important so we need something reasonably straight-forward rather than going for maximum compression above-all. I'm thinking a 5-bit or 4-bit character with dictionary.

Required for translations: #3

Note: The planet description system ("goat soup") is very complex and relies on token-expansion. The whole thing will need rewriting, ideally to code so that more tokens are freed for common text expansions.