This is the spiritual successor to Shadowlord13’s map compressor. It is written in C++ and aims to implement some core functionality as efficient and portable as possible and to make Dwarf Fortress map sharing more accessible to everyone.
Supply any number of layers to the dfmapcompresspp
binary and wait for the
process to continue. On Windows, progress is printed as percentages, on Linux
and MacOS, a progress-bar is rendered.
./dfmapcompresspp -w <width> -h <height> -o <outname> <path/to/layerX.bmp>+
The outname
is optional, the output file will be named after the fortress name
deducted from the layers if the option is not given.
To speed things up, you can specify the tile size in the executable name. This
is done by having WIDTHxHEIGHT
somewhere in the name of the binary. For
example, if you name your binary dfmapcompresspp-8x12
, then the new default
tile size will be 8 pixels wide and 12 pixels high.
Windows Explorer has the neat trick of dragging files ontop of executables. When
you select all the layers you want to compress and drop them on the
dfmapcompresspp-WIDTHxHEIGHT
binary, Windows will automatically run the
compressor with the provided inputs. This way, you don’t have to worry about any
terminal and still have a fast dependency-less compressor.
DFMapCompressorPP has no other dependencies than are bundled in the
third_party
directory here in the repository and working C and C++20
compiler. To compile the software, clone it and call CMake, followed by your
compilation method of choice:
git clone https://github.com/maximaximal/DFMapCompressorPP.git
cd DFMapCompressorPP
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j
For Windows, MSYS2 is supported well. To make usage easier, a Windows x64 binary is provided in the releases of this repository.
Tile size detecion is quite a hard problem. The original code is here and tries to find some detailed tile, which it then matches. This is not implemented yet in this compressor.
This project also includes a PHP-based viewer to display maps on the web. The viewer is a simple PNG image renderer using GD that is controlled using GET parameters. They are documented here:
- t
- Render tileset instead of a layer
- l
- Render specified layer (indexed from the depth encoded in the file)
- cl
- Render specified layer (indexed from the absolute render index number in the file)
- m
- Path to a
.fdf-map
file. Also loads from remote resources. - d
- Print debug information
These parameters have to be given to the PHP script on an URL like this:
dfmappreview.php?m=MAP.fdf-map&l=200
. It can be tested locally using the local
PHP development server, like this: php -S localhost:8000
and then go to
http://localhost:8000/dfmappreview.php
It also works with legacy files loaded from the Dwarf Fortress Map Archive.