Clone or download
Pull request Compare This branch is 60 commits ahead of equalpants:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
textures/entity
.gitignore ignore object and executable Dec 24, 2012
COPYING
Makefile
README
blockdescriptor.list
blockimages.cpp
blockimages.h
blocktextures.list New Blocks up to Minecraft 17w17b snapshot May 2, 2017
chunk.cpp
chunk.h
map.cpp Removed trailing carriage returns Dec 11, 2012
map.h Removed trailing carriage returns Dec 11, 2012
pigmap.cpp
region.cpp
region.h Removed trailing carriage returns Dec 11, 2012
render.cpp
render.h Removed trailing carriage returns and fixed permissions Dec 11, 2012
rgba.cpp
rgba.h
style.css
tables.cpp
tables.h Removed trailing carriage returns Dec 11, 2012
template.html Removed trailing carriage returns Dec 11, 2012
utils.cpp Removed trailing carriage returns Dec 11, 2012
utils.h
world.cpp
world.h

README

pigmap is a Minecraft map renderer, designed to be fast enough for very large worlds (like
the Aporkalypse Now server, hence the name).  It was inspired by Minecraft Overviewer and does
essentially the same thing, just faster and with fewer fancy options.  Features include:

-isometric projection; level of detail on max zoom is user-settable
-Google Maps tile output
-custom tilesets (supply your own texture pack)
-ability to manually edit the isometric block images generated from texture pack,
  for further beautification
-incremental map updates, but you must supply your own list of modified chunks (most
  likely via rsync or something similar)
-multithreading
-support for Alpha (chunk-based), Beta (.mcr), or Anvil (.mca) world formats
-ability to restrict rendering to a certain range of Y-values (heights)

pigmap is free under the GPL (please see the file COPYING).  I probably won't add too many
more features beyond whatever the Aporkalypse might need in the future, but hopefully it will
be useful to someone.

Michael J. Nelson, mike@thinkingpart.com ("equalpants" in Minecraft)

The files template.html and style.css contain code from Minecraft Overviewer (copyright
Andrew Brown and contributors).

The official pigmap repository is at:
https://github.com/equalpants/pigmap

