Magic Pockets Map Format

From ModdingWiki
Jump to navigation Jump to search
Magic Pockets Map Format
File:Magic Pockets Map Format.png
There is no image of a map in this format — upload one!
Format typeMap/level
Map type2D tile-based
Layer count1
Tile size (pixels)32×16
Viewport (pixels)320×192
Games

Maps in Magic Pockets are stored in .pap files, with an RNC method 1 compression wrapper. Each map is 128×128 cells, covering 4096×2048 pixels at the game's 32×16 tile size.

The eight world map files are level1a.pap, level1b.pap through level4a.pap, level4b.pap. The collection also includes pcmap.pap for the attract demo and sea.pap, whose game use is not established.

File format

The decompressed file is exactly 16384 bytes, with no header: one unsigned byte per cell, in row-major order. There are no multi-byte fields.

Data type Name Description
UINT8[128][128] tiles 128 rows of 128 cell values

For column x and row y, the cell is at y * 128 + x. Each value v selects tile v - 1 in the matching blocks tileset. The original loader transposes the grid to column-major order in memory; this does not change the on-disk order.

Tiles and collision

The map contains only one tile-number layer. It has no separate collision plane, object block, trigger directory or text. Collision classification is looked up from the executable's ground table. The shipped grids use positive tile indices; a viewer's treatment of zero as empty does not establish an original-game authoring rule for zero.

Objects and level events

Entity placement and authored transitions are stored separately in level-script PIN files. The A/B map filename suffix is not a count of level-script entry points: several script entries can share a single map and overlapping event streams.

Source code

From re-magicpockets, the open-source browser port and reverse-engineering project:

Credits

This file format was reverse engineered by VorticonCmdr. Please credit this work in projects that use it; a link back to this wiki is appreciated.