Text Data Encryption

reminisce about classic bbc micro and acorn electron games here
Related forum: adventures


Post Reply
User avatar
JIM
Posts: 109
Joined: Sun Jan 28, 2001 10:20 pm
Contact:

Text Data Encryption

Post by JIM »

As there are a number of text based adventure’s in production. I’ve being wondering how do some of the large level 9 adventures encrypt there word data and any picture data?
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Post by Rich Talbot-Watkins »

It's compressed rather than encrypted...

I found a little bit of info here: http://l9memorial.if-legends.org/html/austin.html
To squeeze what was orginally a 200K mainframe program into 32K, and then to add an extra 70 locations just for the fun of it, was no mean feat. Pete's text compressor has been a feature of all Level 9's mammoth adventures. It works by running through all the messages and searching for common strings. For example, "ing" might occur frequently. The compressor replaces "ing" with a single code wherever it occurs. That done, it goes through again, and again, each time saving more space. "It doesn't always pick up what you'd expect it to," explains Pete. In the phrase "in the room" the compressor might decide that it was more efficient to use a code for "n th" and "e r" rather than pick out "in" and "the". That is not something which occurs to the human mind. The system has been rewritten to create graphics as well. Level 9 can now store a picture in about 30 bytes, using a similar method to the text compressor. That means a 200 location adventure - the minimum Pete will allow - can have a picture for each location for only another 6K of RAM. Not content with these two areas, the a-code compiler even compacts Basic program lines. "Most Basic systems have keywords which use a single byte," explains Pete. "We go further. We take out the arguments so that each Basic instruction only uses two or three bytes."
User avatar
Dreamland Fantasy
Posts: 562
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Post by Dreamland Fantasy »

Run length encoding (RLE) can be quite efficient at compressing BBC Micro images.

As an example, say your picture has a lot of black (colour 0) in it, looking at the raw data would show a lot of zeroes. Run length encoding will look at the "run" of the same numbers and count how many there are and then encode it something like 'count, value'. Something like '0,0,0,0,0,0,0,0' in this case would encode to '8,0'.

My explanation is perhaps a bit simplistic, but you should at least get the idea behind it.

Kind regards,

Francis.
Dreamland Fantasy Studios
http://www.dfstudios.co.uk
User avatar
Dreamland Fantasy
Posts: 562
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Post by Dreamland Fantasy »

For the text adventure that I am currently writing I've chosen to store the text information in a separate (uncompressed) encrypted data file. This has the advantage of being able to store as much text as the floppy can handle rather than what you can fit into the BBC's memory. The only information held constantly in memory is the index of where everything is in the file.

The only downside of this method is that it is useless for games stored on cassette tape.

Kind regards,

Francis.
Dreamland Fantasy Studios
http://www.dfstudios.co.uk
ghbearman
Posts: 250
Joined: Sun Apr 16, 2006 5:51 pm
Location: England
Contact:

Post by ghbearman »

If you compressed the data, you'd be able to store twice as much information on the disk :)
User avatar
Dreamland Fantasy
Posts: 562
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Post by Dreamland Fantasy »

@ghbearman

True, but my adventure at the moment is quite small and doesn't really need compressing.

My plans are to hopefully use this game as a stepping stone for bigger projects where I would definitely need to employ text compression.

Kind regards,

Francis.
Dreamland Fantasy Studios
http://www.dfstudios.co.uk
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Post by AJW »

I used disk access of text together with 6 bit letter storage and abbreviations/single letters for commonly used words for Dominion. I don't know if Level 9's description of their text compression was bravado but I wondered how they managed to get so much into a single load and with such reported reduction in size. I think I managed about 60%!
kranser
Posts: 11
Joined: Mon Nov 12, 2007 11:34 am
Contact:

Post by kranser »

What about packing methods for text?

I think characters that are normally used can be packed into less than 8 bits a character. Bit 7 can be ignored and (for letters a-z) bit 5 is always 1. However, packing limits what characters can be used in the game text.

Anyone know any packing methods that can be used, and that work ok for adventure games?

Kranser.
jon28
Posts: 37
Joined: Mon Feb 27, 2006 4:33 am
Contact:

Post by jon28 »

I recall reading an article in one of the BBC magazines about text compression in adventure games, in one of the adventure columns I think.

If I remember correctly it described one method where you'd compress on a character by character basis, with the most used characters stored in a single bit and others in three bits. Except bits isn't the right word, I'm talking about one character of a hex value (ie &DE would be split as D and E).

So 0 through E would represent the 15 most popular characters and F would flag the next two bits would be the next character. Does that make sense?
User avatar
Kecske Bak
Posts: 753
Joined: Wed Jul 13, 2005 8:03 am
Location: Mélykút, Hungary
Contact:

Post by Kecske Bak »

I remember the magazine "Your Computer" after it went all yuppy with a square spine and about three pages an issue ran a long series about adventure programming on the BBC. If anyone has them it might be good to get scans of those to Jim.
User avatar
Dreamland Fantasy
Posts: 562
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Post by Dreamland Fantasy »

If you have access to the INPUT series of magazines there are programs for (de)compressing text in there specifically for text adventures.

If you don't have access I could scan the relevant pages.

Kind regards,

Francis.
Dreamland Fantasy Studios
http://www.dfstudios.co.uk
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Post by AJW »

kranser wrote:What about packing methods for text?

I think characters that are normally used can be packed into less than 8 bits a character. Bit 7 can be ignored and (for letters a-z) bit 5 is always 1. However, packing limits what characters can be used in the game text.

Anyone know any packing methods that can be used, and that work ok for adventure games?

Kranser.
I think that's what I said above. Used 5 bits and bit 6 to denote case IIRC.
Post Reply

Return to “8-bit acorn software: classic games”