Author Topic: Mappy  (Read 1282 times)

Gredler

  • Guest
Re: Mappy
« Reply #30 on: April 03, 2016, 05:00:01 AM »
How would you handle tile mirroring when it's not supported by the hardware? You'd have to "stream" rows and/or columns of tiles at a time for that kind of support. It's doable, and realtime flipping is fast with a simple small LUT, but the scroll engine itself becomes more complex; you're scrolling a bitmap image that happens to wrap at tilemap arbitrary defined boundaries.

 You can handle merging/importing sections or layers via an external app. The Mappy FMP format is pretty easy to work with.

Thanks for the heads up, I had no idea it was a hardware limitation! I am not code savvy so I had assumed that it was a undeveloped element of HuC and or Mappy, apologies if my ignorance was surprising hahaha :) Good to know and not get my hopes up. You probably would've been very shocked when I asked DK of we can rotate sprites and tiles, that's an even bigger can of worms right? :P modern development has left me wasteful and liberal woth my design ideas!!

I currently have workarounds for the import process into mappy; from mappy to game I hand the content off to DK, so I wouldn't know much about the benefits of the fmp resulting file - the contents of which look like gibberish when o open it.

Out of curiosity, what external applications do you use for processing the multiple images? I was thinking of trying to write a Python script that would help me, just grab the images in a folder and combine them vertically to make a new image that mappy can accept to save me the trouble of doing that by hand. I am currently just making my tilemap, saving it as 16 color limited chunks and using the combined map in mappy to generate my fmp.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Mappy
« Reply #31 on: April 03, 2016, 07:48:49 AM »
Well, in case you write any apps that directly edit FMP files, here's this:
Code: [Select]
//
// FMP format
// +0 (INT)  'FORM'
// +4 (INT)  file size (big endian). Starting from byte 8.
// +4 (INT)  'FMAP'
//
// +4    (INT)  'MPHD' map header.
// +4    (INT)  sizeof (big endian).
// +4    (INT)  version # 16bit.16bit (lil' endian).
// +4    (INT)  (WORD/WORD) (lil' endian) width in tiles (lil' endian) / height in tiles (lil' endian).
// +4    (INT)  unknown.
// +4    (INT)  (WORD/WORD) (lil' endian) tile width in pixels (lil' endian) / tile height in pixels (lil' endian).
// +4    (INT)  unknown. Last byte is possibly bit depth. Seems to be '8' for palettized projects (lil' endian).
// +4    (INT)  (WORD/WORD) (lil' endian) # of tiles (lil' endian) / # of tiles (lil' endian).
// .
// .
// +offset (INT)  'EDHD' <something> header.
// +4 (INT)  sizeof/len (big endian)
// +4 (INT)  unknown.
// +4 (INT)  number of colors used for tiles (lil' endian).
// +Data (INT)  unknown data.
// .
// .
// +offset (INT)  'EPHD' <something> header.
// +4 (INT)  sizeof/len (big endian).
// +Data ( ? )  unknown data.
// .
// .
// +offset (INT)  'LSTR' header. Layer String names.
// +4 (INT)  sizeof/len (big endian).
// +4 (INT) ??? Seems to be fixed to 0x00000008
// +4 (INT)  Number of layers
// +Data ( ? )  Layer text names.
// .
// .
// +offset (INT)  'CMAP' palette data.
// +4 (INT)  sizeof/len (big endian). Seems to be fixed in size regardless if <256 color entries.
// +Data (CHAR) R/G/B palette data. 3 BYTE segments.
// .
// .
// +offset (INT)  'BKDT' - unknown. Appears to be tile attributes.
// +4    (INT)  sizeof/len (big endian).
// +Data ( ? ) unknown data.
// .
// .
// +offset (INT)  'BGFX' - Tiles data/pixels. Pixel depth is 8bit for palettized projects.
// +4      (INT)  sizeof/len (big endian).
// .Data ( ? )  Variable in size. Palettetized tiles are BYTE/pixel format.
// .
// .
// +offset (INT)  'BODY' - map data. The primary layer.
// +4 (INT) Length of map data in bytes.
// .Data ( ? )  Note: FMP 1.0 map data is a tile number. FMP 0.5 map data is a tile number * 64.
//
// +offset (INT)  'LYRn' - map data. n = layer #.
// +4 (INT) Length of map data in bytes.
// .Data ( ? )  Note: Additional layers after 'BODY'.
//

 Though beware there are internal structural differences from FMP 1.0 and FMP 0.5. I always work with FMP 1.0, but I never use those files directly with huc or pceas, so I have no idea how it handles either version directly. I always convert them myself and output them as raw data.

I just add features as I need them:
Code: [Select]
printf("FMP to PCE map converter. Ver 1.0.6-a");
printf("\n -Usage: fmp2pce <source.ext> -option ");
printf("\n  -o<n>      <n> is the subpalette offset for the tilemap. 1 digit hex");
printf("\n  -l<n>      <n> is the length of output palette block; (n+1)*16. 1 digit hex");
printf("\n  -v<n>      Tile offset in vram (kWORDs). 3 digit hex. Default is 100h");
printf("\n  -s         Output the tile map in vertical strips instead of horizontal");
printf("\n  -c<n>      Output byte-wide collision map for <n> layer.");
printf("\n  -e         Use embedded color encoding to build palette map data in tilemap");
printf("\n  -x1<n>     Clip map: horiztonal start position. Value must be a 4digit hex");
printf("\n  -y1<n>     Clip map: vertical start position. Value must be a 4digit hex");
printf("\n  -x2<n>     Clip map: horiztonal end position. Value must be a 4digit hex");
printf("\n  -y2<n>     Clip map: vertical end position. Value must be a 4digit hex");
printf("\n  -m16       Convert 16x16 map for 'no LUT' expansion. ");
printf("\n  -m8        Convert 16x16 map into 8x8 map. ");
printf("\n  -to<n>     Offset collision tile # (tile# - n, saturated floor at 0x00/0x01).");
printf("\n             ^-Note: <n> is 3 digit hex max. Large values create 0/1 maps.");
printf("\n  -z<name>    Up to 10digits. Results in <name>.ext for file outputs.");
printf("\n");
printf("\n '15 Tomaitheous");
printf("\n");

Quote
Out of curiosity, what external applications do you use for processing the multiple images? I was thinking of trying to write a Python script that would help me, just grab the images in a folder and combine them vertically to make a new image that mappy can accept to save me the trouble of doing that by hand. I am currently just making my tilemap, saving it as 16 color limited chunks and using the combined map in mappy to generate my fmp.
Usually just photoshop and use layers from bitmap images. Unless it's something complex, like subpalette arrangements, then I just write a quick command line app for it. Though I really want to get away from mappy. I have a makeshift subpalette support for it, but a native PCE map app would be much better.
« Last Edit: April 03, 2016, 07:51:26 AM by Bonknuts »