The format was based on a couple of requirements which I found important:
- no numerical ids. They make combining mods impossible because they might want the same id. This is improbable with names. Names are also easier to read. You always know which creature is meant. With ids you have to look up the id.
- support multiple files with creatures. This is important for mods, otherwise mods need to include all of the creatures from the original game if they want to add one creature. Some of the original formats do not include an id. Instead they use the order in the file. This is impossible if you want to have many files with creatures. The old formats make combining mods impossible.
- flexible but backward-compatible. This means that VCMI can add new optional attributes for creatures but old files still work. This can be done with json. If the attribute is missing just use the default value. This is not possible using the original formats because they are based on a table and adding columns is not possible.
- good support for default values. The above includes all the attributes to specify the format. No creature will need all of the attributes.
- easy to mod existing creatures. This would be supported by only including the attributes you want to change. If you only want to change the Pikeman’s attack to 10, just make the file:
{
"Pikeman" :
{
"attack" : 10
}
}
Here is the same Pikeman without the comments and using a slightly modified format (a bit smaller). The cost is the only thing that lost flexibility. It is now not possible to define new resources (metal, …) because the number of resources is fixed to 7.
{
"Pikeman" :
{
"names" : "Pikeman", "Pikemen"],
"level" : 1,
"faction" : "Castle",
"upgrades" : "Halberdier",
"cost" : [0, 0, 0, 0, 0, 0, 60],
"fightValue" : 100,
"aiValue" : 80,
"growth" : 14,
"hitPoints" : 10,
"speed" : 4,
"attack" : 4,
"defence" : 5,
"damage" : [1, 3],
"amm" : [20, 50],
"abilities" :
{
"CHARGE_IMMUNITY" : {}
},
"defFile" : "CPKMAN.DEF",
"animationTimeWalk" : 1.15,
"soundAttack": "PIKEATTK.wav",
"soundDefend": "PIKEDFND.wav",
"soundKilled": "PIKEKILL.wav",
"soundMove": "PIKEMOVE.wav",
"soundWince": "PIKEWNCE.wav"
}
}
For reference, here is everything about the Pikeman in the old formats (I probably missed some things…):
{
"name": "Pikeman",
"attack": "PIKEATTK.wav",
"defend": "PIKEDFND.wav",
"killed": "PIKEKILL.wav",
"move": "PIKEMOVE.wav",
"wince": "PIKEWNCE.wav"
}
1.00 1.15 1.00 1.00 0 0 0 0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 Pikeman
{
"id": 0,
"level": 1,
"name": "Pikeman" ],
"faction": 0,
"upgrades": [1],
"ability_add": "CHARGE_IMMUNITY", 0, 0, 0 ] ], //pikeman immunity to Champion charge bonus
"defname": "CPKMAN.DEF"
}
0 S + 0 0 0 0 1 1 1 1 1 1 1 Pikeman: Speed R4
0 f B 2 2 2 2 2 1 1 1 1 1 1 Pikeman: 2-hex (Breath) Attack R5
0 h #66 0 0 0 2 2 3 3 4 4 5 6 Pikeman: Hatred Dmg-Black Knight
0 h #67 0 0 0 2 2 3 3 4 4 5 6 Pikeman: Hatred Dmg-Dread Knight
0 f f 0 0 0 0 0 1 1 1 1 1 1 Pikeman: Fearless R5
Pikeman Pikemen 0 0 0 0 0 0 60 100 80 14 0 10 4 4 5 1 3 0 0 20 50 "Immune to Champion charge bonus." 0