Town Format
From VCMI Project Wiki
Current version of town description format.
Contents
Current config structure
Faction node (root entry for town configuration)
// Unique faction identifier. Should be unique.
"myTown" :
{
// Main part of town description, see below
// Optional but it should be present for playable faction
"town" : { ... },
// Native terrain for this town. See config/terrains.json for identifiers
"nativeTerrain" : "grass",
// Localizable town name, e.g. "Rampart"
"name" : "",
// Faction alignment. Can be good, neutral (default) or evil.
"alignment" : "",
// Backgrounds for creature screen, two versions: 120px-height and 130-px height
"creatureBackground"
{
// Paths to background images
"120px" : "",
"130px" : ""
}
// Town puzzle map
"puzzleMap" :
{
// Prefix for image names, e.g. "PUZCAS" for name "PUZCAS12.png"
"prefix" : "",
// List of map pieces. First image will have name <prefix>00, second - <prefix>01 and so on
"pieces" :
[
{
// Position of image on screen
"x" : 0
"y" : 0
//indicates order in which this image will be opened
"index" : 0
},
...
]
]
}
Town node
{
// Path to images of object on adventure map
"adventureMap" :
{
"village": "", // village without built fort
"castle" : "", // town with built fort
"capitol": "" // town with capitol (usually have some additional flags)
},
//icons, small and big. Built versions indicate constructed during this turn building.
"icons" :
{
"small" : "",
"smallBuilt" : "",
"big" : "",
"bigBuilt" : ""
},
// Path to town music theme, e.g. "music/castleTheme"
"musicTheme" : "",
// List of structures which represents visible graphical objects on town screen.
// See detailed description below
"structures" :
[
{ ... },
...
{ ... }
],
// List of names for towns on adventure map e.g. "Dunwall", "Whitestone"
// Does not have any size limitations
"names" : [ "", ""],
// Background scenery for town screen, size must be 800x374
"townBackground": "",
// Small scenery for window in mage guild screen
"guildWindow": "",
// Building icons for town hall
"buildingsIcons": "HALLCSTL.DEF",
// Background image for town hall window
"hallBackground": "",
// List of buildings available in each slot of town hall window
// As in most cases there is no hard limit on number of columns, rows
// or items in any of them, but size of gui is limited to 5 rows and 4 columns
"hallSlots":
[
[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5, 22 ], [ 16 ] ],
[ [ 14, 15 ], [ 0, 1, 2, 3 ], [ 6, 17 ] ],
[ [ 21 ], [ 18, 19 ] ],
[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
],
// List of creatures available on each tier. Number of creatures on each tier
// is not hardcoded but it should matchto number of dwelling for each level.
// For example structure below would need buildings with these id's:
// first tier: 30 and 37, second tier: 31, third tier: 32, 39, 46
"creatures" :
[
["centaur", "captainCentaur"],
["dwarf"],
["elf", "grandElf", "sharpshooter"],
...
],
// Buildings, objects in town that affect mechanics. See detailed description below
"buildings" :
[
{ ... },
...
{ ... }
],
// Description of siege screen, see below
"siege" : { ... },
// TODO: Entries below should be replaced with autodetection
// Which tiers in this town have creature hordes. Set to -1 to disable horde(s)
"horde" : [ 2, -1 ],
// Resource produced by resource silo, if not set silo will produce wood + ore
"primaryResource" : "gems",
// maximum level of mage guild
"mageGuild" : 4,
// war machine produced in town
"warMachine" : "ballista"
}
Siege node
{
"shooter" : "" // shooter creature name
"shooterHeight" : 0, //crop height of the shooters
"towers":
{
"top" :
{
"tower" : { "x": 0, "y": 0},
"battlement" : { "x": 0, "y": 0},
"creature" : { "x": 0, "y": 0},
},
"keep" : { ... },
"bottom" : { ... }
},
"gate" :
{
"gate" : { "x": 0, "y": 0},
"arch" : { "x": 0, "y": 0}
},
"walls" : // destructible walls
{
"upper" : { "x": 0, "y": 0},
"upperMid" : { "x": 0, "y": 0},
"bottomMid" : { "x": 0, "y": 0},
"bottom" : { "x": 0, "y": 0}
},
"moat" : { "x": 0, "y": 0},
"static" : //static non-destructible walls
{
"bottom" : { "x": 0, "y": 0}, // sections between
"top" : { "x": 0, "y": 0}, // destructible walls
"background" : { "x": 0, "y": 0} //topmost wall behind hero
}
}
Building node
{
"id" : 0,
"name" : "",
"description" : "",
"upgrades" : 0, // optional, which building can be upgraded by this one
"requires" : [], // building requirements
"cost" : { ... },
//determine how this building can be built. Possible values are:
// normal - default value. Fulfill requirements, use resources, spend one day
// auto - building appears when all requirements are built
// special - building can not be built manually
// grail - building reqires grail to be built
"mode" : "auto"
}
Structure node
{
"base" : 0, // building this structure is based on. If null - structure will be present always.
"animation" : "", // def file with animation
"x" : 0,
"y" : 0,
"z" : 0, // used for blit order. Higher value places structure close to screen
"border" : "", // selection highlight
"area" : "" // used to detect building selection
}