This project is read-only.


The Terraria Map Generator is a tool that can be used to generate the tiles for use by the Google API for displaying a Terraria world in Google Maps. The program takes the Terraria installation path to access the game resources and the path to the world file, combine with a few more parameters that control the zoom levels and layers generated to construct a folder hierarchy that can easily be accessed using the getTile API from Google Maps.


The generated output of the tool varies depending on the size of the world, the number of layers and the number of zoom levels. On a large world that have 6 zoom levels and 1 layer, the output size is about 1.2 GBs. If only the top level zoom is generated, the output size is around 700 MBs.


Command Line Arguments




terraria Required The full path to the Terraria installation folder.

Example: C:\Program Files (x86)\Steam\steamapps\common\terraria
world Required The full path to the world file to generate the map tiles for.

Example:  C:\Users\JohnDoe\Documents\My Games\Terraria\Worlds\world4.wld
output Required The path to generate the map tiles to. This folder will contain the generated hierarchy of folders.
blocksize Optional The number of tiles to draw in a block of zoom level 1. For example, a block size of 16,16 would render 16 tiles horizontally and 16 tiles vertically. The resulting image will be 256 by 256, each tile being 16 by 16 pixels.

Example: 16,16

The value should be the horizontal number followed by a comma then the vertical number with no spaces.
layer 1 or more Specifies a layer to be generated. A layer takes an comma separated list that specifies the elements to render to the layer. The values available are: drawwalls, drawbackgroundwater, drawforegroundwater, drawbackgroundtiles, drawforegroundtiles.

Example: drawwalls,drawbackgroundwater,drawforegroundwater, drawbackgroundtiles,drawforegroundtiles
zoomlevels 1 or more Specifies a comma separated list of zoom levels to generate.

Example: 0.03125,0.0625,0.125,0.25,0.5,1
mapdata Optional Causes the tool to generate a MapData.xml file that provides various information about the location of various world objects.



Folder Layout

The layout of the generated files is in a hierarchy underneath the output folder. The hierarchy follows the following pattern:

  • Output
    • Zoom #
      • Layer #
        • X Block Coordinate
          • Y Block Coordinate PNG files

So for example, the output would contain files like this:

  • Output
    • Zoom 0.03125
      • Layer 0
        • 0
          • 0.png
          • 1.png
          • 2.png
        • 1
        • 2
      • Layer 1
    • Zoom 0.0625
    • Zoom 0.125




The map generator tool is designed to support multiple layers. This will allow overlays on the Google Maps. This feature was specifically added so that discoverable items such as chest, pots, hearts, etc, could be isolated and only displayed if so desired. When executing the tool, layers are specified in order using the –layer argument. The layer arguments become Layer 0, Layer 1, Layer 2, and so on in the Zoom folders.

When specifying a layer argument, you supply the list of things the layer should render. Currently the list is fairly limited because the chest, pots, and the like share a layer with common assets such as vines and grass.


Layer Option Description
drawbackground Draws the background walls.
drawwalls Draws any walls. These are the dirty background walls and any user created and placed walls.
drawbackgroundwater Draws water in the background with full intensity.
drawforegroundwater Draws water in the foreground above all tiles with half intensity, causing the normal tiles to be tinted to the water color.
drawbackgroundtiles Draws background tiles such as dirt, ore, trees.
drawforegroundtiles Draws foreground tiles such as pots, hearts, chest, grass.



The following is an example of generating the map tiles with 6 zoom levels for a large world. The output is placed directly into the Terraria folder under a Map directory:

terrariamaptool.exe -terraria "C:\Program Files (x86)\Steam\steamapps\common\terraria" -world "C:\Users\JohnDoe\Documents\My Games\Terraria\Worlds\world4.wld" -output "C:\Program Files (x86)\Steam\steamapps\common\terraria\Content\Map" -blocksize 16,16 -layer drawwalls,drawbackgroundwater,drawforegroundwater,drawbackgroundtiles,drawforegroundtiles -zoomlevels 0.03125,0.0625,0.125,0.25,0.5,1

Last edited Aug 20, 2011 at 3:44 AM by rpowers3, version 10


fryfrog Jul 25, 2011 at 6:14 PM 
Also, I think one layer option is missing. The GUI has 6 options and you only list 5 here. I suspect it is "drawbackground" based on the name in the GUI.

fryfrog Jul 24, 2011 at 10:25 PM 
What are good layers to group together?

It looks like drawwalls, drawbackgroundwater, drawforegroundwater would logically group together. Then separate layers for each of drawbackgroundtiles and drawforegroundtiles.