Difference between revisions of "Town Format"

From VCMI Project Wiki
Jump to: navigation, search
(Remaining tasks)
(Current config structure: Finalization for town format)
Line 38: Line 38:
  
 
= Current config structure =
 
= Current config structure =
 +
== Faction node (root entry for town configuration) ==
 +
<pre>
 +
{
 +
"town" : { ... }, //optional. Should be present for playable faction
 +
"nativeTerrain" : "",
 +
"creatureBackground"
 +
{
 +
"120px" : "",
 +
"130px" : ""
 +
}
 +
"puzzleMap" :
 +
[
 +
{
 +
"image" : "",
 +
"x" : 0
 +
"y" : 0
 +
"index" : 0 //when this piece will be opened
 +
},
 +
{ ... },
 +
  ...
 +
{ ... }
 +
]
 +
}
 
== Town node ==
 
== Town node ==
 
<pre>
 
<pre>
Line 45: Line 68:
 
"village": "",
 
"village": "",
 
"castle" : "", // town with fortifications
 
"castle" : "", // town with fortifications
"capitol": "", // town with both fort and capitol
+
"capitol": "" // town with both fort and capitol
 
},
 
},
 
"icons" : //icons, small and big. Built versions indicate constructed during this turn building.
 
"icons" : //icons, small and big. Built versions indicate constructed during this turn building.
Line 52: Line 75:
 
"smallBuilt" : "",
 
"smallBuilt" : "",
 
"big" : "",
 
"big" : "",
"bigBuilt" : "",
+
"bigBuilt" : ""
 
},
 
},
 
"structures" : // Structures. Represents visible graphical objects on town screen.
 
"structures" : // Structures. Represents visible graphical objects on town screen.
Line 62: Line 85:
 
"townName" : "", // localized town name.
 
"townName" : "", // localized town name.
 
"townNames" : [ "", ""], // list of names for towns on adventure map
 
"townNames" : [ "", ""], // list of names for towns on adventure map
"townBackground": "", // backgound scenery
+
"townBackground": "", // background scenery
"guildWindow": "", // mages guild window
+
"guildWindow": "", // mage guild window
  
 
"buildingsIcons": "HALLCSTL.DEF", // Not sure what to do with this
 
"buildingsIcons": "HALLCSTL.DEF", // Not sure what to do with this
Line 77: Line 100:
 
],
 
],
 
"creatures" : [ [0, 1], [2, 3] ], // List of creatures available on each tier
 
"creatures" : [ [0, 1], [2, 3] ], // List of creatures available on each tier
 
"creatureBackground"
 
{
 
"120px" : "",
 
"130px" : ""
 
},
 
  
 
"buildings" : // Buildings, objects in town that affect available options
 
"buildings" : // Buildings, objects in town that affect available options
Line 95: Line 112:
  
 
"horde" : [ 2, -1 ], // Which tiers in this town have creature hordes
 
"horde" : [ 2, -1 ], // Which tiers in this town have creature hordes
"primary_resource" : 127, // Resource produced by resource silo, 127 = wood + ore
+
"primaryResource" : 127, // Resource produced by resource silo, 127 = wood + ore
"mage_guild" : 4, // maximum level of mages guild
+
"mageGuild" : 4, // maximum level of mages guild
"war_machine" : 4, // war machine produced in town
+
"warMachine" : 4 // war machine produced in town
 
}
 
}
 
</pre>
 
</pre>
Line 107: Line 124:
 
"top" :
 
"top" :
 
{
 
{
"tower" : { "x": 0, "y": 0 },
+
"tower" :     { "x": 0, "y": 0, "image" : "" },
"battlement" : { "x": 0, "y": 0 },
+
"battlement" : { "x": 0, "y": 0, "image" : "" },
"creature" : { "x": 0, "y": 0 },
+
"creature" :   { "x": 0, "y": 0, "cropHeight" : 0 },
"shooter" : { "name" : "", "cropHeight" : 0}
+
"shooter" : "" // shooter creature name
 
},
 
},
 
