Legionaries is my upcoming defense-strategy mod for Dota 2. You can read more about it here if you’re interested, since this post is about the data behind Legionaries and how it’s translated into Dota 2’s format.

So in Legionaries, each legion has six basic units that be spawned, which can each upgrade into a more powerful unit, and each unit may or may not have an ability or two. There are also other thirty waves of enemies, and twenty mercenary units that can be spawned. That’s at least 98 different units that have to be made if I want to start with four legions. Which is a lot of units to begin with, and when all unit definitions in Dota 2 (below is a single unit definition) have to be in a single file, thats a lot of scrolling in the one file. It also makes comparing units impossible, and makes it a pain to modify lots of units data in a relatively short time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"npc_legion_enemy_kobold"
{
// General
//----------------------------------------------------------------
"BaseClass" "npc_dota_creature"
"Model" "models/creeps/neutral_creeps/n_creep_kobold/kobold_c/n_creep_kobold_c.vmdl"
"ModelScale" "0.80"
"SoundSet" "n_creep_Melee"

// Upgrades
//----------------------------------------------------------------

// Status
//----------------------------------------------------------------
"Level" "5"
"StatusHealth" "40"
"StatusHealthRegen" "0"
"StatusMana" "0"
"StatusManaRegen" "0"
"HasInventory" "0"

"AttributePrimary" "DOTA_ATTRIBUTE_STRENGTH"
"AttributeBaseStrength" "0"
"AttributeStrengthGain" "0"
"AttributeBaseIntelligence" "0"
"AttributeIntelligenceGain" "0"
"AttributeBaseAgility" "0"
"AttributeAgilityGain" "0"

// Mercenary Units
//----------------------------------------------------------------
"GemsCost" "0"
"GoldIncome" "0"
"SpawnCooldown" "0"
"LevelRequired" "0"

// Armor
//----------------------------------------------------------------
"ArmorPhysical" "3"
"MagicalResistance" "0"

// Attack
//----------------------------------------------------------------
"AttackCapabilities" "DOTA_UNIT_CAP_MELEE_ATTACK"
"AttackDamageType" "DAMAGE_TYPE_ArmorPhysical"
"AttackDamageMin" "3"
"AttackDamageMax" "5"
"AttackRate" "1.00"
"AttackAnimationPoint" "0.38"
"AttackAcquisitionRange" "1200"
"AttackRange" "90"
"CombatClassAttack" "DOTA_COMBAT_CLASS_ATTACK_BASIC"
"CombatClassDefend" "DOTA_COMBAT_CLASS_DEFEND_SOFT"
"ProjectileSpeed" "0"

// Movement
//----------------------------------------------------------------
"MovementCapabilities" "DOTA_UNIT_CAP_MOVE_GROUND"
"MovementSpeed" "300"
"MovementTurnRate" "0.50"

// Bounty
//----------------------------------------------------------------
"BountyXP" "0"
"BountyGoldMin" "2"
"BountyGoldMax" "2"

// Bounds
//----------------------------------------------------------------
"BoundsHullName" "DOTA_HULL_SIZE_HERO"
"RingRadius" "70"

// Vision
//----------------------------------------------------------------
"VisionDaytimeRange" "1400"
"VisionNighttimeRange" "800"

// Team
//----------------------------------------------------------------
"TeamName" "DOTA_TEAM_NEUTRALS"
"UnitRelationShipClass" "DOTA_NPC_UNIT_RELATIONSHIP_TYPE_DEFAULT"

// Creature Data
//----------------------------------------------------------------
"Creature"
{
"DisableClumpingBehavior" "1"
"AttachWearables"
{
}
}
}

This type of data is normally handled via spreadsheets, and Legionaries is no different. All the units, abilities, and localization data is stored on spreadsheets in Google Docs. Getting this data from Google Docs to Dota is the tricky part, which is why I developed the Legion Data Tool alongside Legionaires.

The spreadsheets contain all the information I need on each unit, like health, damage, abilities, upgrades, etc. so that I can easily change and compare units and keep everything nice and simple. Similarly, heroes and abilities are also defined with their information via the spreadsheets so that data can be shared and we can reduce duplicated code. Localizations are even handled by the spreadsheets, and using Google Translate, I can automatically have my localization keys translated so that I can see a rough outline of how long strings will be for other languages when designing the UI.

The Legion Data Tool made lets you input spreadsheet IDs and tab IDs to allow the tool to connect, download the data, and process it. Processing the data involves converting all the columns from each spreadsheet to the appropriate unit, ability, or hero; and link abilities to units, upgrade units to their base counterparts, and units to their legion Commanders (heroes).

Once everything has been processed, the Data Tool runs through and generates the Dota compatible data based on template files which are built with the tool. The resulting files are ready to be dropped into the Dota folder and are usable with no extra changes. The tool also generates the appropriate Lua files for legion Commander’s spawning units, which can also be dropped into the right folder and be used immediately.

Using this tool allows me to mass update units and abilities far faster than editing one large file, or multiple files and then combining them. This faster iteration time allows me to design new units and abilities faster as I can compare them to existing units, and balancing existing units gains the same benefits.