Dominions II Combat Simulator v40 - by Saber Cherry


************
Version 40 notes:

25% speedup.  Details:

Boolean dice rolls are no longer simulated; they have been tableized.  You can see the table in the Data\StatTable.txt.  What does this mean?  To check all "yes-or-no" rolls like att vs def, MR vs penetration, morale vs morale penalty, I no longer roll 4 open-ended d6's, but generate a single random number and consult the table to see if it succeded.  This gives virtually identical results and is much faster.

Bug in v39 fixed (all units were listed as having elemental magic).

Random magic is calculated at runtime.  So if you simulate combat using units with random magic or random elemental picks, they will do slightly better, as they will sometimes get fire (+att), earth (+tprot), and air (+mirror images for units with glamour).  All 8 randoms are simulated but only those 3 affect the simulator combat.

Neverheals is now supported.  Before, it did nothing; now, neverheals units will not regain HP when fighting in "Gauntlet" mode.

************
Version 39 notes:

Improved mod importation.  Imports data like regeneration, magic skills, ethereality, and so forth.  The importation is essentially complete except for leadership values (which have no effect in the simulator) and equipment, which must be specified by name.  In other words, equipment will be imported from .dm files, but the combat sim does not yet understand item numbers, so if you specified your equipment by name (like 'weapon 56' instead of 'weapon "hoof"') you will have to change it in the converter output to use the name, rather than the number.  I know this makes it a little confusing, but perhaps I will add numeric support in the future.

How to import a mod:

The command is (assuming your mod is in my_mod.dm):

java Converter my_mod.dm
PLEASE NOTE:  The filename must contain no spaces.

The output is creatures_my_mod.dm.txt and unittypes_my_mod.dm.txt.
Copy the contents of those two files into creatures.txt and unittypes.txt in the data folder.

In order to balance-test a mod:

Do the steps above, and when you copy the contents of unittypes_my_mod.dm.txt to unittypes.txt, put them at the very top of the file.

Next, run this command:

java DataOut

This will generate some .bat files.  Running "full.bat" will show the relative melee strength of your new units to all other units included in the simulator, though it takes a long time... you can shorten the time by changing the last number in the file (2000) to something smaller like 100 - that is the number of iterations.

Alternately, you can just fight your units against the extant units, which takes much less time.  To do this, modify "full.bat" in this manner:

1) Change the second word, "Matrix", to "RectMatrix", so it reads "java RectMatrix blah blah..."

2) Your units should be listed before all the other units.  So, between the last of your new units and the first old unit, add the term " vs ", so it reads "... My_Last_Unit vs Blood_Slave Militia ...".  Then run full.bat and it will fight your units versus the others, and give their relative melee strengths.

************
Version 38 notes:

Arco added (Thanks, Pillin!)

In UnitTypes.txt, you can now specify: 
id=#
originalname=(the original Illwinter unit name)
newname=(a new name)

These are mainly for modding and don't really do anything yet

************
Version 37 notes:

Most weapon and armor ID's added.  
Pangaea normal units added.
Glamour (aka Mirror Image) support added.
Bane weapons (and decay) work correctly now, I think (decay does 1d6 open fatigue damage and 1d2 closed poison damage per turn).

************
Version 36 notes:

Some stuff changed.  Ice Age Equipment added.  Vanheim added.  Leadership added.  Preliminary shapeshifting added (does not yet work).

************
Version 32 notes:

Some weapon data corrected (number of hands for some weapons)
A defensive wakizashi added.
Abysia BOH thme added.
Rising Sun units altered.
Ambidextrous added (specify "ambidextrous=3", for example, in Creatures.txt)
Attack penalties for multi-wielding added.
Rectangular (or should I say, 'asymmetric')matrices added. For example:
"java RectMatrix PY_Velite PY_Hastatus PY_Emerald_Guard vs Ulm_Pikeneer_1 Ulm_Pikeneer_2 Ulm_Inf_Morningstar_2"
...would have each of the 3 Pythium units fight 1-on-1 against each of the 3 Ulm units, without fighting amongst themselves.  The resulting rankings would give accurate scores for Pythium versus Ulm.

