It is currently Thu Sep 20, 2018 11:39 am

 All times are UTC - 7 hours

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Question on RLEPosted: Wed Feb 13, 2013 12:24 pm

Joined: Thu Dec 27, 2012 8:15 pm
Posts: 22
My RLE idea is to store 2x2 meta tiles for my backgrounds. The idea I came up with is to have the left nibble
be the repeat number and the right nibble to be the tile number. Instead of the right nibble being 0 - F, it would
be 0-9. A-F in the right nibble would be a bank switch for the 10 tileset.

Code:
bg:
.db \$0A ; bank A
.db \$F3 ; draw tile number 3 from bank A 16 times
.db \$0B ; bank B
.db \$82 ; draw tile number 2 from bank B 8 times
.db \$83 ; draw tile nubmer 3 from bank B 8 times

Of course, I will probably want to draw vertical columns because it will be a side scroller.

The reason for this post is that I'm not sure if I am taking the correct approach here. I have seen links to packBits
elsewhere, but I haven't tested yet.

The goal is to get the most compressed nametables possible because I am running NROM for now.

Thanks,

Top

 Post subject: Re: Question on RLEPosted: Wed Feb 13, 2013 12:53 pm

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4076
Using 4 bits for the number of tiles and 4 bits for the tile number isn't that new, Zelda 2 and Dragon Warrior were doing exactly that. But they did it horizontally, not vertically.
But using A-F as tile numbers to select a bank is a waste of encoding space, since the length isn't used anymore.

Suggestions:
0-D = tiles
E = repeat whatever was in the previous column, use the length# for the number of tiles to take.
F = switch bank of 14 tiles, use length as the bank number instead of a length.

Or throw out vertical RLE entirely, and use reusable big blocks of metatiles, such as 4x4 metatiles, or 8x8 metatiles.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

Top

 Post subject: Re: Question on RLEPosted: Wed Feb 13, 2013 12:54 pm
 Formerly 65024U

Joined: Sat Mar 27, 2010 12:57 pm
Posts: 2263
You can use the top 2 bits to identify a bank for a tile since they won't be used and then pull the attributes from a table in said bank. Or sacrafice the first few metatiles as operators for the bank changes, so 0-3 would be bank switches and then 4 to 255 would be the attribute-4. I myself would either use the top 2 bits as the attribute and let the LEVEL data contain the bank used for the level of metatiles. If that was not an option, I'd probably choose the "pull attribute from bank" and let the top 2 bits signify the bank.

And as for horizontal compression, I'd say a dictionary-based scheme (With RLE encoded entries?) would provide best size/level size ratio. If you keep standard metatiles (for floor, blank, etc.) you can even re-use lots of the strips on the screen. Just a few ideas, hope they help.

Top

 Post subject: Re: Question on RLEPosted: Wed Feb 13, 2013 4:42 pm

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10814
Location: Rio de Janeiro - Brazil
johnnystarr wrote:
The goal is to get the most compressed nametables possible

You will certainly not get that with RLE. Throw it a simple checkerboard pattern and RLE won't compress a single bit, it will probably expand the data, actually. If you want better compression you must have a way to repeat patterns longer than 1 symbol.

Top

 Post subject: Re: Question on RLEPosted: Thu Feb 14, 2013 10:28 am

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7517
Location: Chexbres, VD, Switzerland
You should check my CompressTools, which have about 7-8 different compression schemes available. By default it compresses data using all the algorithms, and display info so you can see the ones which works the best for your data.

What you describe is not new, it is what I call "Bitpack RLE". What you describe is a particular case where the data is 4 bit and run length is 4 bit, but the same concept can apply from 1 bit of data + 7 bit of run lenght to 7 bit of data + 1 bit of run length (in this case it's either a single byte or a run of 2).

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki