ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
Inspired by wub's thread on the Heroes Community forums, http://heroescommunity.com/viewthread.php3?TID=47397
2
Results obtained from script written in tcl, previous versions:
3
2022-06-21
https://pastebin.com/xqP4hxrN
4
2022-07-06
https://pastebin.com/hHvbu7FV
5
2022-07-28
https://pastebin.com/pwYuvchJ
6
2026-02-17
https://pastebin.com/wvWann0T
https://pastebin.com/4tgCHG65
Uploaded in two pastes because otherwise it triggers the "smart" filter
7
2026-08-14
https://github.com/Wouldee/HOMM3-Creature-comparison/tree/master
8
to run the script, you'll need a Tcl compiler installed
9
Windows: either https://core.tcl-lang.org/tcl/download or https://www.activestate.com/products/tcl/
10
linux: apt install tcl
11
you'll also need to download the three creature sheets from here as csv files, and name them "creatures-hota.csv", "creatures-sod.csv", and "creatures-roe.csv"
12
save the tcl script in the same folder as e.g battle tcl, and then run via the command line "tclsh battle.tcl"
13
14
How x,y,z coordinates work for the two-dimensional battlefield:
0,0,0 is the centre
y = 0 is a horizontal line; top row is y = -5, bottom row is y = +5
x = 0 runs from upper right to lower left; max x in bottom right corner is 10, min x in top left corner is -9
z is the mirror of x
x = y + z for any valid coordinate
15
16
Main battle logic
17
Decision logic (from "proc do_auto_action"), applied whenever it's a creature/unit/stack's turn to perform some action
18
creature = the creature performing the action, enemy = the opponent
19
distance = the distance required to move from one battlefield cell to another, so if there's one cell separating the two units, then the distance is actually 2
20
A battle to the death is where each creature just takes turn melee attacking the other, no waiting, no defending, no moving, no shooting
21
A full battle simulation simulates the entire battle as if a creature had chosen a particular action, including this logic recursively in any subsequent rounds
22
23
The creature is ranged if either of the following is true:
24
it has a ranged attack, and has any shots left
25
it can attack and return (i.e harpies)
26
If the creature is currently hypnotized: move to an adjacent unoccupied square
27
If the creature has a spell it can use (i.e Faerie Dragon, and the enemy is not immune): cast spell
28
If the creature is ranged and either the distance is greater than 1, or the creature is faster than the enemy:
29
choose a ranged action; or
30
engage in melee battle
31
otherwise:
32
choose a melee action; or
33
engage in melee battle
34
35
Ranged action logic
36
creature can wait if all of the following is true:
37
the creature has not yet waited
38
the creature is not slower than the enemy
39
either the creature is faster than the enemy, or the enemy has not already acted
40
the range of the creature/enemy is either 10, for ranged creatures, or the speed of the creature + 1 for harpies
41
42
if the creature can wait, and the distance is greater than the creature's range, and the enemy is not ranged, and the distance is greater than the enemy's speed + 1: wait
43
if the enemy is ranged, and the distance is greater than 1, and the creature is a harpy/harpy hag:
44
if the enemy is within striking distance:
45
if this is HoTA: attack and don't retreat
46
otherwise: move adjacent to the enemy
47
Otherwise: move closer to the enemy, with the minimum number of moves, without moving within the enemy's range if possible
48
If enemy is also ranged and distance is greater than 1:
49
simulate a battle to the death, both creatures using their ranged attack - who wins?
50
if the creature would win: use ranged attack
51
If the distance is greater than the creature's range, but not greater than the enemy's range:
52
if the creature can wait: wait
53
otherwise: move within range if possible, otherwise as close as possible
54
otherwise:
55
simulate approaching the enemy and engaging in melee battle - who wins?
56
if the creature would win:
57
if the enemy is within striking distance: attack (melee)
58
Otherwise: move closer to the enemy, with the minimum number of moves, without moving within the enemy's range if possible
59
otherwise: use ranged attack
60
if the distance is greater than the enemy's speed + 1: use ranged attack
61
otherwise:
62
simulate a melee battle to the death - who wins?
63
if the creature would win:
64
if the distance is 1: engage in melee battle
65
otherwise: use ranged attack
66
otherwise:
67
if one attack will kill the enemy: use ranged attack
68
otherwise:
69
choose a kiting action, or
70
if the distance is greater than 1: use ranged attack
71
otherwise: engage in melee battle
72
73
Melee action logic
74
creature can wait if all of the following is true:
75
the creature has not yet waited
76
the creature is not slower than the enemy
77
either the creature is faster than the enemy, or the enemy has not already acted
78
creature can move if not affected by binding (from dendroids)
79
The creature is ranged if either of the following is true:
80
it has a ranged attack, and has any shots left
81
it can attack and return (i.e harpies)
82
the range of the enemy is either 10, for ranged enemies, or the speed of the enemy + 1 for harpies
83
84
if the creature can wait, and the enemy is not ranged, and the distance is greater than the enemy's speed + 1: wait
85
if the creature can wait, and the enemy is ranged, and the enemy is not within striking distance, and the distance is greater than the enemy's range: wait
86
if the enemy is not ranged, and the enemy is not within striking distance, but the enemy can reach the creature:
87
simulate a battle to the death, assuming the enemy gets a free attack, and then attacks first in each subsequent round - who wins?
88
if the creature would win: move towards the enemy, ideally moving the enemy into range, and maximising the number of hexes within range of both the creature and the enemy
89
otherwise: defend
90
if the enemy is not within striking distance:
91
Determine how close to move to the enemy:
92
If the enemy has a ranged attack, and the distance to the enemy is greater than the enemy's range penalty distance, and if moving as far as possible would move the creature to less than the enemy's range penalty distance:
93
If moving to just outside the enemy's range penalty distance would not require additional moves to reach the enemy's current location: move to just outside the enemy's range penalty distance
94
Otherwise: move as close as possible
95
If the enemy does not have a ranged attack, and the enemy cannot reach the creature in one turn, and moving as close as possible would put the creature within the enemy's striking distance: move to just outside the enemy's movement distance
96
Otherwise: move as close as possible to the enemy
97
If the distance to move is zero, and the enemy is not ranged, and the creature and the enemy have the same speed:
98
In a battle to the death, if the enemy attacks first, who wins
99
If the creature would: move forward as far as possible
100
Otherwise: