Difference between revisions of "Creature Format"

From VCMI Project Wiki
Jump to: navigation, search
m (syntaxhighlight)
Line 7: Line 7:
  
 
Json schema (see http://json-schema.org/)
 
Json schema (see http://json-schema.org/)
<pre>
+
<syntaxhighlight lang="javascript">
 
{
 
{
 
"type" : "object",
 
"type" : "object",
Line 365: Line 365:
 
}
 
}
 
}
 
}
</pre>
+
</syntaxhighlight>
  
 
long version (83 lines):
 
long version (83 lines):
<pre>
+
<syntaxhighlight lang="javascript">
 
{
 
{
 
     "creatureName" : // should be camel case version of interface name. Examples: Pikeman, RoyalGriffin. Do not change after its released
 
     "creatureName" : // should be camel case version of interface name. Examples: Pikeman, RoyalGriffin. Do not change after its released
Line 470: Line 470:
 
     // more creatures
 
     // more creatures
 
}
 
}
</pre>
+
</syntaxhighlight>
 
pikeman long (39 lines):
 
pikeman long (39 lines):
<pre>
+
<syntaxhighlight lang="javascript">
 
{
 
{
 
     "Pikeman" :
 
     "Pikeman" :
Line 530: Line 530:
 
     }
 
     }
 
}
 
}
</pre>
+
</syntaxhighlight>

Revision as of 15:02, 14 December 2012

See thread http://forum.vcmi.eu/viewtopic.php?t=533 for discussion.

todo:

  • remove deprecated attributes once implemented in town config

Creature abilities use Bonus Format.

