Difference between revisions of "Town Format"

From VCMI Project Wiki
Jump to: navigation, search
(Current config structure: Hopefully finishing buildings\structures)
(Current config structure: Split huge structure into several smaller ones)
Line 37: Line 37:
  
 
= Current config structure =
 
= Current config structure =
 +
== Town node ==
 
<pre>
 
<pre>
 
{
 
{
Line 54: Line 55:
 
"structures" : // Structures. Represents visible graphical objects on town screen.
 
"structures" : // Structures. Represents visible graphical objects on town screen.
 
[
 
[
{ "id" : -1, "animation" : "", "x" : 0, "y" : 0, "z" : 0 },
+
{ ... },
{ "id" : 0,  "animation" : "", "x" : 0, "y" : 0, "z" : 0, "border" : "", "area" : "" },
+
  ...
{ "id" : 1,  "animation" : "", "x" : 0, "y" : 0, "z" : 0, "border" : "", "area" : "" },
+
{ ... }  
{ "id" : 2,  "animation" : "", "x" : 0, "y" : 0, "z" : 0, "border" : "", "area" : "" },
 
{ "id" : 3,  "animation" : "", "x" : 0, "y" : 0, "z" : 0, "border" : "", "area" : "" },
 
{ "id" : 18, "animation" : "", "x" : 0, "y" : 0, "z" : 0, "border" : "", "area" : "" },
 
{ "id" : 19, "animation" : "", "x" : 0, "y" : 0, "z" : 0, "border" : "", "area" : "",
 
// building required for this structure to appear, default = id
 
            "requires" : [37]
 
// should be temporary workaround until we get GUI scripting.
 
// Needed for dock in Castle and mana whirpool in Dungeon:
 
// these two buildings have two sets of animation with second one used after building of specific structure
 
            "altAnim" : { "building" : 8, "group" : 1}  
 
 
],
 
],
 
"townName" : "", // localized town name.
 
"townName" : "", // localized town name.
Line 94: Line 85:
 
"buildings" : // Buildings, objects in town that affect available options
 
"buildings" : // Buildings, objects in town that affect available options
 
[
 
[
{ "id" : 0, "name" : "", "description" : "" },
+
{ ... },
{ "id" : 1,  "upgrades" : [ 0 ], "cost" : { "gold" : 1000} },
+
  ...
{ "id" : 2,  "upgrades" : [ 1 ] },  // 5-levels mage guild
+
{ ... }  
{ "id" : 3,  "upgrades" : [ 2 ] },
 
{ "id" : 4,  "upgrades" : [ 3 ] },
 
{ "id" : 19, "mode" : "autobuild" },                      // creature horde, hardcoded ID for now
 
{ "id" : 30, "requires" : [ 7 ] }  // dwelling
 
{ "id" : 37, "upgrades" : [ 30 ] }, // dwelling upgrade
 
 
],
 
],
"siege"
+
"siege" : { ... },
{
 
"towers":
 
{
 
"top" :
 
{
 
"tower" : { "x": 0, "y": 0 },
 
"battlement" : { "x": 0, "y": 0 },
 
"creature" : { "x": 0, "y": 0 },
 
"shooter" : { "name" : "", "cropHeight" : 0}
 
},
 
"keep" : { ... },
 
"bottom" : { ... }
 
},
 
"gate" :
 
{
 
"upperWall" : { "x": 0, "y": 0 },
 
"bottomWall": { "x": 0, "y": 0 },
 
 
"gate" : { "x": 0, "y": 0 },
 
"arch" : { "x": 0, "y": 0 }
 
}
 
"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"
 
{
 
"bottom" : { "x": 0, "y": 0 },
 
"top" : { "x": 0, "y": 0 },
 
"background" : { "x": 0, "y": 0 }
 
}
 
}
 
  
 
// Entries that should be replaced with autodetection
 
// Entries that should be replaced with autodetection
Line 147: Line 97:
 
"mage_guild" : 4, // maximum level of mages guild
 
"mage_guild" : 4, // maximum level of mages guild
 
"war_machine" : 4, // war machine produced in town
 
"war_machine" : 4, // war machine produced in town
 +
}
 +
</pre>
 +
== Siege node ==
 +
<pre>
 +
{
 +
"towers":
 +
{
 +
"top" :
 +
{
 +
"tower" : { "x": 0, "y": 0 },
 +
"battlement" : { "x": 0, "y": 0 },
 +
"creature" : { "x": 0, "y": 0 },
 +
"shooter" : { "name" : "", "cropHeight" : 0}
 +
},
 +
"keep" : { ... },
 +
"bottom" : { ... }
 +
},
 +
"gate" :
 +
{
 +
"upperWall" : { "x": 0, "y": 0 },
 +
"bottomWall": { "x": 0, "y": 0 },
 +
 +
"gate" : { "x": 0, "y": 0 },
 +
"arch" : { "x": 0, "y": 0 }
 +
}
 +
"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"
 +
{
 +
"bottom" : { "x": 0, "y": 0 },
 +
"top" : { "x": 0, "y": 0 },
 +
"background" : { "x": 0, "y": 0 }
 +
}
 +
}
 +
</pre>
 +
== Buildings node ==
 +
<pre>
 +
{
 +
"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
 +
// auto    - building appears when all requirements are built
 +
// special - building can not be built manually
 +
// grail  - building reqires grail to be built
 +
"mode" : "auto"
 +
}
 +
</pre>
 +
== Structure node ==
 +
<pre>
 +
{
 +
"base" : 0 // building this structure is based on
 +
"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
 
}
 
}
 
</pre>
 
</pre>

Revision as of 21:01, 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.
  • Determine location of name and descriptions (buildings or structures)
  • 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)
  • 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

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

Current config structure

Town node

{
	"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": "", // backgound scenery
	"guildWindow": "", // mages 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
	
	"creatureBackground"
	{
		"120px" : "",
		"130px" : ""
	},

	"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
	"primary_resource" : 127, // Resource produced by resource silo, 127 = wood + ore
	"mage_guild" : 4, // maximum level of mages guild
	"war_machine" : 4, // war machine produced in town
}

Siege node

{
	"towers":
	{
		"top" :
		{
			"tower" : { "x": 0, "y": 0 },
			"battlement" : { "x": 0, "y": 0 },
			"creature" : { "x": 0, "y": 0 },
			"shooter" : { "name" : "", "cropHeight" : 0}
		},
		"keep" : { ... },
		"bottom" : { ... }
	},
	"gate" :
	{
		"upperWall" : { "x": 0, "y": 0 },
		"bottomWall": { "x": 0, "y": 0 },
		
		"gate" : { "x": 0, "y": 0 },
		"arch" : { "x": 0, "y": 0 }
	}
	"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"
	{
		"bottom" : { "x": 0, "y": 0 },
		"top" : { "x": 0, "y": 0 },
		"background" : { "x": 0, "y": 0 }
	}
}

Buildings 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
	// 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
	"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
}