"keep" : { ... },
 
"keep" : { ... },
Line 117: Line 134:
 
"gate" :
 
"gate" :
 
{
 
{
"upperWall" : { "x": 0, "y": 0 },
+
"upperWall" : { "x": 0, "y": 0, "image" : "" },
"bottomWall": { "x": 0, "y": 0 },
+
"bottomWall": { "x": 0, "y": 0, "image" : "" },
 
 
"gate" : { "x": 0, "y": 0 },
+
"gate" : { "x": 0, "y": 0, "image" : "" },
"arch" : { "x": 0, "y": 0 }
+
"arch" : { "x": 0, "y": 0, "image" : "" }
}
+
},
"walls" :
+
"walls" : // destructible walls
 
{
 
{
"upper" : { "x": 0, "y": 0 },
+
"upper" : { "x": 0, "y": 0, "image" : "" },
"upperMid" : { "x": 0, "y": 0 },
+
"upperMid" : { "x": 0, "y": 0, "image" : "" },
"bottomMid" : { "x": 0, "y": 0 },
+
"bottomMid" : { "x": 0, "y": 0, "image" : "" },
"bottom" : { "x": 0, "y": 0 }
+
"bottom" : { "x": 0, "y": 0, "image" : "" }
}
+
},
"moat" : { "x": 0, "y": 0 },
+
"moat" : { "x": 0, "y": 0, "image" : "" },
"static"
+
"static" : //static non-destructible walls
 
{
 
{
"bottom" : { "x": 0, "y": 0 },
+
"bottom" : { "x": 0, "y": 0, "image" : "" },
"top" : { "x": 0, "y": 0 },
+
"top" : { "x": 0, "y": 0, "image" : "" },
"background" : { "x": 0, "y": 0 }
+
"background" : { "x": 0, "y": 0, "image" : "" }
 
}
 
}
 
}
 
}
 
</pre>
 
</pre>
== Buildings node ==
+
== Building node ==
 
<pre>
 
<pre>
 
