I've implemented mega tile level compression in the gconvert tool. This allows a user to define a big level map that would normally be too large to be practical (eg. when doing big scrolling levels). The tool will then automatically create a 'mega map' with de-duplicated mega tiles. The original level map will then index the mega map instead of the tile map. The mega map in turn indexes the tile map. Now you can draw out your entire scrolling level in your favorite graphics editor and gconvert will perform this compression for you automatically on request. Below is an example configuration and conversion. I hope the community finds this useful.
Code: Select all
<mega-map var-name="map_level_mega_tiles" mega-tile-width="5" mega-tile-height="5">
<map var-name="map_level_1" left="0" top="10" width="255" height="25"/>
<map var-name="map_level_2" left="0" top="62" width="255" height="25"/>
<map var-name="map_level_3" left="0" top="88" width="255" height="25"/>
<map var-name="map_level_4" left="0" top="114" width="255" height="25"/>
<map var-name="map_level_5" left="0" top="140" width="255" height="25"/>
</mega-map>
<mega-map var-name="map_extra_mega_tiles" mega-tile-width="4" mega-tile-height="5">
<map var-name="map_level_6" left="0" top="36" width="32" height="25"/>
</mega-map>
Example conversion:
Code: Select all
...
#define MAP_LEVEL_6_WIDTH 8
#define MAP_LEVEL_6_HEIGHT 5
const char map_level_6[] PROGMEM ={
8,5
,0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0x0,0xa,0xb,0x0,0x3,0xc,0xd,0xe,0xf,0x10
,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x6,0xc,0x1d,0x3,0x1e,0x1f,0x3,0x20};
#define MAP_EXTRA_MEGA_TILES_MEGA_TILE_WIDTH 4
#define MAP_EXTRA_MEGA_TILES_MEGA_TILE_HEIGHT 5
#define MAP_EXTRA_MEGA_TILES_MEGA_TILE_COUNT 33
const char map_extra_mega_tiles[] PROGMEM ={
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1d,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x1d,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
...
The code has been tested and works fine.
I've opened a pull request (
https://github.com/Uzebox/uzebox/pull/60) from the fork I used to build this. Hope that's the correct way of contributing. Let me know if you want me
to approach this differently or of course any comments, changes or fixes you would like me to apply to the pull request.