Note that in RectMatrix mode, you must include the term "vs" somewhere in the command line.  In Matrix mode and Fight mode it is not needed.

************
Version 31 notes:

Faster.  An Earth magic blessing bug eliminated.

************
Version 27 notes:

Added spiky armor (length 3, poisondam 5, no physical damage, automatic hit).
Made awe work once per unit, not once per weapon.

Added the following tags:

Creatures and equipment:
twistfate, mindless, trample, hero, new, assassin, seduce, animal, spy, holy, unholy, firemagic, earthmagic, airmagic, watermagic, deathmagic, naturemagic, bloodmagic, astralmagic, randomsorcery, randomelemental, randommagic, amphibian, airshield, fireshield, astralshield, glamour, spiky, mistform

Equipment only (actually, weapons only):
flaming, freezing, shocking, undeadDamageBonus, demonDamageBonus, mindlessDamageBonus, magicbeingDamageBonus, lifelessDamageBonus, soulslay, magicslay, onlyHurtsLiving, onlyHurtsUndead

All of these are implimented except:
randomsorcery, randomelemental, randommagic, astralshield, animal (which all affect melee combat)
and the ones that don't affect combat (seduce, spy, etc)

************
Version 24 notes:

Caelum added.
Several gods added.
Flaming weapons are supported (give a weapon "flaming=8", for example, for 8 AP fire damage).
Weapons now have strengthNotAdded optionally for each damage type (physical, fire, ice, etc.)
Berserking added.  "berserker=5" makes the creature a level-5 berserker; "berserk=1" makes him start combat berserk.
Life Drain now gives back correct HP and fatigue.
Chain Cuirass stats fixed.
You can autogenerate infantry, cavalry, god, full, and extended matrix bat files by running "java Data".  If you add new units, they will automatically be included based on their stats.  However, you can also force a unit to be classified as infantry, cavalry, or god by putting "inf=1", "cav=1", and "god=1" by their creature in Creatures.txt.

A few other assorted changes=)

************
Version 23 notes:

Magic Resist saves added.

************
Version 22 notes:

Readme updated.

Adds awe, correctly models ammo-using weapons (like lances), and gives more statistical information for fights. More weapons, armor, creatures, and units are added, and now include all of the default themes for Ulm, Jotunheim, Ermor, Marignon, Atlantis, Mictlan, most of Abysia, most of Tien Chi, and most independants. A few errors were fixed, including some incorrect data (like an armor value). Bless effects were added... but they must be specified in the UnitTypes file. For example:

name=Flagellant_Fire6 creature=Flagellant weapon=Flail blessing=Blessed blessing=Fire6 blessing=Water4

Bless effects are not perfect, though! All the incremental effects are modeled, except Nature (Berserk). But the level-9 effects are only modeled for Air (Shock Resist), Earth (Natural Protection 4), and Nature (Poison Resist, Regen).

A new change: Data text files are now in a subdirectory, "Data". So if you want to add new units, change the data files in the data directory.

In summary:

What is modeled? Almost everything that effects normal units, like regeneration, lucky, ethereal, reinvigoration, poison, poison immunity, repels, being undead, life drain, being lifeless, fatigue effects (stat reduction and falling asleep), armor piercing and negating, magic weapons, elemental damage and immunity, awe, weapon ammo, and all the basic stuff.

What is not modeled (or not quite right)? Fear, chill, heat, poison clouds, spiky armor, magic resist saves, berserk, paralysis, trample, bless effects, area of effect weapons, afflictions, experience, dominion bonuses (to MR and Morale), scale effects (heat and cold scales), stat increases from magic levels.

