diff --git a/README.rst b/README.rst index 22fa153..647bee2 100644 --- a/README.rst +++ b/README.rst @@ -1,492 +1,86 @@ -Minetest Mapper C++ -=================== +Minetest Mapper +############### -A port of minetestmapper.py to C++ from https://github.com/minetest/minetest/tree/master/util +A tool to generate maps of minetest and freeminer worlds. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Requirements ------------- +Quick links (functional on github. Elsewhere possibly not): -* libgd -* sqlite3 (enabled by default, set ENABLE_SQLITE3=0 in CMake to disable) -* leveldb (optional, set ENABLE_LEVELDB=1 in CMake to enable leveldb support) -* hiredis (optional, set ENABLE_REDIS=1 in CMake to enable redis support) +:All features: ``_ +:User manual: ``_ +:Changelog: ``_ +:Building: ``_ +:Github: ``_ +:Bugs: ``_ -Compilation ------------ +Features (short list) +===================== + +Map Generation +-------------- + +* Support for both minetest and freeminer worlds +* Support for sqlite3, leveldb and redis map databases +* Generate a subsection of the map, or a full map + (but note that the size of generated images is limited) +* Generate regular maps or height-maps +* All colors for regular or height maps are configurable +* Draw player positions +* Draw different geometric figures, or text on the map +* Draw the map at a reduced scale. E.g. 1:4. +* Draw a scale on the left and/or top side of the map, + and/or a height scale (for height maps) on the bottom. +* Optionally draw some nodes transparently (e.g. water) +* User Manual + +Building +-------- +* Supports both the gcc and clang compiler suites +* Build windows, rpm, deb and/or tar.gz installation + packages. Or simply type 'make install'. + +Quick Start +=========== + +After installation, minetestmapper is started as follows: + +('\\' is a continuation character - the command-line continues +on the next line. Type return only after the line that does +not end with the continuation character) -Plain: :: - cmake . - make + minetestmapper \ + --input \ + --output -With levelDB and Redis support: +If the world is not too large, and if minetestmapper is installed in +a system directory, it will most likely work as expected. + +Possibly, minetestmapper will not be able to find a colors.txt file. If that happens, +the colors.txt file can be specified on the command-line: :: - cmake -DENABLE_LEVELDB=true -DENABLE_REDIS=true . - make + minetestmapper \ + --input \ + --output \ + --colors -Create installation package(s): +Or the colors.txt file must be installed in a location where minetestmapper will find it. +A colors.txt file (named ``colors.txt``, in lowercase) in the world's directory will certainly +be found. Depending on the system and the configuration, other locations are available. Use the +following command to find out which: :: - cpack + minetestmapper \ + --input \ + --output \ + --verbose-search-colors=2 -Cmake variables: -^^^^^^^^^^^^^^^^ +Manual +====== -ENABLE_SQLITE3: - Enable sqlite3 backend support (on by default) - -ENABLE_LEVELDB: - Enable leveldb backend support (off by default) - -ENABLE_REDIS: - Enable redis backend support (off by default) - -ENABLE_ALL_DATABASES: - Enable support for all backends (off by default) - -CMAKE_BUILD_TYPE: - Type of build: 'Release' or 'Debug'. Defaults to 'Release'. - -CREATE_FLAT_PACKAGE: - Create a .tar.gz package suitable for installation in a user's private directory. - The archive will unpack into a single directory, with the mapper's files inside - (this is the default). - - If off, .tar.gz, .deb and .rpm packages suitable for system-wide installation - will be created if possible. The tar.gz package will unpack into a directory hierarchy. - - For creation of .deb and .rpm packages, CMAKE_INSTALL_PREFIX must be '/usr'. - - For .deb package creation, dpkg and fakeroot are required. - - For .rpm package creation, rpmbuild is required. - -ARCHIVE_PACKAGE_NAME: - Name of the .zip or .tar.gz package (without extension). This will also be - the name of the directory into which the archive unpacks. - - Defaults to minetestmapper-- - - The name of .deb and .rpm packages are *not* affected by this variable. - -Usage ------ - -Binary `minetestmapper` has two mandatory paremeters, `-i` (input world path) -and `-o` (output image path). - -:: - - ./minetestmapper -i ~/.minetest/worlds/my_world/ -o ~/map.png - - -Parameters -^^^^^^^^^^ - -version: - Print version ID of minetestmapper. - -colors : - Filename of the color definition file to use. - - By default, a file 'colors.txt' is used, which may be located: - - * In the directory of the world being mapped - - * In the directory two levels up from the directory of the world being mapped, - provided that directory contains a file 'minetest.conf' - - * In the user's private directory ($HOME/.minetest) - - * In the system directory correpsonding to the location where minetestmapper - is installed. Usually, this would be /usr/share/games/minetestmapper/colors.txt - or /usr/local/share/games/minetestmapper/colors.txt - - * For compatibility, in the current directory as a last resort. - This causes a warning message to be printed. - - If the colors file contains duplicate entries for the same node, - one with alpha = 255, or absent, and one with alpha < 255, the former - is used without 'drawalpha', and the latter is used with 'drawalpha': - -:: - - # Entry that is used without 'drawalpha': - default:water-source 39 66 106 - # Entry that is used with 'drawalpha': - default:water-source 78 132 212 64 224 - - The colors file can include other colors files using: - -:: - - @include filename - - Any entries after the inclusion point override entries from the - included file. Already defined colors can be 'undefined' by specifying - '-' as color: - -:: - - default:stone 71 68 67 - # default-colors.txt might override the color of default:stone - @include default-colors.txt - # color of default:dirt_with_grass from default-colors.txt is overridden: - default:dirt_with_grass 82 117 54 - # Color of water is undefined here: - default:water_source - - default:water_flowing - - -heightmap[-grey]: - Draw a height-map instead of a regular map. - - A height map needs a custom colors file that contains only the nodes that - define the height. As a general directive, plants and other special nodes - should not be included in the file. Normally, water nodes should not be - included either. - - The colors used are predefined and not yet configurable. - - The colors support a maximum depth below sea level of 60, although below a - depth of 30 they become progressively darker. - Above sea level, they support a maximum height of 250. - Starting from height level 70, greyish colors are used (think: 'rocky') - Starting from height level 111, shades of white are used (think: 'snowy'). - - For '--heightmap-grey', a 255-level greyscale map is generated, with colors - ranging from black for level 0 and below, to white for 255 and above. - -heightmap-scale - Scale the heights of the map before computing the colors. - - Note that the water level is not rendered correctly for scale factors - smaller than 1, nor for small non-integer scale factors. - -sealevel: - Set the sea level for the height map. Nodes at or below sea level are - drawn in blue, nodes above sea level are drawn in other colors. - - The sea level *does* *not* reflect the presence of actual water. - -bgcolor: - Background color of image, `--bgcolor #ffffff` - -blockcolor: - Default color of nodes in blocks that are in the database, `--blockcolor #ffffff` - - If a block is in the database, but some of its nodes are not visible (because they are - air, or 'invalid', the nodes are drawn in this color (as opposed to the background - color, which shows for blocks that are not in the database) - -scalecolor: - Color of scale, `--scalecolor #000000` - -playercolor: - Color of player indicators, `--playercolor #ff0000` - - An alpha value can be specified, but due to a bug in the - drawing library, it will not have the desired effect. - -origincolor: - Color of origin indicator, `--origincolor #ff0000` - - An alpha value can be specified, but due to a bug in the - drawing library, it will not have the desired effect. - -drawscale: - Draw tick marks, `--drawscale` - -drawplayers: - Draw player indicators, `--drawplayers` - -draworigin: - Draw origin indicator, `--draworigin` - -drawalpha[=cumulative|cumulative-darken|average|none]: - Allow blocks to be drawn with transparency, `--drawalpha=average` - - In cumulative mode, transparency decreases with depth, and darkness of - the color increases. After a certain number of transparent blocks - (e.g. water depth), the color will become opaque, and the underlying - colors will no longer shine through. The height differences *will* - still be visible though. - - In cumulative-darken mode, after the color becomes opaque, it will gradually - be darkened to visually simulate the bigger thickness of transparent blocks. - The downside is that eventually, the color becomes black. - - Cumulative-darken mode makes deeper, but not too deep water look much better. - Very deep water will become black though. - - In average mode, all transparent colors are averaged. The blocks remain transparent - infinitely. If no parameter is given to --drawalpha, 'average' is the default. - - 'None' disables alpha drawing. This is the same as not using --drawalpha at all. - - For backward compatibility, 'nodarken' is still recognised as alias for 'cumulative'; - 'darken' is still recognised as alias for 'cumulative-darken'. Please don't use - them, they may disappear in the future. - - Note that each of the different modes has a different color definition - for transparent blocks that looks best. For instance, for water, the following - are suggested: - - (disabled): 39 66 106 [192 224 - optional: alpha configuration will be ignored] - - cumulative: 78 132 255 64 224 - - cumulative-darken: 78 132 255 64 224 - - average: 49 82 132 192 224 (look also good with alpha disabled) - - Custom colors files are provided for these alternatives: colors-average-alpha.txt - and colors-cumulative-alpha.txt - -drawair: - Draw air blocks. `--drawair` - - For best results, the air color should be defined as fully transparent - so that the color of underlying blocks overrides it. - - This option has a significant performance impact. - -noshading: - Don't draw shading on nodes, `--noshading` - -min-y: - Don't draw nodes below this y value, `--min-y -25` - -max-y: - Don't draw nodes above this y value, `--max-y 75` - -backend: - Use specific map backend, supported: auto, sqlite3, leveldb, redis, `--backend leveldb` - - By default, the backend is 'auto', i.e. it is determined from the backend - setting in the world's world.mt file (if found). - -centergeometry : - (see below, under 'geometry') - -cornergeometry : - (see below, under 'geometry') - -geometry : - Limit the part of the world that is included in the map. - - has one of the formats: - - x[<+|-xoffset><+|-yoffset>] (dimensions & corner) - - ,+width+height (corner & dimensions) - - ,:widthxheight (center & dimensions) - - ,:, - - The old/original format is also supported: - - :+width+height (corner & dimensions) - - For 'cornergeometry', the offsets ([xy]offset or [xy]center) will - be at the lower-left corner of the image (offsets increase from left - to right, and from bottom to top). - - For 'centergeometry', the offsets ([xy]offset or [xy]center) will be - in the center of the image. - - For plain 'geometry', the offsets will be at the corner, or in - the center, depending on the geometry format. - - If the offsets are not specified (with the first format), - the map is centered on the center of the world. - - By default, the geometry has pixel granularity, and a map of - exactly the requested size is generated. - - *Compatibility mode*: - - If the *first* geometry-related option on the command-line - is `--geometry`, *and* if the old format is used, then for - compatibility, the old behavior is default instead (i.e. - block granularity, and a smaller map if possible). Block - granularity is also enabled when the obsolete (and otherwise - undocumented) option '--forcegeometry' is found first. - - Examples: - - `--geometry 10x10-5-5` - - `--geometry 100,100:500,1000` - - `--cornergeometry 50x50+100+100` - - `--centergeometry 1100x1300+1000-500` - - `--geometry 1100x1300` - -geometrymode pixel,block,fixed,shrink: - Specify how the geometry should be interpreted. One or - more of the flags may be used, separated by commas or - spaces. In case of conflicts, the last flag takes - precedence. - - When using space as a separator, make sure to enclose - the list of flags in quotes! - -geometrymode pixel: - Interpret the geometry specification with pixel granularity, - as opposed to block granularity (see below). - - A map of exactly the requested size is generated (after - adjustments due to the 'shrink' flag). - -geometrymode block: - Interpret the geometry specification with block granularity. - - The requested geometry will be extended so that the map does - not contain partial map blocks (of 16x16 nodes each). - At *least* all pixels covered by the geometry will be in the - map, but there may be up to 15 more in every direction. - -geometrymode fixed: - Generate a map of the requested geometry, even if part - or all of it would be empty. - - *NOTE*: If this flag is used, and no actual geometry is - specified, this would result in a maximum-size map (65536 - x 65536), which is currently not possible, and will fail, - due to a bug in the drawing library. - -geometrymode shrink: - Generate a map of at most the requested geometry. Shrink - it to the smallest possible size that still includes the - same information. - - Currently, shrinking is done with block granularity, and - based on which blocks are in the database. If the database - contains empty, or partially empty blocks, there may still - be empty pixels at the edges of the map. - -sqlite-cacheworldrow: - When using sqlite, read an entire world row at one, instead of reading - one block at a time. - - This may improve performance when a large percentage of the world is mapped. - -chunksize: - Manually specify the chunk size (for use with --tiles chunk) - -tiles [+]|block|chunk - Divide the map in square tiles of the requested size. A border of the - requested width (or width 1, of not specfied) is drawn between the tiles. - In order to preserve all map pixels (and to prevent overwriting them with - borders), extra pixel rows and columns for the borders are inserted into - the map. - - The special values 'block' and 'chunk' draw tiles that correspond to map - blocks (16x16 nodes) or to chunks (the unit of map generation; 5x5 blocks - for a world with default settings). - - In order to allow partial world maps to be combined into larger maps, edge - borders of the map are always drawn on the same side (left or top). Other - edges are always border-less. - - Examples: - - `--tiles 1000` - - `--tiles 1000+2` - - `--tiles block` - - NOTE: As a consequence of preserving all map pixels: - - * tiled maps (in particular slanted straight lines) may look slightly - skewed, due to the inserted borders. - - * scale markers never align with tile borders, as the borders are - logically *between* pixels, so they have no actual coordinates. - - -tileorigin x,y - Arrange the tiles so that one tile has its bottom-left (i.e. south-west) - corner at map coordinates x,y. - - (see also `tilecenter`) - -tilecenter x,y|map|world - Arrange the tiles so that one tile has its center at map coordinates x,y. - - If the value 'world' is used, arrange for one tile to have its center - at the center of the world instead. This is the default for tiles. - - If the value 'map' is used, arrange for one tile to have its center - at the center of the map instead. - - Examples: - - `--tilecenter -500,-500` - - `--tileorigin 0,0` - - `--tilecenter map` - - `--tilecenter world` - -tilebordercolor - Color of border between tiles, `--tilebordercolor #000000` - -draw[map]
" []" - Draw a geometrical figure on the map, using either world or map - coordinates. - - NOTE: the quotes around the two or three parameters to these - options are absolutely required. - - Possible figures: point, line, circle, ellipse, rectangle, text; - 'circle' is an alias for 'ellipse' - it therefore requires - two dimensions, just like an ellipse. - - Examples: - - `--drawellipse "5x5+2+3 #ff0000"` - - `--drawcircle "4,5:5x4 #ff0000"` - - `--drawline "5x5+8+8 #80ff0000"` - - `--drawline "8,8:12,12 #80ff0000"` - - `--drawmapline "3x5+4+6 #ffff0000"` - - `--drawtext "0,0 #808080 center of the world" - - `--drawmaptext "0,0 #808080 top left of the map" - - Note that specifying an alpha value does not have the expected - result when drawing an ellipse. - -verbose: - report some useful / interesting information: - - * maximum coordinates of the world - - * world coordinates included the map being generated - - * number of blocks: in the world, and in the map area. - - Using `--verbose=2`, report some more statistics, including: - - * database access statistics. - -verbose-search-colors: - report the location of the colors file(s) that are read. - - With `--verbose-search-colors=2`, report all locations that are being - considered as well. +For more elaborate usage instruction, please consult the user manual: ``_. diff --git a/doc/build-instructions.rst b/doc/build-instructions.rst new file mode 100644 index 0000000..ffaeef9 --- /dev/null +++ b/doc/build-instructions.rst @@ -0,0 +1,129 @@ +Minetest Mapper Build Instructions +################################## + +Minetestmapper can be built on posix (linux, freebsd, ...), osx and windows +platforms (although not all platforms receive the same amount of testing - +please let me know if there is a problem on your platform). + +Both the gcc and clang compiler suites are supported. + +Requirements +============ + +**Libraries:** + +* libgd +* sqlite3 (enabled by default, set ENABLE_SQLITE3=0 in CMake to disable) +* leveldb (optional, set ENABLE_LEVELDB=1 in CMake to enable leveldb support) +* hiredis (optional, set ENABLE_REDIS=1 in CMake to enable redis support) + +**Build environment:** + +* C++ compiler suite (clang or gcc) +* cmake +* make + +**Documentation:** + +If converting the documentation to HTML, or another format is desired: + +* python-docutils + + +Compilation +=========== + +Plain: + +:: + + cmake . + make + +With levelDB and Redis support: + +:: + + cmake -DENABLE_LEVELDB=true -DENABLE_REDIS=true . + make + +Create installation package(s): + +:: + + cpack + +Cmake variables: +---------------- + +ENABLE_SQLITE3: + Enable sqlite3 backend support (on by default) + +ENABLE_LEVELDB: + Enable leveldb backend support (off by default) + +ENABLE_REDIS: + Enable redis backend support (off by default) + +ENABLE_ALL_DATABASES: + Enable support for all backends (off by default) + +CMAKE_BUILD_TYPE: + Type of build: 'Release' or 'Debug'. Defaults to 'Release'. + +CREATE_FLAT_PACKAGE: + Create a .tar.gz package suitable for installation in a user's private directory. + The archive will unpack into a single directory, with the mapper's files inside + (this is the default). + + If off, .tar.gz, .deb and .rpm packages suitable for system-wide installation + will be created if possible. The tar.gz package will unpack into a directory hierarchy. + + For creation of .deb and .rpm packages, CMAKE_INSTALL_PREFIX must be '/usr'. + + For .deb package creation, dpkg and fakeroot are required. + + For .rpm package creation, rpmbuild is required. + +ARCHIVE_PACKAGE_NAME: + Name of the .zip or .tar.gz package (without extension). This will also be + the name of the directory into which the archive unpacks. + + Defaults to minetestmapper-- + + The names of .deb and .rpm packages are *not* affected by this variable. + +Converting the documentation +============================ + +Using python-docutils, the manual can be converted to a variety of formats. + +**HTML** + +Conversion to HTML yields a nice manual: + +:: + + cd doc + rst2html manual.rst > manual.html + +**Unix manpage** + +Conversion to unix man format has acceptable, but not perfect results: + +:: + + cd doc + rst2html manual.rst > minetestmapper.1 + +**PDF** + +The results of using rst2pdf (which, as an aside, is not part of python-docutils) +to convert to PDF directly are not good: random images are scaled down, some even +to almost invisibly small. If PDF is desired, a good option is to open the HTML file +in a webbrowser, and print it to PDF. + +**Other** + +Other conversions are possible using python-docutils. If you tried any, and +they warrant specific instructions, feel free to contribute. diff --git a/doc/features.rst b/doc/features.rst new file mode 100644 index 0000000..a48bb07 --- /dev/null +++ b/doc/features.rst @@ -0,0 +1,107 @@ +Minetest Mapper Features +######################## + +Minetestmapper generates maps of minetest and freeminer worlds. + +Major Features +============== +* Support for both minetest and freeminer +* Support for sqlite3, leveldb and redis map databases +* Generate a subsection of the map, or a full map + (but the size of generated images is limited - see + 'Known Problems' below) +* Generate regular maps or height-maps +* All colors for regular or height maps are configurable +* Draw player positions +* Draw different geometric figures, or text on the map +* Draw the map at a reduced scale. E.g. 1:4. +* Draw a scale on the left and/or top side of the map, + and/or a height scale (for height maps) on the bottom. +* Optionally draw some nodes transparently (e.g. water) +* User manual + + +Build Features +============== +* Supports both the gcc and clang compiler suites +* Build windows, rpm, deb and/or tar.gz installation + packages. Or simply type 'make install'. + +Minor Features +============== +* Specify a number colors symbolically ('red', ...) +* Draw a grid on the map +* Show a progress indicator +* Draw shades to accentuate height differences (on by default) +* Report actual world dimensions in all directions, as + well which part of it will be in the map. + +Differences From Stock Minetestmapper +===================================== +* Support for the new freeminer database format +* Different methods for drawing transparent blocks + (more than transparency on and off) +* Different colors can be specified for nodes, in the + same colors file, depending on whether transparency + is enabled or not. +* Abiliy to draw different geometric figures, or text on the map +* Map dimensions can be specified in different ways: + + - using two corners + - using a corner and the size + - using the center and the size + +* Pixel or block granularity for the dimensions + (stock minetestmapper always uses block granularity: it rounds + all dimensions to the next multiple of 16). +* Colors files are automatically searched for in the world + directory, or in system directories +* Colors files can include others, so that just a few colors can + be redefined, and the system colors file used for the others. +* The map can be draw at a reduced scale. + This means that a full world map can now be generated. +* A grid can be drawn on the map. +* A number of symbolic colors ('red', ...) are available on the + command-line. +* The scale can be enabled on the left and top side individually +* Major and minor (tick) intervals are configurable for the scale +* Block numbers are shown on the scale as well + +In addition a number bugs have been fixed. As bugs are also getting +fixed in the stock version of minetestmapper, no accurate list +can be given. + +Known Problems +============== + +* It is currently not possible to generate huge maps. + + On 32-bit systems, the map size is limited by the maximum amount of memory + (or really: the size of the address space). + this means in practise that maps larger than about 24100x24100 (determined + experimentally - YMMV) can't be generated. Note, that even if a larger + /could/ be generated, most 32-bit applications would still not be able to + display it for the same reason. + + On 64-bit systems, the libgd image library unfortunately limits the map + size to approximately 2147483648 pixels, e.g. approximately 46300x46300. + + If a full map is required for a world that is too large, there are currently + two options: + + - Generate the map in sections, and use another application to paste them + together. + - Generate a 1:2 or 1:4 scaled version of the map, if the reduced level of + detail is acceptable. + + A third alternative, is of course to support the libgd project in removing + the current restrictions on image size. + +* On scaled maps, the colors of some pixels may be invisibly different on + different systems. + + The difference would be at most 1/256 per color. + (e.g., a pixel with color ``#4c92a1`` on one system, might have color + ``#4x91a1`` on another system) + + The cause of this difference has not been determined yet. diff --git a/doc/images/alpha-average.png b/doc/images/alpha-average.png new file mode 100644 index 0000000..856e106 Binary files /dev/null and b/doc/images/alpha-average.png differ diff --git a/doc/images/alpha-cumulative-darken.png b/doc/images/alpha-cumulative-darken.png new file mode 100644 index 0000000..3b3418b Binary files /dev/null and b/doc/images/alpha-cumulative-darken.png differ diff --git a/doc/images/alpha-cumulative.png b/doc/images/alpha-cumulative.png new file mode 100644 index 0000000..f8b78d8 Binary files /dev/null and b/doc/images/alpha-cumulative.png differ diff --git a/doc/images/background-blueish.png b/doc/images/background-blueish.png new file mode 100644 index 0000000..d5e9b33 Binary files /dev/null and b/doc/images/background-blueish.png differ diff --git a/doc/images/background-white.png b/doc/images/background-white.png new file mode 100644 index 0000000..763b268 Binary files /dev/null and b/doc/images/background-white.png differ diff --git a/doc/images/blockcolor-yellowish.png b/doc/images/blockcolor-yellowish.png new file mode 100644 index 0000000..4139ded Binary files /dev/null and b/doc/images/blockcolor-yellowish.png differ diff --git a/doc/images/default-0.0.png b/doc/images/default-0.0.png new file mode 100644 index 0000000..6d401a6 Binary files /dev/null and b/doc/images/default-0.0.png differ diff --git a/doc/images/drawair.png b/doc/images/drawair.png new file mode 100644 index 0000000..16f0c6c Binary files /dev/null and b/doc/images/drawair.png differ diff --git a/doc/images/drawcircle.png b/doc/images/drawcircle.png new file mode 100644 index 0000000..1192047 Binary files /dev/null and b/doc/images/drawcircle.png differ diff --git a/doc/images/drawline.png b/doc/images/drawline.png new file mode 100644 index 0000000..ae7801e Binary files /dev/null and b/doc/images/drawline.png differ diff --git a/doc/images/draworigin.png b/doc/images/draworigin.png new file mode 100644 index 0000000..0aa6a3d Binary files /dev/null and b/doc/images/draworigin.png differ diff --git a/doc/images/drawpoint.png b/doc/images/drawpoint.png new file mode 100644 index 0000000..9240c68 Binary files /dev/null and b/doc/images/drawpoint.png differ diff --git a/doc/images/drawrectangle.png b/doc/images/drawrectangle.png new file mode 100644 index 0000000..691868b Binary files /dev/null and b/doc/images/drawrectangle.png differ diff --git a/doc/images/drawscale-both.png b/doc/images/drawscale-both.png new file mode 100644 index 0000000..cd333c4 Binary files /dev/null and b/doc/images/drawscale-both.png differ diff --git a/doc/images/drawscale-left.png b/doc/images/drawscale-left.png new file mode 100644 index 0000000..5a133b1 Binary files /dev/null and b/doc/images/drawscale-left.png differ diff --git a/doc/images/drawscale-top.png b/doc/images/drawscale-top.png new file mode 100644 index 0000000..7a330dc Binary files /dev/null and b/doc/images/drawscale-top.png differ diff --git a/doc/images/drawtext.png b/doc/images/drawtext.png new file mode 100644 index 0000000..39f8139 Binary files /dev/null and b/doc/images/drawtext.png differ diff --git a/doc/images/geometrymode-block.png b/doc/images/geometrymode-block.png new file mode 100644 index 0000000..fcebda7 Binary files /dev/null and b/doc/images/geometrymode-block.png differ diff --git a/doc/images/geometrymode-shrink.png b/doc/images/geometrymode-shrink.png new file mode 100644 index 0000000..bba6eb1 Binary files /dev/null and b/doc/images/geometrymode-shrink.png differ diff --git a/doc/images/geometrymode.png b/doc/images/geometrymode.png new file mode 100644 index 0000000..88a6b3a Binary files /dev/null and b/doc/images/geometrymode.png differ diff --git a/doc/images/heightmap-color.png b/doc/images/heightmap-color.png new file mode 100644 index 0000000..b20a41f Binary files /dev/null and b/doc/images/heightmap-color.png differ diff --git a/doc/images/heightmap-grey.png b/doc/images/heightmap-grey.png new file mode 100644 index 0000000..f1ed2b8 Binary files /dev/null and b/doc/images/heightmap-grey.png differ diff --git a/doc/images/heightmap-scale-interval.png b/doc/images/heightmap-scale-interval.png new file mode 100644 index 0000000..8ccfd8f Binary files /dev/null and b/doc/images/heightmap-scale-interval.png differ diff --git a/doc/images/heightmap-scale.png b/doc/images/heightmap-scale.png new file mode 100644 index 0000000..1e10cb8 Binary files /dev/null and b/doc/images/heightmap-scale.png differ diff --git a/doc/images/heightmap-yscale.png b/doc/images/heightmap-yscale.png new file mode 100644 index 0000000..aace48b Binary files /dev/null and b/doc/images/heightmap-yscale.png differ diff --git a/doc/images/noshading.png b/doc/images/noshading.png new file mode 100644 index 0000000..a6ced5e Binary files /dev/null and b/doc/images/noshading.png differ diff --git a/doc/images/players.png b/doc/images/players.png new file mode 100644 index 0000000..340a89b Binary files /dev/null and b/doc/images/players.png differ diff --git a/doc/images/scalefactor-2.png b/doc/images/scalefactor-2.png new file mode 100644 index 0000000..9760728 Binary files /dev/null and b/doc/images/scalefactor-2.png differ diff --git a/doc/images/scalefactor-4.png b/doc/images/scalefactor-4.png new file mode 100644 index 0000000..e47b2ba Binary files /dev/null and b/doc/images/scalefactor-4.png differ diff --git a/doc/images/sidescale-interval.png b/doc/images/sidescale-interval.png new file mode 100644 index 0000000..053753f Binary files /dev/null and b/doc/images/sidescale-interval.png differ diff --git a/doc/images/tiles-16-centered.png b/doc/images/tiles-16-centered.png new file mode 100644 index 0000000..e7a7ab3 Binary files /dev/null and b/doc/images/tiles-16-centered.png differ diff --git a/doc/images/tiles-16.png b/doc/images/tiles-16.png new file mode 100644 index 0000000..d455553 Binary files /dev/null and b/doc/images/tiles-16.png differ diff --git a/doc/images/tiles-20-centered.png b/doc/images/tiles-20-centered.png new file mode 100644 index 0000000..5633a8a Binary files /dev/null and b/doc/images/tiles-20-centered.png differ diff --git a/doc/manual.rst b/doc/manual.rst new file mode 100644 index 0000000..ec9dee6 --- /dev/null +++ b/doc/manual.rst @@ -0,0 +1,1519 @@ +Minetest Mapper +############### + +A tool to generate maps of minetest and freeminer worlds. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. Contents:: :depth: 2 + +Invocation +========== + +Basic Usage +----------- + +After installation, minetestmapper is started as follows: + +('\\' is a continuation character - the command-line continues +on the next line. Type return only after the line that does +not end with the continuation character) + +:: + + minetestmapper \ + --input \ + --output + +If the world is not too large, and if minetestmapper is installed in +a system directory, it will most likely work as expected. + +Possibly, minetestmapper will not be able to find a colors.txt file. If that happens, +the colors.txt file can be specified on the command-line: + +:: + + minetestmapper \ + --input \ + --output \ + --colors + +Or the colors.txt file must be installed in a location where minetestmapper will find it. +A colors.txt file (named ``colors.txt``, in lowercase) in the world's directory will certainly +be found. Depending on the system and the configuration, other locations are available. Use the +following command to find out which: + +:: + + minetestmapper \ + --input \ + --output \ + --verbose-search-colors=2 + +From the basis above, add any number of other options that are documented below, according +to to personal needs and taste. + +Command-line Options Summary +---------------------------- + + For a more detailed description of the options, see `Detailed Description of Options`_ + below. + +Basic options: +.............. + + * ``--help`` : Print an option summary + * ``--version`` : Print version ID of minetestmapper + * ``--input `` : Specify the world directory (mandatory) + * ``--output `` : Specify the map file name (mandatory) + * ``--colors `` : Specify the colors file name. + * ``--heightmap[=color]>`` : Generate a height map instead of a regular map + * ``--heightmap-nodes `` : Specify the nodes list for the height map + * ``--heightmap-colors `` : Specify the color definition file for the height map + * ``--geometry `` : Specify the desired map dimensions + * ``--scalefactor `` : Specify the scaling factor for the map + * ``--progress`` : Print progress information while generating the map + * ``--verbose[=2]`` : Report statistics about the world and the generated map + + +Area options: +............. + + * ``--scalefactor `` : Specify the scaling factor for the map + * ``--geometry `` : Specify the desired map dimensions + * ``--cornergeometry `` : Suggest interpretation as a corner + dimensions + * ``--centergeometry `` : Suggest interpretation as center + dimensions + * ``--min-y `` : Specify the minumum depth of nodes to be included + * ``--max-y `` : Specify the maximum height of nodes to be included + * ``--geometrymode pixel,block,fixed,shrink`` : Specify granularity and whether to shrink the map if possible + +Height map-related options: +........................... + + * ``--heightmap[=color]>`` : Generate a height map instead of a regular map + * ``--heightmap-nodes `` : Specify the nodes list for the height map + * ``--heightmap-colors `` : Specify the color definition file for the height map + * ``--heightmap-yscale `` : Scale the vertical dimensions by a factor + * ``--height-level-0 `` : Set the '0' level differently for determining height map colors + * ``--drawheightscale`` : Draw a height scale at the bottom of the map + * ``--heightscale-interval [[,:]]`` : Use custom major and minor intervals in the height scale. + +Colors for specific areas or parts of the map: +.............................................. + + * ``--bgcolor `` : Specify the background color for the image + * ``--blockcolor `` : Specify the color for empty mapblocks + * ``--scalecolor `` : Specify the color for text in the scales on the side + * ``--origincolor `` : Specify the color for drawing the map origin (0,0) + * ``--playercolor `` : Specify the color for drawing player locations + * ``--tilebordercolor `` : Specify the color for drawing tile borders + +Map features: +............. + + * ``--drawscale[=top,left]`` : Draw a scale on the left and/or top edge + * ``--drawheightscale`` : Draw a height scale at the bottom of the map + * ``--sidescale-interval [[,:]]`` : Use custom major and minor intervals in the scale. + * ``--heightscale-interval [[,:]]`` : Use custom major and minor intervals in the height scale. + * ``--draworigin`` : Draw a circle at the origin (0,0) on the map + * ``--drawplayers`` : Draw circles at player positions on the map + * ``--drawalpha[=cumulative|cumulative-darken|average|none]`` : Enable drawing transparency for some nodes (e.g. water) + * ``--drawair`` : Draw air nodes (read the warnings first!) + * ``--noshading`` : Disable shading that accentuates height diffences + +Tiles: +...... + + * ``--tiles [+]|block|chunk`` : Draw a grid of the specified size on the map + * ``--tileorigin ,|world|map`` : Specify the coordinates of one tile's origin (lower-left corner) + * ``--tilecenter ,|world|map`` : Specify the coordinates of one tile's center + * ``--tilebordercolor `` : Specify the color for drawing tile borders + * ``--chunksize `` : Specify or override the chunk size (usually 5 blocks) + +Drawing figures on the map +.......................... + + Using world coordinates: + + * ``--drawpoint ", color"`` : Draw a point (single pixel) on the map + * ``--drawline " color"`` : Draw a line on the map + * ``--drawcircle " color"`` : Draw a circle on the map + * ``--drawellipse " color"`` : Draw an ellipse on the map + * ``--drawrectangle " color"`` : Draw a rectangle on the map + * ``--drawtext ", color text"`` : Write some text on the map + + Same figures using map/image coordinates (0,0 is the top-left corner of the map) + + * ``--drawmappoint ", color"`` : Draw a point (single pixel) on the map + * ``--drawmapline " color"`` : Draw a line on the map + * ``--drawmapcircle " color"`` : Draw a circle on the map + * ``--drawmapellipse " color"`` : Draw an ellipse on the map + * ``--drawmaprectangle " color"`` : Draw a rectangle on the map + * ``--drawmaptext ", color text"`` : Write some text on the map + +Feedback / information options: +............................... + + * ``--help`` : Print an option summary + * ``--version`` : Print version ID of minetestmapper + * ``--verbose[=n]`` : Report world and map statistics (size, dimensions, number of blocks) + * ``--verbose-search-colors[=n]`` : Report which colors files are used and/or which locations are searched + * ``--progress`` : Show a progress indicator while generating the map + +Miscellaneous options +..................... + + * ``--backend `` : Specify or override the database backend to use + * ``--sqlite-cacheworldrow`` : Modify how minetestmapper accesses the sqlite3 database. For performance. + + +Detailed Description of Options +------------------------------- + + A number of options have shorthand equivalent options. For instance + ``--help`` and ``-h`` are synonyms. The following are notable: + + * ``-h`` = ``--help`` + * ``-V`` = ``--version`` + * ``-o`` = ``--output`` + * ``-i`` = ``--input`` + + For the others, please consult the source code. Note that support + for other short options than mentioned above might be removed in + the future. + + **Available options**: + +.. Contents:: :local: + + +``--backend `` +.......................................... + Set or override the database backend to use. + + By default (``auto``), the database is obtained from the world configuration, + and there is no need to set it, + +``--bgcolor `` +..................... + Specify the background color for the image. See `Color Syntax`_ below. + + Two maps with different background: + + .. image:: images/background-white.png + .. image:: images/background-blueish.png + +``--blockcolor `` +........................ + Specify the color for empty mapblocks. See `Color Syntax`_ below. + + An empty mapblock exists in the database, and contains only air or *ignore* + nodes. It is normally not visible, even if no other mapblocks exist above + or below it. This color makes such blocks visible if no nodes other than + air or ignore are above or below it. + + To see the difference between empty blocks and absent blocks, generate a map + that is larger than the world size by at least 2 map blocks. + + Two maps, the second with blockcolor enabled: + + .. image:: images/background-white.png + .. image:: images/blockcolor-yellowish.png + + +``--centergeometry `` +............................... + Suggest interpreting a geometry as center coordinates and dimensions. If possible. + + See also `--geometry`_ + +``--chunksize `` +...................... + Set or override the chunk size. + + The chunk size is the unit of map generation minetest. Minetest never generates + a single block at a time, it always generates a chunk at a time. + + The chunk size may be used by the `--tiles`_ option. It is obtained from + the world by default. It is usually but not necessarily 5 (i.e. 5x5x5 blocks). + +``--colors `` +................... + Specify the name of the 'colors.txt' to use. + + See `Colors and Nodes Files`_ and `Colors.txt Syntax`_. + + Minetestmapper will attempt to automatically find a suitable + colors.txt file. See `Colors Files Search Locations`_. + +``--cornergeometry `` +............................... + Suggest interpreting a geometry as corner coordinates and dimensions. If + possible. + + See also `--geometry`_ + + +``--draw[map]
" color"`` +.......................................... + Draw a figure on the map, with the given geometry and color. + + Possible figures are: + + * circle + * ellipse (which is synonymous for circle) + * line + * point (which uses simple coordinates (x,y) instead of a geometry) + * rectangle + * text (which uses simple coordinates (x,y) instead of a geometry) + + If ``--draw
`` is used, the geometry specifies world coordinates; + If ``--drawmap
`` is used, the geometry specifies map (image) + coordinates, where 0,0 is the top-left corner of the map-part of + the image, and coordinates increase to the right and down. Any points + on the left and top scale have negative coordinates. + + Note that the combination of geometry and color should be a single + argument. This means that the pair must be enclosed in quotes together + on the command-line, else they will be misinterpreted as two command-line + arguments. + + Example: + + ``minetestmapper --drawcircle "10,10:6x6 red"`` + + For the color of figures, an alpha value can be specified. Note that + due to a bug in the drawing library, this has not the expected effect + when drawing circles and ellipses. + + See also `Geometry Syntax`_ and `Color Syntax`_. + + **Interaction of figure geometry and map scaling** + + If the map is scaled, figures could either keep the same size in pixels, + or the same size relative to the world, which would make them appear + smaller, like the entire map. + + Figures which are drawn using map (image) coordinates are never scaled. + It is assumed that it was the intention to draw them on the image to + begin with, and not in the world. + + At the moment, figures which are drawn using world coordinates may or + may not scale with the world. + + If the geometry of a figure is specified using 2 corners, then these + coordinates obviously scale with the world, and the resulting figure + will be visually smaller as well. + + If the geometry of a figure is specified using a corner or the center + and dimensions, then the corner or center is obviously also interpreted + as world-coordinates, but the dimensions will be interpreted relative + to the image. + + In practise this means that two identically-sized figures in a full-scale + map, may have different sizes after scaling, depending on how their + geometry was specified. The jury is still out as to whether this is + a bug or a feature. + +``--draw[map]circle " color"`` +........................................ + Draw a circle on the map, with the given geometry and color. + + See `--draw[map]
`_ for details. + + An example circle: + + .. image:: images/drawcircle.png + +``--draw[map]ellipse " color"`` +......................................... + Draw an ellipse on the map. This is a synonym for ``--draw[map]circle``. + + See `--draw[map]
`_ for details. + +``--draw[map]line " color"`` +...................................... + Draw a line on the map, with the given geometry and color. + + See `--draw[map]
`_ for details. + + An example line: + + .. image:: images/drawline.png + +``--draw[map]point ", color"`` +.................................... + Draw a point on the map, at the given location, using the given color. + + See `--draw[map]
`_ for details. + + An example point (red, in te white area): + + .. image:: images/drawpoint.png + +``--draw[map]rectangle " color"`` +........................................... + Draw a reactangle on the map, with the given geometry and color. + + See `--draw[map]
`_ for details. + + An example rectangle: + + .. image:: images/drawrectangle.png + + +``--draw[map]text ", color text"`` +........................................ + Write text on the map, at the specified location, using the given color. + + The text can consist of + + Note that the combination of geometry, color and text should be a + single argument. This means that they must be enclosed in quotes + together on the command-line, else they will be misinterpreted as three + command-line arguments. + + Example: + + ``minetestmapper --drawtext "20,-10 red This text will be on the map"`` + + See also `--draw[map]
`_ for more details. + + Example text: + + .. image:: images/drawtext.png + +``--drawair`` +............. + Draw air nodes, as if they were regular nodes. + + The color of air will be obtained from the colors file. + + WARNING 1: + the color of air nodes should most probably have an alpha value of + 0, so that it is fully transparent. The effect will be, that + air nodes are only visible if nothing else is below them. + + Setting alpha to anything other than 0, will most probably cause + all non-air nodes to be obscured by all of the air that is + above them. + + WARNING 2: + Drawing air nodes instead of ignoring them will have a significant + performance impact (unless they happen to be defined as opaque). + Use this with consideration. + + Two images, one with air, the other without. Look inside the rectangle: + + .. image:: images/background-white.png + .. image:: images/drawair.png + +``--drawalpha[=cumulative|cumulative-darken|average|none]`` +........................................................... + Specify how to render the alpha (transparency) value of nodes. + + * **none**: don't render transparency. This is the same as + omitting this option. + * **average**: average the entire stack of transparent nodes + before combining the resulting color with the color of the + first opaque node below the stack. Water will remain transparent + indefinitely. + * **cumulative**: make lower nodes progressively more opaque. + The effect is for instance, that water becomes opaque below + a certain depth - only height differences will 'shine' through, + if shading is not disabled (`--noshading`_) + * **cumulative-darken**: Same as *cumulative*, except that + after the color has become opaque, it is progressively + darkened to visually simulate greater depth. This is looks great + for deeper waters that are not too deep. + The downside is that very deep water will eventually become black + when using this option. + + If this option is used without a method argument, the + default is 'average'. + + For backward compatibility, 'nodarken' is still recognised as alias + for 'cumulative'; 'darken' is still recognised as alias for + 'cumulative-darken'. They are otherwise undocumented. Please don't + use them, they may disappear in the future. + + Note that each of the different modes has a different color definition + for transparent blocks that looks best. For instance, for water, the following + are suggested: + + (disabled): 39 66 106 [192 224 - optional: alpha configuration will be ignored] + + cumulative: 78 132 255 64 224 + + cumulative-darken: 78 132 255 64 224 (same as cumulative) + + average: 49 82 132 192 224 (look also good with alpha disabled) + + Custom colors files are provided for these alternatives: colors-average-alpha.txt + and colors-cumulative-alpha.txt. If desired, these must be manually selected. + + The following images show average alpha mode, cumulative mode and cumulative-darken + mode. In each case, the matching custom color file was selected: + + .. image:: images/alpha-average.png + .. image:: images/alpha-cumulative.png + .. image:: images/alpha-cumulative-darken.png + + +``--drawheightscale`` +..................... + If drawing a height map (`--heightmap`_), draw a height scale below the image. + + A height map with scale: + + .. image:: images/heightmap-scale.png + +``--draworigin`` +................ + Draw a circle at the world origin (coordinates 0,0) + + The color can be set with `--origincolor`_. + + An image with world origin drawn: + + .. image:: images/draworigin.png + +``--drawplayers`` +................. + Draw circles at the positions of players + + The color can be set with `--origincolor`_. + + An image with a few players: + + .. image:: images/players.png + +``--drawscale[=left,top]`` +.......................... + Draw scales at the left and.or top of the map. + + If neither 'left' nor 'top' is specified, draw them on both sides. + + The color of the lines and numbers can be set with `--scalecolor`_. + + The major and minor interval can be configured using + `--sidescale-interval`_. + + Images of scales on the top, left and on both sides + + .. image:: images/drawscale-left.png + .. image:: images/drawscale-top.png + .. image:: images/drawscale-both.png + +``--geometry `` +......................... + Specify the map geometry (i.e. which part of the world to draw). + + See `Geometry Syntax`_ for how the geometry can be specified. + + By default, the entire visible world is drawn. + +``--geometrymode pixel,block,fixed,shrink`` +........................................... + Specify explicitly how the geometry should be interpreted. + + One or more of the flags may be used, separated by commas or + spaces. In case of conflicts, the last flag takes precedence. + + See also `Geometry Syntax`_ + + The geometry can have pixel or block granularity: + + * **pixel**: interpret the coordinates with pixel granularity. + + A map of exactly the requested size is generated (after + adjustments due to the 'shrink' flag, or possible adjustments + required by the scale factor). + + * **block**: round the coodinates to a multiple of 16. + + The requested geometry will be extended so that the map does + not contain partial map blocks (of 16x16 nodes each). + At *least* all pixels covered by the geometry will be in the + map, but there may be up to 15 more in every direction. + + The geometry can be fixed as requested, or the map can be shrunk: + + * **shrink**: Generate a map of at most the requested geometry. + Shrink it to the smallest possible size that still includes the + same information. + + Currently, shrinking is done with block granularity, and + based on which blocks are in the database. As the database + always contains a row or and column of empty, or partially + empty blocks at the map edges, there will still be empty + pixels at the edges of the map. Use `--blockcolor`_ to visualize + these empty blocks. + + * **fixed**: don't reduce the map size. What ever is specified + using a geometry option, is what will be draw, even if partly + or fully empty. + + **NOTE**: If this flag is used, and no actual geometry is + specified, this would result in a maximum-size map (65536 + x 65536), which is currently not possible, and will fail, + due to a bug in the drawing library. + + The default is normally 'pixel' and 'fixed', if a geometry + option was specified. See `Legacy Geometry Format`_ for one + exception. + + Default image in the center, block mode enabled to the left and + shrink mode enabled to the right: + + .. image:: images/geometrymode-block.png + .. image:: images/geometrymode.png + .. image:: images/geometrymode-shrink.png + +``--heightmap-colors[=]`` +............................... + Use the specified file as the heightmap colors file. + + See `Colors and Nodes Files`_ and `Heightmap-colors.txt Syntax`_. + + Minetestmapper will attempt to automatically find a suitable + heightmap-colors.txt file. See `Colors Files Search Locations`_. + +``--heightmap-nodes `` +............................ + Use the specified file as the heightmap nodes file. + + See `Colors and Nodes Files`_ and `Heightmap-nodes.txt Syntax`_. + + Minetestmapper will attempt to automatically find a suitable + heightmap-nodes.txt file. See `Colors Files Search Locations`_. + +``--heightmap-yscale `` +............................... + Scale the heights of the map before computing the height map colors. + + This is useful when there are very large, or only very small, height + differences in the world, and too much of the map is drawn in a + single, or similar, colors. + + Using this option improves the spread of colors in the height map. + The option `--height-level-0`_ may also be of use. + + 'Factor' is a decimal number. A value of 1 means no change; a larger + value stretches the color range, a smaller value (but larger than 0) + condenses the color range. + + Note that the water level will probably not be rendered correctly for + scale factors smaller than 1, nor for small non-integer scale factors. + A suitable choice of ``--height-level-0`` may lessen this effect somewhat. + + For the same effect, a modified colors file could be used. + ``--heightmap-yscale`` is easier and quicker. + + Two images with a different y scale: + + .. image:: images/heightmap-scale.png + .. image:: images/heightmap-yscale.png + +``--heightmap[=]`` +......................... + Generate a height map instead of a regular map. + + If a color is given, a monochrome map is generated in shades of that + color, ranging from black at depth -128 to the given color at height 127. + + See also `Color Syntax`_. + + Three colors are treated specially: + + * **white**: The entire map will be white. Any visible structure will + result of the rendering of height differences. + * **black**: The entire map will be black. Any visible structure will + result of the rendering of height differences. This actually looks + pretty good + * **grey**: The map will be drawn in shades of grey, ranging from black + at level -128 to white at level 127 + + If no color is specified, minetestmapper will use a colors file to + determine which colors to use at which height level. See + `Colors and Nodes Files`_ and `Heightmap-colors.txt Syntax`_. + + In any case, minetestmapper also needs a nodes file. See + `Heightmap-nodes.txt Syntax`_ for details. + + A regular map, a greyscale height map and a colored height map: + + .. image:: images/scalefactor-2.png + .. image:: images/heightmap-grey.png + .. image:: images/heightmap-color.png + +``--heightscale-interval [[,:]]`` +............................................... + When drawing a height scale at the bottom of the map, use the specified + subdivisions. + + 'major' specifies the interval for major marks, which are accompanied + by a number indicating the height. + + When specified as 'major,minor', 'minor' specifies the interval for + minor tick marks + + When specified as 'major:minor', 'minor' specifies the number of subdivisions + of the major interval. In that case, major should be divisible by minor. + E.g.: ``10:2`` is OK (equivalent to 10,5), ``10:3`` is not. + + By default, the major interval is calculated based on the available space + and the range of heights in the map. + The default minor interval is 0 (i.e. no minor ticks) + + A custom height scale interval: + + .. image:: images/heightmap-scale.png + .. image:: images/heightmap-scale-interval.png + +``--height-level-0 `` +............................ + Specify the zero height level of the map to use for height maps. + + This is the world height that will be drawn using the color that the + colors file specifies for level 0. + This is useful when the average level of the world is lower + or higher than the colors file caters for. It may also be of some use + for height maps when the world has a non-standard sea level. + + The option `--heightmap-yscale`_ may also be of use if this option + is used. + + For the same effect, a modified colors file could be used. + ``--height-level-0`` is easier and quicker. + +``--help`` +.......... + Print the option summary. + +``--input `` +........................ + Specify the world to map. + + This option is mandatory. + +``--max-y `` +............... + Specify the upper height limit for the map + + Nodes higher than this level will not be drawn. This can be used + to avoid floating islands or floating artefacts from abscuring the + world below. + +``--min-y `` +............... + Specify the lower height limit for the map + + Any nodes below this level will not be drawn. + +``--noshading`` +............... + Disable shading. + + Shading accentuates height differences by drawing artifical shade + (i.e. making nodes lighter or darker depending on the height difference + with adjacent nodes). + + A map with and without shading: + + .. image:: images/default-0.0.png + .. image:: images/noshading.png + +``--origincolor `` +......................... + Specify the color to use for drawing the origin. + + An alpha value can be specified, but due to a bug in the + drawing library, it will not have the desired effect. + + Use `--draworigin`_ to enable drawing the origin. + + See also `Color Syntax`_ + +``--output `` +............................... + Specify the name of the image to be generated. + + This parameter is mandatory. + + Note that minetestmapper generates images in png format, regardless of + the extension of this file. + +``--playercolor `` +......................... + Specify the color to use for drawing player locations + + An alpha value can be specified, but due to a bug in the + drawing library, it will not have the desired effect. + + Use `--drawplayers`_ to enable drawing players. + + See also `Color Syntax`_ + +``--progress`` +.............. + Show a progress indicator while generating the map. + +``--scalecolor `` +........................ + Specify the color to use for drawing the text and lines of the scales + (both the side scales and the height map scale). + + Use `--drawscale`_ to enable drawing side scales. + + Use `--drawheightscale`_ to enable drawing the height scale. + + See also `Color Syntax`_ + +``--scalefactor 1:`` +....................... + Generate the map in a reduced size. + + Basically, the image is be reduced in size while it is generated, + by averaging a square region of pixels into one new pixel. + + This has several uses: + + * to generate overview maps of large worlds + * if the image is otherwise too large to be practical + * if the map image would be too large to be generated + (see `Known Problems`_). + + An other advantage of generating scaled maps directly, is that + minetestmapper does not scale all parts of the map, like for instance + the scales on the side. + + The following scale factors are supported: + + * **1:1**: no scaling. This value has no effect. + * **1:2**: reduce the map size by a factor 2 + * **1:4**: reduce the map size by a factor 4 + * **1:8**: reduce the map size by a factor 8 + * **1:16**: reduce the map size by a factor 16 + + In addition, scaling needs to follow map block boundaries. That + means that when scaling the map, regardless of the geometry, + the same pixels will be averaged. E.g. if the scale factor is 1:16, + then entire map blocks will be averaged, so therefore the map + geometry can only include full map-blocks. + + If the requested geometry of the map is not suited to the + requested scale factor, the map will be enlarged by as many nodes as + needed. The number of added nodes depends on the scale factor. E.g. + if the scale factor is 1:8, then at most 7 nodes may be added to on + each of the four sides of the map. + + Original map, and the same map, scaled to 1:2 and 1:4. The geometry is + increased to keep the images the same size: + + .. image:: images/default-0.0.png + .. image:: images/scalefactor-2.png + .. image:: images/scalefactor-4.png + +``--sidescale-interval [[,:]]`` +............................................. + When drawing a side scale at the top or left of the map, use the specified + subdivisions. + + 'major' specifies the interval for major marks, which are accompanied + by a number indicating the coordinate. + + When specified as 'major,minor', 'minor' specifies the interval for + minor tick marks + + When specified as 'major:minor', 'minor' specifies the number of subdivisions + of the major interval. In that case, major should be divisible by minor. + E.g.: ``100:20`` is OK (equivalent to 100,5), ``100:33`` is not. + + By default, the major interval is 64 for a 1:1 map, 128 for a 1:2 map etc. + The default minor interval is 0 (i.e. no minor ticks) + + Default side scale, and custom version: + + .. image:: images/drawscale-both.png + .. image:: images/sidescale-interval.png + +``--sqlite-cacheworldrow`` +.......................... + Modify the way minetestmapper accesses the sqlite3 database. + + When using sqlite3, read an entire world row at one, instead of reading + one block at a time. + + This option was added to possibly achieve better performance + in some cases where a complete map is drawn of a very large world. + + It may or may not have the desired effect. Any feedback is welcome. + +``--tilebordercolor `` +............................. + Specify the color to use for drawing tile borders. + + Use `--tiles`_ to enable drawing tiles. + + See also `Color Syntax`_ + +``--tilecenter ,|world|map`` +.................................. + Arrange the tiles so that one tile has, or would have, its center + at map coordinates x,y. + + If the value 'world' is used, arrange for one tile to have its center + at the center of the world instead. This is the default. + + If the value 'map' is used, arrange for one tile to have its center + at the center of the map instead. + + (see also `--tileorigin`_) + +``--tileorigin ,|world|map`` +.................................. + Arrange the tiles so that one tile has, or would have, its bottom-left + (i.e. south-west) corner at map coordinates x,y. + + If the value 'world' is used, arrange for one tile to have its lower-left + corner the origin of the world (0,0) instead. + + If the value 'map' is used, arrange for one tile to have its upper-left + corner at map coordinate 0,0 (which is the upper-left pixel of the + map-part of the image) + + (see also `--tilecenter`_) + +``--tiles [+]|block|chunk`` +............................................. + Divide the map in square tiles of the requested size. A border of the + requested width (or width 1, of not specfied) is drawn between the tiles. + In order to preserve all map pixels (and to prevent overwriting them with + borders), extra pixel rows and columns for the borders are inserted into + the map. + + The special values 'block' and 'chunk' draw tiles that correspond to map + blocks (16x16 nodes) or to chunks (the unit of map generation: 5x5 blocks + for a world with default settings). + + In order to allow partial world maps to be combined into larger maps, edge + borders of the map are always drawn on the same side (left or top). Other + edges are always border-less. + + NOTE: As a consequence of preserving all map pixels: + + * tiled maps (in particular slanted straight lines) may look slightly + skewed, due to the inserted borders. + + * scale markers never align with tile borders, as the borders are + logically *between* pixels, so they have no actual coordinates. + + * On scaled maps, only tile sizes and tile offsets that are a multiple + of the inverse scale (e.g. '8' for scale 1:8) are supported. + + See the options `--tileorigin`_ and `--tilecenter`_ for specifying the + positioning of tiles. By default, tiles are arranged so that one tile + has, or would have, its center at the world origin (0,0). + + Tiled map. On the left, 16x16 tiles with corner at the world origin. In + the middle, 16x16 tiles with center at the world origin. To the right, + 20x20 tiles with center at the world origin: + + .. image:: images/tiles-16.png + .. image:: images/tiles-16-centered.png + .. image:: images/tiles-20-centered.png + + +``--verbose-search-colors[=n]`` +............................... + report the location of the colors file(s) that are being used. + + With ``--verbose-search-colors=2``, report all search locations + that are being considered as well. + +``--verbose[=n]`` +................. + report some useful / interesting information: + + * maximum coordinates of the world + * world coordinates included the map being generated + * number of blocks: in the world, and in the map area. + + Using `--verbose=2`, report some more statistics, including: + + * database access statistics. + +``--version`` +............. + Report the version of this instance of minetestmapper. + + This is great information to include in a bug report. + + +Color Syntax +============ + + For a number of command-line parameters, a color argument it needed. Such + colors are specified as follows: + +Color Codes +----------- + + Colors can be specified using color codes: + + ``#[]`` + + E.g.: ``#ff34c1`` + + The alpha component is optional in some cases, and not allowed in others. It + defaults to opaque (ff). + + The color components can also be specified using a single digit per color, + which are duplicated to obtain the full value. E.g. + + ``#4c2 --> #44cc22`` + +Symbolic Colors +--------------- + + In addition to the color codes, a few named colors are also available: + + :white: ``#ffffff`` + :black: ``#000000`` + :gray: ``#7f7f7f`` - (same as grey) + :grey: ``#7f7f7f`` - (same as gray) + :red: ``#ff0000`` + :green: ``#00ff00`` + :blue: ``#0000ff`` + :yellow: ``#ffff00`` + :magenta: ``#ff00ff`` - (same as fuchsia) + :fuchsia: ``#ff00ff`` - (same as magenta) + :cyan: ``#00ffff`` - (sama as aqua) + :aqua: ``#00ffff`` - (sama as cyan) + :orange: ``#ff7f00`` + :chartreuse: ``#7fff00`` + :pink: ``#ff007f`` + :violet: ``#7f00ff`` + :springgreen: ``#00ff7f`` + :azure: ``#007fff`` + :brown: ``#7f3f00`` + +Lighter or Darker Colors +------------------------ + + As an additional feature, any color can lightened or darkened, or in general, + be mixed with a basic color using the following syntax: + + ``[+-][wkrgbcmy]`` + + Where '+' mixes in, and '-' mixes out. one of the colors white (w), black (k), red (r), green (g), blue (b), + cyan (c), magenta (m), yellow (y). The value specifies the amount, ranging from 0 (mix in/out no color) to + 1 (mix in/out as much of the color as possible). E.g.: + + red+w0.25: add 25% white: light red (#ff3f3f) + + red+k0.50: add 50% black: dark red (#7f0000) + + red-w0.50: remove 50% white: dark red as well (#7f0000) + + white-b1: remove 100% blue: yellow (#ffff00) + +Geometry Syntax +=============== + + For a number of options, like the 'geometry' options, but also + the drawing options for instance, a geometry parameter must + be specified. It can specify the dimensions in a few different + ways: + + * As the corners of the area + * As the lower-left corner, and the area's dimensions + * As the center of the are, and the area's dimensions + * Legacy format (compatible with stock minetestmapper) + + **Granularity** + + By default, the specified geometry has node granularity, in contrast + with block (16x16) granularity. + + Using block granularity, all coordinates are rounded to the + next multiple of 16. Node granularity keeps the sub-block + coordinates as they are. + + Use `--geometrymode`_ if non-default behavior is desired. + + **Map Shrinking** + + By default, a map of exactly the requested size is generated + (after any granularity adjustment, or adjustments that are + required by scaling). + + Alternatively, the map size can be automatically reduced to + remove empty blocks at its edges. This is the behavior of + the stock minetestmapper. + + Use `--geometrymode`_ if non-default behavior is desired. + + **Coordinate Direction** + + The world coordinates 0,0 are the very center of the world. Coordinates + decrease towards the lower-left (south-west) corner of the map, + and they increase towards the upper-right (north-east) corner of the map. + + Note that this differs from the image coordinates, which are 0,0 + in the top-left corner of the map-part of the image, and increase towards + the bottom-right. Coordinates in the left and top scale areas of + the image are negative. + +Geometry Using Two Corners +-------------------------- + + A geometry using two corners of the area is specified as follows: + + ``,:,`` + + where ``xcorner1,ycorner1`` are the coordinates of + one corner, and ``xcorner2,ycorner2`` are the coordinates + of the opposite corner of the area. + + The coordinates are interpreted as inclusive: both + the first and the second coordinate will be in the map. + + Example: + + ``--geometry -200,-100:200,200`` + +Geometry Using Corner and Dimensions +------------------------------------ + + A geometry using a corner of the area and its dimensions is + specified as follows: + + ``,+width+height`` + + where ``xoffset,yoffset`` are the coordinates of the + lower-left corner of the area, and ``width`` and ``height`` + are the dimensions of the map. + + Note that ``width`` and/or ``height`` can be negative, making + ``xoffset,yoffset`` another corner of the image. For ease + of using in scripting, the sign of a dimension does not need + to replace the '+'. E.g. the following are valid and equivalent: + + ``--geometry -10,-10+11+11`` + + ``--geometry -10,10+11-11`` + + ``--geometry -10,10+11+-11`` + + ``--geometry 10,10-11+-11`` + + ``--geometry -10,-10:10,10`` + + The following alternate syntax is also supported: + + ``x[<+|-xoffset><+|-yoffset>]`` + + where ``xoffset,yoffset`` are the coordinates of the lower-left + corner of the area. In this case, the offsets can be omitted, + resulting in a map of the requested dimensions, centered at 0,0. + + Examples: + + ``--geometry 1000x1200`` + ``--geometry 1000x1200-500+500`` + + **Compatibility** + + For backward compatibility, if the ``--centergeometry`` + option is used with a corner-style geometry, then that geometry is + interpreted as a center geometry instead. + +Geometry Using Center and Dimensions +------------------------------------ + + A geometry using the center of the area and its dimensions + is specified as follows + + ``,:widthxheight`` + + where ``xcenter,ycenter`` are the coordinates of the center + of the area, and ``width`` and ``height`` are its dimensions. + + Example: + + ``--geometry 100,100:300x150`` + + **Compatibility** + + For backward compatibility, if the ``--cornergeometry`` + option is used with a center-style geometry, then that geometry is + interpreted as a corner geometry instead. + +Legacy Geometry Format +----------------------- + + The legacy format, compatible with stock minetestmapper is + also still supported: + + ``:++`` + + where ``xoffset,yoffset`` are the coordinates of the lower-left + corner of the area, and ``width`` and ``height`` specify its + dimensions. + + **Compatibility mode** + + This format has a compatibility mode with stick minetestmapper. + + If the very first geometry option on the command-line is ``--geometry``, + *and* uses this syntax, then block granularity and map shrinking + are enabled, just like stock minetest would. If this is not desired, + then use a different geometry format, or use the option + ``--geometrymode`` to change the behavior. + + Block granularity is also enabled when the obsolete (and otherwise + undocumented) option ``--forcegeometry`` is found first on the command-line. + +Advanced coordinate specification +--------------------------------- + + Coordinates are normally specified as node coordinates. E.g.: + + ``--geometry -100,-100:100,100`` + + Minetestmapper also supports another way to specify coordinate values: + specifying the minetest block number, and a node. Blocks are 16x16 nodes. + There are two variants: + + The first variant specifies the block number, and a node within that block. + The node must be a value between 0 and 15: + + ``#`` + + E.g.: + + + ``0#2``: node 2 in block 0, i.e. coordinate 2 + + ``1#2``: node 2 in block 1, i.e. coordinate 16+2 = 18 + + ``-10#6``: node 6 in block -10, i.e. coordinate -160+2 = -158 + + ``-3#11``: node 11 in block -3, i.e. coordinate -48+11 = -37 + + The second variant specifies a block and a node offset in the + same direction. I.e. for negative block numbers, the offset is + in the negative direction as well. + + ``.`` + + E.g.: + + ``0.5``: the 5th node from block 0, i.e. coordinate 5 + + ``4.11``: the 11th node from block 4, i.e. coordinate 64+11 = 75 + + ``-0.1``: the 1st node in negative direction from block 0, i.e. coordinate -1 + + ``1.9``: the 9th node in positive direction from block 1, i.e. coordinate 16+9 = 25 + + ``-1.9``: the 9th node in negative direction from block -1, i.e. coordinate -16-9 = -25 + + ``-5.0``: the 0th node in negative direction from block -5, i.e. coordinate -80-0 = -80 + +Colors and Nodes Files +====================== + + In order to know how to render a map, minetestmapper needs a colors and/or + a nodes file. This section documents their format. + + * If a regular map is generated, a 'colors.txt' file is required. + * If a height map is generated, a 'heightmap-nodes.txt' file is required, and + optionally, a 'heightmap-colors.txt' file. + + All three types of files have some commonalities with respect to where minetest + looks form them by default, and with respect to comments and file inclusion. These are + documented in separate paragraphs below (`Colors Files Common Syntax`_, + `Colors Files Search Locations`_) + +Colors.txt Syntax +----------------- + + The colors.txt file contains a list of minetest node names and associated + colors. A minetest world node is converted to at most one pixel on the map. + + Lines in the colors.txt file have toe following syntax: + + `` [ []]`` + + Examples: + + ``default:apple 50 0 0`` + + ``default:sandstonebrick 160 144 108`` + + ``default:copperblock 110 86 60`` + + ``default:water_flowing 49 82 132 192 224`` + + **Duplicate Entries** + + If the colors file contains duplicate entries for the same node, in general + the later entry overrides the former. + + There is one exception to this rule: if one color is opaque (no alpha, or + alpha = 255), and one is transparent (alpha < 255), the former will be selected when + `--drawalpha`_ is diabled, and the latter will be selected when ``drawalpha`` + is enabled: + + ``# Entry that will be used without 'drawalpha':`` + + ``default:water_source 39 66 106`` + + ``# Entry that will be used with 'drawalpha':`` + + ``default:water_source 78 132 212 64 224`` + + This is useful, as colors that look nice in a map without transparency + don't always look nice in a map with transparency. + + **Default** + + A default colors.txt is included with minetestmapper, which includes + the default nodes from minetest_game, as well as nodes from several + popular mods. + + Two variants of the colors.txt are also included: + + ``colors-average-alpha.txt``: + This version is recommended to be used in combination with + ``--drawalpha=average`` + + ``colors-cumulative-alpha.txt``: + This version is recommended to be used in combination with + ``--drawalpha=cumulative`` or ``--drawalpha=cumulative-darken`` + +Heightmap-nodes.txt Syntax +-------------------------- + + The heightmap-nodes.txt file contains a list of minetest node names that + determine the ground height for a height map. + + The highest node of any of the types in this file determines the height at + that point. Any nodes that should be ignored, like obviously air, but + probably also default:water_source, and default:grass_1, or default:torch, + should not be in this file. + + As a general directive, plants, trees and any special nodes should not + be included in the file. Stone, sand, gravel, minerals, etc. are the + kinds of nodes that should be included. Normally, water nodes should + probably not be included either. + + This file *can* have the same syntax as the colors.txt file, but the + actual colors will be ignored. Alternatively, a simple list of node + names also suffices: + + ```` + + ```` + + ``[...]`` + + Examples: + + ``default:sandstonebrick`` + + ``default:copperblock`` + + **Default** + + A default heightmap-nodes.txt is included with minetestmapper, and + is searched for in the default locations. Alternatively, the file to use + can be specified on the command line with ``--heightmap-nodes `` + +Heightmap-colors.txt Syntax +--------------------------- + + When generating a height map, either a single-color map can be + generated, with colors ranging from black to one specific color, + or a multi-color map can be generated. + + For a multi-color map, a heightmap-colors.txt is needed, which + describes which colors to use. It has lines with the following syntax: + + `` `` + + Where the heights are a number, or the special values ``-oo`` or ``oo`` (for + negative and positive infinity). + + For example: + + ``-50 50 255 0 0 0 255 0`` + + ``50 100 0 255 0 0 0 255`` + + While signifies that between height -50 to 50, the color of the nodes will + slowly change from red to green, and between 50 and 100, the color will slowly + change from green to blue. + + It is possible to specify overlapping ranges. The colors they specify will + be averaged: + + ``-50 50 255 0 0 0 255 0`` + + ``-50 50 0 255 0 0 0 255`` + + Between the heights -50 and 50, the colors will change from ``#7f7f00`` to ``#007f7f``. + (because the colors are *averaged*) + + **Default** + + A default heightmap-colors.txt is included with minetestmapper, and + is searched for in the default locations. An attempt was made to make + a standard minetest world look reasonably good, while at the same time + providing colors for a large height range. + + A second file that is included, called heightmap-colors-rainbow.txt, defines rainbow + colors instead. + + The file to use can also be specified on the command line with + ``--heightmap-colors `` + +Colors Files Common Syntax +-------------------------- + + All three types of colors files (colors.txt, heightmap-nodes.txt and heightmap-colors.txt) + have some syntax elements in common: + + * Any text after the first '#' on a line are comments, and is ignored. + * Any empty lines (afer ignoring comments), or lines containing only whitespace are ignored. + + In addition, a colors file may include another colors file using ``@include`` on a line. Any + color definitions after the inclusion point override the colors from the included file. For + example in the following colors.txt file: + +:: + + # Defining default:stone here is useless, as the color from the system + # colors file will override this. + default:stone 71 68 67 + + # Get all colors from the system colors file + # (your system colors file may be located elsewhere!) + @include /usr/share/minetestmapper/colors.txt + + # Use own color for default:dirt_with_grass, overriding the + # one from the system file + default:dirt_with_grass 82 117 54 + +.. + + The colors.txt file also supports undefining colors (so that minetestmapper will complain + about unknown nodes). This is achieved by specifying '-' instead of a color: + +:: + + # Get all colors from the system colors file + # (your system colors file may be located elsewhere!) + @include /usr/share/minetestmapper/colors.txt + + # Water is undefined. Minetestmapper will complain + # about it and not draw water nodes. + default:water_source - + default:water_flowing - + + # The same effect might be achieved by defining water + # to have an alpha of 0. Minetest will not complain. + #default:water_source 78 132 212 0 + #default:water_flowing 78 132 212 0 + +.. + +Colors Files Search Locations +----------------------------- + + When minetestmapper needs a colors file (colors.txt, heightmap-nodes.txt and + heightmap-colors.txt), it will search for in a few predefined locations, which + depend on your system and the way minetestmapper was built. In general, the + following locations can be searched: + + * The directory of the world being mapped + + * The directory two levels up from the directory of the world being mapped, + (i.e. the global minetest configuration directory) provided that that directory + contains a file 'minetest.conf' + + * The user's private minetest directory (``$HOME/.minetest``) - if the environment + variable ``$HOME`` exists. + + * The system directory corresponding to the location where minetestmapper + is installed. Usually, this would be ``/usr/share/games/minetestmapper/`` + or ``/usr/local/share/games/minetestmapper/``. + + * For compatibility, in the current directory as a last resort. + This causes a warning message to be printed. + + If the location of a colors file was specified using the appropriate option + on the command-line, no further locations are searched for that type of + colors file. + + In order to find out exactly where a specific copy of minetestmapper searched + its files, use the option ``--verbose-search-colors=2``, + +More Information +================ + +More information is available: + +* A feature summary: ``_ (HTML version, if available: ``_) +* Building instructions: ``_ (HTML version, if available: ``_) +* Github repository: ``_ +* Reporting bugs: ``_ + + +.. ----------------- END OF MANUAL ---------------------------- + +.. Shorthands for some links + +.. _known problems: features.rst#known-problems + +.. _--backend: `--backend `_ +.. _--bgcolor: `--bgcolor `_ +.. _--blockcolor: `--blockcolor `_ +.. _--centergeometry: `--centergeometry `_ +.. _--chunksize: `--chunksize `_ +.. _--colors: `--colors `_ +.. _--cornergeometry: `--cornergeometry `_ +.. _--draw[map]
: `--draw[map]
" color"`_ +.. _--draw[map]circle: `--draw[map]circle " color"`_ +.. _--draw[map]ellipse: `--draw[map]ellipse " color"`_ +.. _--draw[map]line: `--draw[map]line " color"`_ +.. _--draw[map]point: `--draw[map]point ", color"`_ +.. _--draw[map]rectangle: `--draw[map]rectangle " color"`_ +.. _--draw[map]text: `--draw[map]text ", color text"`_ +.. _--drawalpha: `--drawalpha[=cumulative\|cumulative-darken\|average\|none]`_ +.. _--drawscale: `--drawscale[=left,top]`_ +.. _--geometry: `--geometry `_ +.. _--geometrymode: `--geometrymode pixel,block,fixed,shrink`_ +.. _--heightmap-colors: `--heightmap-colors[=]`_ +.. _--heightmap-nodes: `--heightmap-nodes `_ +.. _--heightmap-yscale: `--heightmap-yscale `_ +.. _--heightmap: `--heightmap[=]`_ +.. _--heightscale-interval: `--heightscale-interval [[,:]]`_ +.. _--input: `--input `_ +.. _--max-y: `--max-y `_ +.. _--min-y: `--min-y `_ +.. _--origincolor: `--origincolor `_ +.. _--output: `--output `_ +.. _--playercolor: `--playercolor `_ +.. _--scalecolor: `--scalecolor `_ +.. _--scalefactor: `--scalefactor 1:`_ +.. _--height-level-0: `--height-level-0 `_ +.. _--sidescale-interval: `--sidescale-interval [[,:]]`_ +.. _--tilebordercolor: `--tilebordercolor `_ +.. _--tilecenter: `--tilecenter ,\|world\|map`_ +.. _--tileorigin: `--tileorigin ,\|world\|map`_ +.. _--tiles: `--tiles [+]\|block\|chunk`_ +.. _--verbose-search-colors: `--verbose-search-colors[=n]`_ +.. _--verbose: `--verbose[=n]`_