Latest textures to build tile set is at (if you don't want to manually extract textures):
https://www.dropbox.com/s/qkckuwbu1an77sm/pigmap_mc_textures.7z

---------------------------------------------------------------------------------------------------

Supported platforms are Linux and cygwin.  OS X should also be fine, but I haven't tried it
myself.  (I've heard reports of it working, though.)

Dependencies are zlib, libpng, libjpeg, pthreads, and some very basic system stuff: getopt, mkdir,
dirent.h.  If your platform has a separate development package for libpng (called libpng-dev,
libpng-devel, or something like that), you'll need that one, too.

Use supplied makefile to build with g++.

---------------------------------------------------------------------------------------------------

Change log (important stuff only):
1.8
-new blocks up to Minecraft 1.8 (andesite, diorite, granite, coarse dirt
  prismarine blocks, sea lantern, sponge, iron trapdoor, inverted daylight sensor)
-new fence & fence gate variants
-new door variants
-added different bottom texture for stairs (sandstone, quartz, red sandstone)
-fixed farmland block not showing if it is wet

1.7
-added support for RGB PNG images (with no alpha channel)
-endportal.png is no longer included in root directory
-texture names are aligned with 1.6+/1.7 textures
-new blocks up to Minecraft 1.7 (packed ice, tall flowers, new flowers, stained glass, stained glass pane)
-new block type (used for tall flowers)
-new texture directive (to combine multiple textures in one, to be used for generating tiles)

1.6
-new blocks up to Minecraft 1.6

1.5
-fire.png, terrain.png, chest.png (and similar) are no longer required
-pigmap now works with upcoming Minecraft 1.5 textures
-folders /item, /textures/blocks from minecraft.jar or your texture pack are
  required (in image path), including their contents
-new blocks up to 13w03a Minecraft snapshot (upcoming Minecraft 1.5)
-possibility to render custom blocks

1.2
-new blocks up to Minecraft 1.3
-chest.png, etc. now required
-some speed improvements
-block IDs >= 256 (from mods) now ignored rather than drawn as random blocks
-memory requirements increased--should now be just a little lower than pre-Anvil
  versions (roughly ~250-300 MB per thread)

1.1.2
-added inverted slabs

1.1.1
-fixed a stupid bug preventing incremental updates from working

1.1
-Anvil format support
-added -y and -Y params to specify minimum/maximum Y-coords for rendering
-memory requirements are about 15-20% lower due to better caching
-new blocks up to Minecraft 1.2.4: circle stone brick, new sandstone types, redstone lamps,
  new plank colors, upside-down stairs
-some display fixes for older blocks whose behavior has changed: fences, doors

1.0.1
-new blocks: jungle logs/leaves/saplings

1.0
-NOTE: users of jcornwellshiel's fork will need to regenerate their blocks-B.png
-new blocks all the way up through Minecraft 1.0
-endportal.png added; must be placed in images directory alongside terrain.png
-fixed some ugliness in the rendering of cross-shaped item blocks (saplings, etc.)
-improved rendering of large block sizes (B > 8)

0.7.4
-new blocks for Minecraft Beta 1.6: tall grass, ferns, dead shrubs, trapdoors

0.7.3
-new blocks for Minecraft Beta 1.4 and 1.5: locked chests, boosters, detectors,
  pine/birch saplings, webs

0.7.2
-support for big-endian platforms (like PowerPC)

0.7.1
-birch and pine leaves
-more error/logging messages

0.7
-Minecraft Beta 1.3 support: new region file format, beds, repeaters, slabs

0.6.1
-support for HD texture packs

0.6
-new block types for Minecraft Beta 1.2: lapis, cake, etc.
-remaining undrawn blocks from previous versions now drawn: fire, buttons, levers, ascending
  cart tracks
-fire.png added; must be placed in images directory alongside terrain.png
-some block image offsets changed; see note below if you have manually edited your blocks-B.png
-some drawing improvements; may want to redo all block images from terrain.png

0.5.1
-speed improvements
-previously, we would abort if the world was too absurdly large to deal with--i.e. if there were
  some chunks whose coordinates were well into the billions--but apparently there is a Minecraft
  bug that can create such chunks way off in space, even if the world is normally-sized, so now
  we just ignore any chunks that are too far out to handle

0.5
-initial version

---------------------------------------------------------------------------------------------------

Usage examples:

full render:

pigmap -B 6 -T 1 -Z 10 -i input/World1 -o output/World1 -g images -t 3

...builds a map with parameters B = 6, T = 1, baseZoom = 10, reading world data from the path
"input/World1", writing tiles out to the path "output/World1", reading terrain images from the path
"images", and using 3 threads.

incremental update:

pigmap -i input/World1 -o output/World1 -r regionlist -t 3 -x

...updates an existing map by redrawing any tiles touched by regions listed in the file "regionlist",
with the input and output dirs as before.  Terrain images are read from the path ".", and 3 threads
are used.  Map parameters are read from the existing map, and if the existing baseZoom is too small,
it will be incremented.

---------------------------------------------------------------------------------------------------

Error messages are written to stderr; normal output to stdout.  There isn't much (read: any) of a
progress indicator at the moment, but there are some statistics upon completion.

---------------------------------------------------------------------------------------------------

Explanation of command-line options:


1. Params for both full renders and incremental updates:

a. input path, output path (-i, -o)

The input path should be the top directory of the world data (i.e. where level.dat is).  The tile
output path should be the top of the Google Maps directory structure (i.e. where base.png is).  Tile
images will be written to the output path, along with a file "pigmap.params" which remembers what
parameters the map was drawn with.  For incremental updates, the output path must exist already, and
must contain the pigmap.params file.

Three world formats are supported: the current Anvil format (with .mca region files), the .mcr
region format that preceded it, and the even older chunk-based format.  If the input path contains
more than one format, then only the newer format will be used.

b. [optional (kind of)] HTML source path (-m)

This is where pigmap expects to find the files "template.html" and "style.css", which it will
use to construct a bare-bones HTML page for viewing the map.  These files are not optional, but
the -m parameter itself may be omitted, in which case "." is used as the HTML source path.

The map-viewing page is called "pigmap-default.html" and is written to the output path.  It doesn't have
any fancy capabilities (just plain old markers); it's meant only to demonstrate the JavaScript for
converting Minecraft coords to Google Maps latitude/longitude.  This file is rewritten with every
incremental update; make a copy if you need to add fancier abilities to it.

c. [optional (kind of)] image path (-g)

This is where pigmap expects to find either a copy of your textures (textures/ folder of your minecraft.jar etc.), or a copy of
blocks-B.png (substituting the actual numeric value of B; see below for definition of B), a
pigmap-generated file that contains the isometric renderings of each block.  These files are not
optional, but the -g parameter itself may be omitted, in which case "." is used as the image path.

Each blocks-B.png comes with a corresponding blocks-B.version, which remembers how many block images
are stored in blocks-B.png.  (As more blocks are added to the game, the version will change.)

The selection of block images works thusly:

-If blocks-B.png does not exist, then the tileset you provide will be used to create it.
-If blocks-B.png exists but has an old version, your tileset will be used to create new replacement. Old blocks-B.png data will be lost.
-If blocks-B.png exists and is up-to-date, its block images will be used.

This means that pigmap will need your tileset the first time it runs, so it can generate blocks-B.png;
subsequent runs will use the existing blocks-B.png, which can be manually edited if insufficiently
pretty, or for special effects, etc.

To generate blocks-B.png, extract the entity/ and blocks/ folders from your minecraft.jar into textures/ folder inside the folder 
you have specified, so folder structure looks like this:
/%specified_image_path%
    /textures
        /blocks
        /entity

All of these must be RGBA/RGB (32BPP/24BPP) png files.

d. [optional] number of threads (-t)

Defaults to 1.  Each thread requires around 250-300 MB of RAM (they work in different areas of the
map and keep separate caches of chunk data).  Returns from extra threads may diminish quickly as the
disk becomes a bottleneck.

e. [optional] output image file format (-f)

Defaults to png. The output is either done as png files, jpeg files or both. Jpeg can be compressed to
smaller file sizes than png and may be preferrable for web use, but incremental rendering only reads
png files, since jpeg is a lossy format. The "both" option is supplied to deal with this situation -
both file formats will be written, jpeg used in the html map and png files can be kept for future
incremental renders.

f. [optional] Jpeg quality (-j)

Defaults to 75. A number between 1 and 100 that determines what quality level jpeg files are written.
Higher means better quality but larger file sizes. Has no effect (obviously) if the output file format
is not set to jpeg or both.


2. Params for full renders only:

a. map parameters B, T, [optional] baseZoom (-B, -T, -Z):

B is an integer >= 2 which controls the size (in pixels) of the blocks in the base zoom level.  The
map projection lays out blocks on a hexagonal grid generated from the distances [+/-2B, +/-B] and
[0, +/-2B], and each individual block's bounding box is 4B x 4B.

T is the tile multiplier, an integer >= 1 which controls how many chunks wide a tile is.

The size of each generated tile is 64BT x 64BT.

(To match Minecraft Overviewer's highest zoom level, use B=6 and T=1, for a tile size of 384 x 384.
To match its second-highest zoom, use B=3 and T=2.)

baseZoom is the Google Maps zoom level that the base tiles should be placed on.  This is important
because Google Maps allows only 2^Z by 2^Z tiles for each zoom level Z; if baseZoom is not high enough,
some tiles will not fit on the Google Map.  (Out-of-bounds tiles will be noticed at the start of a
render, and the render aborted.)

If baseZoom is omitted, it will be set to the lowest value that can fit all the required tiles.

b. [optional] minimum/maximum Y-coords (-y, -Y)

By default, pigmap will draw all blocks present in the world data, but these parameters can be
used to restrict rendering to blocks within a particular height range.  -y is the minimum Y-coord
which will be drawn, and -Y is the maximum.

Note that these values, if used, will persist through incremental updates of the map (like B and T
do), even if the actual height limit in the game changes in the future.  So if you want the map to
always render all the way to the top, then *don't use* -Y, as opposed to using it but passing in
the *current* height limit.


3. Params for incremental updates only:

a. regionlist file (-r) or chunklist file (-c)

The name of a text file containing the filenames of regions or chunks that should be updated, one per
line.  Supplied filenames can have a relative or absolute path or can just be the file name; only the
name will be examined.

If the input world is in region format (either .mca or .mcr regions), then a regionlist must be used,
not a chunklist.  However, the extensions on the filenames in a regionlist do not matter--only the
coordinates from the filenames will be considered, and pigmap will always read the newest available
region.

The current format of the input world does *not* have to match the format used in the previous map
render--an incremental update will work fine even if the world data has been converted since the
last render.  (Of course it would be trickier to get a meaningful regionlist in such a case--to
distinguish the regions which have actually changed from those which have merely been converted--
but if you have such a list, then pigmap can use it.)

b. [optional] expand map if necessary (-x)

This is useful for frequently-updated maps: eventually, as the world expands outwards, it will become
too large for the current baseZoom, and an incremental update will fail.  If -x has been passed, then
if an incremental update fails due to out-of-bounds tiles, the map's baseZoom will be increased by
1, and the update retried.  (The baseZoom increase is *not* undone if the second attempt also fails.)

Note that increasing a map's baseZoom is quick: all the tiles are simply moved one level deeper in
the hierarchy, and the top two zoom levels redrawn.

---------------------------------------------------------------------------------------------------

What happens in a full render: the world data is scanned, and every chunk that exists on disk is noted.
All tiles that include any chunks are rendered and saved; any tiles that might exist already in the
output path are overwritten.

What happens in an incremental update: the chunklist is read and its chunks are considered "required";
the world data is not scanned.  (However, the input path must still contain the non-required chunks;
that is, you can't just use a partial copy of a world.  This is because each tile touches multiple
chunks; to render a required chunk, data from its non-required neighbors may be necessary.)  All tiles
that include required chunks are rendered and saved.  Base tiles that exist already in the output path
are overwritten, but those at lower zoom levels are merely modified--only the changed portions
are redrawn.

---------------------------------------------------------------------------------------------------

Custom blocks:

1. Textures
blocktextures.list file is used to declare and pre-process textures, before generating blocks-B.png
tiles. For more info read blocktextures.list;

2. Blocks
blockdescriptor.list file is used to declare and describe new blocks by their respective IDs.
It also describes how blocks look and what textures do they use. Textures must be declared in
blocktextures.list file. For more info read blockdescriptor.list;

Note: Block IDs >= 256 will be not used by renderer.

---------------------------------------------------------------------------------------------------

Special note for those who choose to manually edit blocks-B.png:

Block positions in blocks-B.png are dynamic. When new blocks are declared in blockdescriptor.list, 
old blocks-B.png is overwritten by newly generated. Don't forget to make backups.

Block images are generated in order of appearance in blockdescriptor.list. You can use that to your advantage
by declaring new blocks at the end of the list. Then you can easily combine old and new ones with image editor,
as new blocks-B.png will look similar to the old one with new tiles added at the end.