What will never be modeled? Ranged attacks, magic attacks, routing, or any battle movements other than melee attack.

************
Version 17 notes:

A slew of bugs fixed... possibly more added? Who knows.

Elemental damages and immunities work (salamander cannot kill Abyssians, for example).

Team mode added. To specify multiple units in a group, put a number and asterisk in front (Example: 3*Tribal.Warrior means 3 tribal warriors).

Raw matrix results are output to a text file (Deathmatch Matrix Output.txt, for example) and can be imported into Excel. Just load the text file and select "delimited" and then "delimited by semicolons".

Further matrix result analysis was added.

What do the numbers mean?

"Power" is a semi-exponential ranking from 1 to 1,000,000, such that 0.1% wins gives you a 1, 50% wins gives you a 1000, and 100% wins gives you 1,000,000. In general, these are directly comparable and a unit with double the "Power" is twice as strong, unlike the win percentage scores.

"Overall" gives the unit a score based on the "Power" of other units he beats. So beating a Hydra (Gauntlet power 15400) is much more valuable than beating a Soulless (Gauntlet power 103). Essentially, "Overall" shows the ability of a unit to beat other units, with stronger units weighed more heavily.

Why do some units have high "Power" and low "Overall" scores?  That means they win a lot against weak units, but lose to tough units.

What is the difference between Deathmatch and Gauntlet?  After a battle is won, each unit is completely reset in Deathmatch mode.  In gauntlet mode, only the loser is reset; the winner never regains health, except from regeneration and lifesteal; and the winner's fatigue is only reset every 40 rounds (the max battle length in Doms II, I think).

So Deathmatch is more relevant to assassins, Arena fighting, and very short battles, while Gauntlet better simulates long battles.

The Matrix output is now sorted by units' "Overall" rating, instead of alphabetically. Is this better, or worse? It makes it a little hard to find a unit.

A few more units were added. A few unit names changed. For the latest units, see "UnitTypes.txt" or power.bat.


************

Installation:

Unzip all files in the zip to a directory, and it's ready to go.

Java must be installed on the computer (you can get it at www.java.com, though it is often preinstalled on computers.)  If it is not installed, or if you type "java" from a command prompt and get an "unrecognized command" type error, install java by downloading it at www.java.com.  To allow java to be accessible in any folder... basically, your OS must have a path to Java.exe, so you can set the Java install directory as a default OS path.

For example, in Windows XP, right click on My Computer, go to Advanced, Environment Variables, and add this to "Path": 

c:\progra~1\java\bin

or adjust according to where Java is installed (progra~1 means "program files").

My "Path" - in Windows XP - looks like this: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM;c:\progra~1\java\bin

In Windows 98 you set the path (I think) in Config.sys, or possibly autoexec.bat, with a line like "setpath=c:\progra~1\java\bin" or wherever Java.exe resides.  The correct suntax should be obvious from the other lines in config.sys.  Adding that line (in 98 or XP) will never harm your computer or keep it from booting or screw anything up, so don't worry about potential problems from doing it wrong.

If java is installed, you can still run java programs WITHOUT changing your path variables.  You do so like this:

(path)java (filename) (arguments)

For example:

c:\progra~1\java\bin\java Fight Militia Medium_Militia

The list of unit names for the simulator is in "UnitTypes.txt".

************

Usage:

Open a command prompt.  Normally you will have a shortcut that opens a command prompt window (aka "DOS box" on Windows computers), but if not, Windows users can go to start > run and type "cmd" (without quotes).

Next, go to the directory with the simulator.  For example, in Windows or UNIX, you might type:

cd c:\Dominions\CombatSim\

From there, type:

java Fight Unit_1 Unit_2 numberfights

For example:

java Fight Assassin Light_Inf_1 10000

...would fight an assassin and light infantry (the 5-resource one, with no javelin) 1-on-1 until the battle had been resolved, 10000 times. Then it displays the win percentage for the left unit (the Assassin).  The results are also appended to "Results.txt".