Json schema (see http://json-schema.org/)

{
	"type" : "object",
	"additionalProperties" :
	{
		"type" : "object",
		"additionalProperties" : false,
		"properties" :
		{
			"name" :
			{
				"type" : "object",
				"additionalProperties" : false,
				"properties" :
				{
					"singular" :
					{
						"type" : "string"
					},
					"plural" :
					{
						"type" : "string"
					}
				}
			},
			"level" :
			{
				"type" : "integer"
			},
			"faction" :
			{
				"type" : "string"
			},
			"cost" :
			{
				"type" : "object",
				"additionalProperties" :
				{
					"type" : "integer",
					"minimum" : 0
				}
			},
			"fightValue" :
			{
				"type" : "integer",
				"minimum" : 0
			},
			"aiValue" :
			{
				"type" : "integer",
				"minimum" : 0
			},
			"growth" :
			{
				"type" : "integer",
				"minimum" : 1
			},
			"hitPoints" :
			{
				"type" : "integer",
				"minimum" : 1
			},
			"speed" :
			{
				"type" : "integer",
				"minimum" : 0
			},
			"attack" :
			{
				"type" : "integer",
				"minimum" : 0
			},
			"defence" :
			{
				"type" : "integer",
				"minimum" : 0
			},
			"shots" :
			{
				"type" : "integer",
				"minimum" : 0,
				"default" : 0
			},
			"spellPoints" :
			{
				"type" : "integer",
				"minimum" : 0,
				"default" : 0
			},
			"doubleWide" :
			{
				"type" : "boolean",
				"default" : false
			},
			"damage" :
			{
				"type" : "object",
				"additionalProperties" : false,
				"properties" :
				{
					"min" :
					{
						"type" : "integer",
						"minimum" : 0
					},
					"max" :
					{
						"type" : "integer",
						"minimum" : 0
					}
				}
			},
			"advMapAmount" :
			{
				"type" : "object",
				"additionalProperties" : false,
				"properties" :
				{
					"min" :
					{
						"type" : "integer",
						"minimum" : 0
					},
					"max" :
					{
						"type" : "integer",
						"minimum" : 0
					}
				}
			},
			"upgrades" :
			{
				"type" : "object",
				"additionalProperties" :
				{
					"type" : "boolean"
				}
			},
			"graphics" :
			{
				"type" : "object",
				"additionalProperties" : false,
				"properties" :
				{
					"animation" :
					{
						"type" : "string"
					},
					"timeBetweenFidgets" :
					{
						"type" : "number",
						"default" : 1.0
					},
					"troopCountLocationOffset" :
					{
						"type" : "integer",
						"default" : 0
					},
					"animationTime" :
					{
						"type" : "object",
						"additionalProperties" : false,
						"properties" :
						{
							"walk" :
							{
								"type" : "number",
								"default" : 1.0
							},
							"attack" :
							{
								"type" : "number",
								"default" : 1.0
							},
							"flight" :
							{
								"type" : "number",
								"default" : 1.0
							}
						}
					},
					"background" :
					{
						"type" : "object",
						"additionalProperties" : false,
						"properties" :
						{
							"120" :
							{
								"type" : "string",
								"default" : ""
							},
							"130" :
							{
								"type" : "string",
								"default" : ""
							}
						}
					},
					"missile" :
					{
						"type" : "object",
						"additionalProperties" : false,
						"properties" :
						{
							"animation" :
							{
								"type" : "string",
								"default" : ""
							},
							"spinning" :
							{
								"type" : "boolean",
								"default" : false
							},
							"offset" :
							{
								"type" : "object",
								"additionalProperties" : false,
								"properties" :
								{
									"upperX" :
									{
										"type" : "integer",
										"default" : 0
									},
									"upperY" :
									{
										"type" : "integer",
										"default" : 0
									},
									"middleX" :
									{
										"type" : "integer",
										"default" : 0
									},
									"middleY" :
									{
										"type" : "integer",
										"default" : 0
									},
									"lowerX" :
									{
										"type" : "integer",
										"default" : 0
									},
									"lowerY" :
									{
										"type" : "integer",
										"default" : 0
									}
								}
							},
							"frameAngles" :
							{
								"type" : "array",
								"additionalItems" : false,
								"items" :
								{
									"type" : "number"
								}
							}
						}
					}
				}
			},
			"sound" :
			{
				"type" : "object",
				"additionalProperties" : false,
				"properties" :
				{
					"attack" :
					{
						"type" : "string",
						"default" : ""
					},
					"defend" :
					{
						"type" : "string",
						"default" : ""
					},
					"killed" :
					{
						"type" : "string",
						"default" : ""
					},
					"move" :
					{
						"type" : "string",
						"default" : ""
					},
					"moveStart" :
					{
						"type" : "string",
						"default" : ""
					},
					"moveEnd" :
					{
						"type" : "string",
						"default" : ""
					},
					"shoot" :
					{
						"type" : "string",
						"default" : ""
					},
					"wince" :
					{
						"type" : "string",
						"default" : ""
					}
				}
			},
			"abilities" :
			{
			    "type" : ["object", "null"],
			    "additionalProperties" :
			    {
			        "type" : "object",
			        "additionalProperties" : false,
			        "properties" :
			        {
			            "type" :
			            {
			                "type" : "string"
			            },
			            "subtype" :
			            {
			                "type" : "integer"
			            },
			            "value" :
			            {
			                "type" : "integer"
			            },
			            "valueType" :
			            {
			                "type" : "string"
			            },
			            "addInfo" :
			            {
			                "type" : "integer"
			            },
			            "effectRange" :
			            {
			                "type" : "integer"
			            },
			            "description" :
			            {
			                "type" : "string",
			                "default" : ""
			            }
			        }
			    }
			}
		}
	}
}

long version (83 lines):

{
    "creatureName" : // should be camel case version of interface name. Examples: Pikeman, RoyalGriffin. Do not change after its released
    {
        // mandatory
        "name" :
        {
            "singular" : "",
            "plural" : ""
        },
        "level" : 0,
        "faction" : "", // config name of faction. Examples: Castle, Rampart
        "cost" : // cost, zero values can be omitted. Keys are the ids of the resources
        {
            "Wood" : 0,
            "Mercury" : 0,
            "Ore" : 0,
            "Sulfur" : 0,
            "Crystal" : 0,
            "Gems" : 0,
            "Gold" : 0
        },
        "fightValue" : 0,
        "aiValue" : 0,
        "growth" : 0,
        "hitPoints" : 0,
        "speed" : 0,
        "attack" : 0,
        "defence" : 0,
        "damage" :
        {
            "min" : 0,
            "max" : 0
        },
        "advMapAmount" :
        {
            "min" : 0,
            "max" : 0
        },
        "graphics" :
        {
            "animation" : "" // name of def file
        },

        // optional
        "upgrades" : [], // keys are names of creatures that this can be upgraded to
        "doubleWide" : false,
        "shots" : 0,
        "spellPoints" : 0,
        "abilities" :
        {
        },
        "graphics" :
        {
            "timeBetweenFidgets" : 1.00,
            "troopCountLocationOffset" : 0,
            "attackClimaxFrame" : 0,
            "animationTime" :
            {
                "walk" : 1.00,
                "attack" : 1.00,
                "flight" : 1.00
            },
            "background" :
            {
                "120" : "", // if empty, uses faction background
                "130" : ""  // if empty, uses faction background
            },
            "missile" :
            {
                "animation" : "", // name of def file for missile
                "spinning" : false,
                "offset" :
                {
                    "upperX" : 0,
                    "upperY" : 0,
                    "middleX" : 0,
                    "middleY" : 0,
                    "lowerX" : 0,
                    "lowerY" : 0
                },
                "frameAngles" : []
            }
        },
        "sound" : // names of sound files
        {
            "attack": "",
            "defend": "",
            "killed": "",
            "move": "",
            "shoot" : "",
            "wince": "",
            "moveStart" : "",
            "moveEnd" : ""
        },

        // deprecated, move to town config
        "hordeGrowth" : 0, // growth bonus from horde building
        "turretShooter" : false // if used in turret
    },
    // more creatures
}

pikeman long (39 lines):

{
    "Pikeman" :
    {
        "name" :
        {
            "singular" : "Pikeman",
            "plural" : "Pikemen"
        },
        "level" : 1,
        "faction" : "Castle",
        "upgrades" :
        {
            "Halberdier" : true
        },
        "cost" :
        {
            "Gold" : 60
        },
        "fightValue" : 100,
        "aiValue" : 80,
        "growth" : 14,
        "hitPoints" : 10,
        "speed" : 4,
        "attack" : 4,
        "defence" : 5,
        "damage" :
        {
            "min" : 1,
            "max" : 3
        },
        "advMapAmount" :
        {
            "min" : 20,
            "max" : 50
        },
        "abilities" : // this is subject to change
        {
            "CHARGE_IMMUNITY" : {}
        },
        "graphics" :
        {
            "animation" : "CPKMAN.DEF",
            "animationTime" :
            {
                "walk" : 1.15
            }
        },
        "sound" :
        {
            "attack": "PIKEATTK.wav",
            "defend": "PIKEDFND.wav",
            "killed": "PIKEKILL.wav",
            "move": "PIKEMOVE.wav",
            "wince": "PIKEWNCE.wav"
        }
    }
}