{
 
{
Line 148: Line 165:
 
"requires" : [], // building requirements
 
"requires" : [], // building requirements
 
"cost" : { ... },
 
"cost" : { ... },
 +
 
//determine how this building can be built. Possible values are:
 
//determine how this building can be built. Possible values are:
// normal  - default
+
// normal  - default value. Fulfill requirements, use resources, spend one day
 
// auto    - building appears when all requirements are built
 
// auto    - building appears when all requirements are built
 
// special - building can not be built manually
 
// special - building can not be built manually
Line 159: Line 177:
 
<pre>
 
<pre>
 
{
 
{
"base" : 0 // building this structure is based on
+
"base" : 0, // building this structure is based on. If null - structure will be present always.
 
"animation" : "", // def file with animation
 
"animation" : "", // def file with animation
 
"x" : 0,
 
"x" : 0,

Revision as of 21:52, 30 August 2012

Current version of town description format.

Remaining tasks

  • Remove usage of numeric ID's. Long-term goal due to heavy usage of id's in VCMI code.
  • Collect any remaining hardcoded data

Split faction description from town description

Currently there is no separation between "faction" and "town" concepts. This results in several issues:

  • Neutral creatures have invalid faction - no town with such description is present
  • Loading towns requires creatures and loading creatures requires towns

This should be split into several parts:

  • faction: stores all information that can be separated from town (e.g. puzzle map, hero classes, creatures)
  • town: stores only information required for town (e.g. buildings and recruitable creatures)
  • (optional) town gui: separate structure will all gui-specific data (e.g. structures)

Merge in remaining json configs

  • (DONE) buildings.json (used as base for this configuration)
  • (DONE) creatures_backgrounds.json
  • (DONE) hall.json
  • (DONE) town_pictures.json
  • (DONE) towns_defs.json
  • (DONE) wall_pos.json (needs removing hardcoded name)
  • puzzle_map.json (needs removing hardcoded name)

Won't be used:

  • commanders.json (leave it as it?)
  • terrains.json (movement speed should be left in terrain configuration I think)

Merge in data from HoMM3 txt files

  • (DONE) BldgNeut.txt
  • (DONE) BldgSpec.txt
  • (DONE) Dwelling.txt
  • (DONE) Building.txt
  • (DONE) TownName.txt
  • (DONE) TownType.txt

Current config structure

Faction node (root entry for town configuration)

{
	"town" : { ... }, //optional. Should be present for playable faction
	"nativeTerrain" : "",
	"creatureBackground"
	{
		"120px" : "",
		"130px" : ""
	}
	"puzzleMap" :
	[
		{
			"image" : "",
			"x" : 0
			"y" : 0
			"index" : 0 //when this piece will be opened
		},
		{ ... },
		  ...
		{ ... }
	]
}
== Town node ==
<pre>
{
	"adventureMap" : // adventure map object animations
	{
		"village": "",
		"castle" : "", // town with fortifications
		"capitol": "" // town with both fort and capitol
	},
	"icons" : //icons, small and big. Built versions indicate constructed during this turn building.
	{
		"small" : "",
		"smallBuilt" : "",
		"big" : "",
		"bigBuilt" : ""
	},
	"structures" : // Structures. Represents visible graphical objects on town screen.
	[
		{ ... },
		  ...
		{ ... } 
	],
	"townName" : "", // localized town name.
	"townNames" : [ "", ""], // list of names for towns on adventure map
	"townBackground": "", // background scenery
	"guildWindow": "", // mage guild window

	"buildingsIcons": "HALLCSTL.DEF", // Not sure what to do with this

	"hallBackground": "", // Background image for town hall window
	"hallSlots": // list of buildings available in each slot of town hall window
	[
		[ [ 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 ] ]
	],
	"creatures" : [ [0, 1], [2, 3] ], // List of creatures available on each tier

	"buildings" : // Buildings, objects in town that affect available options
	[
		{ ... },
		  ...
		{ ... } 
	],
	"siege" : { ... },

	// Entries that should be replaced with autodetection

	"horde" : [ 2, -1 ], // Which tiers in this town have creature hordes
	"primaryResource" : 127, // Resource produced by resource silo, 127 = wood + ore
	"mageGuild" : 4, // maximum level of mages guild
	"warMachine" : 4 // war machine produced in town
}

Siege node

{
	"towers":
	{
		"top" :
		{
			"tower" :      { "x": 0, "y": 0, "image" : "" },
			"battlement" : { "x": 0, "y": 0, "image" : "" },
			"creature" :   { "x": 0, "y": 0, "cropHeight" : 0 },
			"shooter" : "" // shooter creature name
		},
		"keep" : { ... },
		"bottom" : { ... }
	},
	"gate" :
	{
		"upperWall" : { "x": 0, "y": 0, "image" : "" },
		"bottomWall": { "x": 0, "y": 0, "image" : "" },
		
		"gate" : { "x": 0, "y": 0, "image" : "" },
		"arch" : { "x": 0, "y": 0, "image" : "" }
	},
	"walls" : // destructible walls
	{
		"upper" : { "x": 0, "y": 0, "image" : "" },
		"upperMid" : { "x": 0, "y": 0, "image" : "" },
		"bottomMid" : { "x": 0, "y": 0, "image" : "" },
		"bottom" : { "x": 0, "y": 0, "image" : "" }
	},
	"moat" : { "x": 0, "y": 0, "image" : "" },
	"static" : //static non-destructible walls
	{
		"bottom" : { "x": 0, "y": 0, "image" : "" },
		"top" : { "x": 0, "y": 0, "image" : "" },
		"background" : { "x": 0, "y": 0, "image" : "" }
	}
}

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
}