You can also use it like this:

java Matrix Hydra Militia_Medium Light_Inf_1 Heavy_Inf_2 10000

...which fights each of the units against each other 10000 times, and averages the results.  The results are also printed to "Deathmatch Power Rankings.txt" and "Gauntlet Power Rankings.txt".

************

Data:

"Weapons.txt" - Weapon Data
"Items.txt" - Armor and Item Data
"Creatures.txt" - Base Creature Data (like a "Human" for light and heavy infantry, "Humanbred" for various Humanbred units, etc)
"UnitTypes.txt" - Unit Data.  This merges a creature with various items and weapons; stats are calculated from this data.
"Wounds.txt" - Affliction Data (not currently used, but it will be)

Please add anything in the game to these files, and post your additions in the forum here: http://www.shrapnelgames.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=74;t=000644

The formats should be fairly straightforward.  Fields can be in any order, and unspecified fields are always 0.  For example:

name=Dagger att=5 dam=8
is the same as:
name=Dagger dam=8 att=5
and also is the same as:
name=Dagger dam=8 def=0 att=5


Stat Notes:

Creature Stats:

hp: max hit points (a.k.a. health)
att: attack
def: defense
nprot: natural protection (for creatures and items like the "barkskin amulet")
mrl: morale
mrst: magic resistance
bEnc: base encumbrance (for creatures only)
prec: precision (affects nothing...)
ap: action points (creatures only...  not important, though.)
reinvig: reinvigoration
mounted: set to "3" of the unit is mounted.  (3 is the defense bonus for being mounted).
gold: gold cost - set for creatures like Priest with an obvious gold cost (50)
res: resource cost - set for creatures like Hydra with an obvious resource cost (20)



Weapon/Item-specific stats:

att: attack bonus from the item
def: defense bonus
hp: hp bonus
str: strngth bonus
prec: precision bonus
mrl: morale bonus
mrst: magic resist bonus
reinvig: reinvigoration bonus
enc: encumbrance for a piece of equipment (do not use on creatures)
aprot: armor protection (use only on items, not creatures)
nprot: natural protection (for creatures and items like the "barkskin amulet")

hands: number of hands used by the item/weapon.  Set to 1 for shields, 1h weapons, and "fist", 2 for 2h weapons, and 0 for lances, ranged weapons, and hoof/bite/gore/kick etc.
length: length, for a weapon
hits: number of hits for the weapon
pierce: if it is armor piercing, set to 50; armor negating, set to 100
strengthNotAdded: set to 1 if strength is not added to the weapon damage
bonusVsShield: set to 1 for Morningstars or other shield-ignoring weapons
shield: set to 1 if the item is a shield
rof: rate of fire.  Ignore it, unless you have a crossbow (set to 2, meaning every 2 turns) or arbalest (set to 3, every 3rd turn)
ammo:  For lances (used once per battle) and ranged weapons, this is the max ammo.  Ranged weapons are not modelled, though.
rng: range
aoe: set to area of effect for aoe weapons (like fire flare)
magic: set to 1 if the weapon or item is magical
mrnegates: set to 1 if an MR save negates the damage
mrpenalty: set to the penalty if the MR save has a penalty
lifesteal: for lifesteal weapons, set to the % of damage converted to health.  I assume this is usually 100.
gold: ignore it...
res: set if you can figure out an item or weapon's resource cost.



Weapon Damage Stats:  Set for weapons only.

dam: weapon's physical damage
shockdam: weapon's damage from shock
firedam: weapon's damage from fire
icedam: weapon's damage from ice
poisondam: set to the poison damage for poisoned weapons.  Weak means 5, strong means 15, and death poison is 35
fatiguedam: For things like sleep vines or poisoned claw, this is the fatigue damage.
paralyzedam: For things like mind blast, the paralyze damage.  Not currently modeled.

