Re: [stella] Reflex: Online level editor

Subject: Re: [stella] Reflex: Online level editor
From: "Eduardo Mello" <vgbelloq@xxxxxxxxxx>
Date: Thu, 9 Sep 2004 11:19:39 -0300

Well, I don't know if I am saying anything stupid here but I like to use a simple compression algorithm with my games. Here is the idea:

- a sequence is started by a "operator" byte and followed by one or more data bytes.
- a sequence started with operator X, where X is a byte between 01h and 7Fh, indicates the next byte must be repeated X times.
- a sequence started with operator Y, where Y is a byte between 81h and FFh, indicates the next Z bytes, where Z is Y minus 80h, must be used "as is".
- 00h is a special operator which indicates end of data.
- I use 80h to set a new destination address to my transfer, so the two bytes following it become a 16 bits address.

Probably not as good as your Huffman algorithm but maybe useful for simpler applications... Again, please forgive me if it is too obvious or widely known...


----- Original Message ----- From: "Lee Fastenau" <stella@xxxxxxxxxxxxxxx>
To: <stella@xxxxxxxxxxxxxxxxxx>
Sent: Thursday, September 09, 2004 10:13 AM
Subject: SPAM-LOW: Re: [stella] Reflex: Online level editor

Ah, finally someone who shares my passion for compression. :-)

When I did my exercise with Jammed I am afraid nobody understood
exactly what I did. Maybe you can explain your algorithm better than
I could.

Data compression (much like Stella programming) had always been a mystery to me, but seemed like something that would be fun to learn about. Curiosity finally got the best of me a few months ago. I read about the huffman algorithm and coded my own huffman tree builder here:

The two links on that page, plus Googling "huffman compression" should be
enough to get anyone up to speed.  Also, feel free to view the source on my
huffman page.  The huffman tree is built and displayed using JavaScript on
the client.  I'm afraid the code is not well commented, but it may be
helpful to someone.

The attached source code has a single compressed level (search for
"levelData") and the decompression algorithm (search for "decompressLevel").
The decompression algorithm is probably one of the most well-commented
chunks of code in Reflex.

Cool idea, though the playfield is a bit limited now. Do you plan
to extend it? That would cost some RAM and ROM space, but it would
allow many more variations. I don't know about your free RAM, but with
a good compressor, ROM shouldn't become a too big problem.

I considered extending it for the same reason, but after playing with editor with mirroring set to horizontal or none, I found I was able to create some nice, identifiable _stuff_... Atari characters, RobotBob SpongeChipPants (he put the brain in the robot... you know), faces, animals, Windows icons... lots of _stuff_. :)

I was thinking more about using the full playfield resolution instead of
doubling the blocks, which I can easily do to the game engine, but the
current decompression routine would only allow for 32 total 8-bit variations
using the block layout table.  Also, I would have to trim two blocks off
either side, so the number of blocks across would be 16 vs. 20 (2x10)... but
the playfield would be horizontally narrower.  (Confusing, yes.)

Anyway, if you assemble the game, don't mind the funky paddles.  I still
need to get to those.

Have fun!

Thanks, -Lee

Archives (includes files) at
Unsub & more at
You are subscribed as: vgbelloq@xxxxxxxxxx
To unsubscribe, send email to:
Or go to:

Current Thread