doesPhysicalDam: if the weapon DOES NOT DO physical damage (like a Salamander's fire flare), set to -1
doesShockDam: set to 1 if the weapon does shock damage
doesFireDam: set to 1 if the weapon does fire damage (like fire flare)
doesIceDam: set to 1 if the weapon does ice damage




Attribute Notes:

regen: regeneration.  Set to % of total HP regenerated per turn, not # of HP.
ethereal: Set to 75 if unit is ethereal (meaning 75% of attacks miss)
lucky: set to 50 if lucky (meaning 50% of attacks miss)
fireproof: set to % fire resistance, or for weakeness, a negative percentage
iceproof: ditto
shockproof: ditto
poisonproof: ditto
cursed: set to 25 if cursed (25% chance of affliction per hit)
fireshield: set to shield damage
berserker: set to berserker level
berserk: set to berserker level, ONLY if the unit stats combat berserked (like for Harvest Blade)
undead:  set to 1 if undead
magical: set to 1 if magical (Creatures only)
experience: set to number of experience stars (Creatures only - for example, Orion gets experience=6)
quickness: set to a percentage bonus.  Boots of Quickness, for example, would get quickness=100
stealthy: set to stealth level.  Does not affect combat.
lifeless: set to 1 if lifeless
neverheals: set to 1 if neverheals
fear: set to fear level +5.  For example, Cause Lesser Fear -4 becomes fear=1
awe: set to awe level.
hasAwe: set to 1 if the unit has awe.  For example, a unit with Awe +0 gets "awe=0 hasAwe=1"
heat: set to squares per turn affected by heat.
chill: set to squares per turn affected by chill.
sacred: set to 1 if sacred.
blessed: set to 1 if it starts combat blessed (for the Shroud of the Battle Saint, for example)
coldblooded: set to 1 if coldblooded
flamingWeapons: set to 1 if the unit has flaming weapons (the damage is assumed to be 8 AP)
twistfate: set to 1 if the creature/item/blessing gives "Twist Fate" status
airshield: set to air shield block percentage


Note that for UnitTypes, you can only specify a base Creature, Items, Weapons, Wounds, and Blessings.  Don't try to give them stats directly.

************

Other Files and Commands:

Weapon, Item, Creature, and UnitType can be used to show the final stats for a Weapon, Item, and etc, respectively.  For example:

C:\Projects\Java\Dominions>java Weapon Poison_Dagger

Poison Dagger
dam=2, att=1, hands=1, hits=1, poisondam=15


C:\Projects\Java\Dominions>Java Item Rainbow_Armor

Rainbow Armor
aprot=8, def=1, enc=1, mrst=3, reinvig=3


C:\Projects\Java\Dominions>java Creature AB_Infantry

AB Infantry
hp=15, mrl=11, mrst=12, bEnc=2, str=13, att=10, def=9, prec=7, ap=11, gold=20, r
es=1
fireproof=100


C:\Projects\Java\Dominions>java UnitType Ulm_Inf_Hammer_1

Ulm Inf Hammer 1 (Base creature: Ulm Infantry)
hp=12, aprot=23, tprot=23, mrl=10, mrst=9, bEnc=3, str=10, att=10, def=7, prec=1
0, ap=12, enc=10, maxlength=1, gold=10, res=1

Wearing:  Hammer, Full Plate of Ulm, Full Helmet, Tower Shield,

************

The list of valid units is contained in "UnitTypes.txt". Feel free to add your own, using whatever base creatures, armor, and weapons you want!

Problems?  Email me at Saber_Marionette_Cherry@Yahoo.com or post to the Shrapnel forum here: http://www.shrapnelgames.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=74;t=000677

************

Credits:

Thanks to Zen for Jotunheim and a lot of armors and weapons!
Thanks to Univac for Atlantis, Atlantian equipment, and for hosting! 
And thanks to the devs for helping me with some formulas... and for making such a great game! ;)

-Cherry