Loggy's Experience reverse engineering notes
Experience separates old units from new units, and provides incremental increases to certain combat stats.
Any non-mindless unit will gain 1xp each turn that they're alive.
Entering appropriate sites (commander and troops under command) will give extra xp per turn, but the amount depends on site in question.
Experience granting items give the appropriate amount each turn (on top of survival and being in certain sites), but NOT to
Animals.
Wishing for experience grants some amount I haven't determined (apparently 500).
Winning the arena gives 100 xp.
Adventure sites grant 20 xp per turn that you're in them.
Mummification may add together the experience values of the two parts of the mummy bundle, I don't yet understand this properly.
Attacking in melee grants 1 xp. Your melee kills are kept track of separately from your total kills, both of which can be seen by clicking on the stat.
Each square that you
Trample grants 1 xp. Squashing a unit underfoot counts as a melee kill, by the way.
Events can alter experience.
Certain shapechanging will remove xp when changing shape, such as mounts losing their riders.
Units that retreated in battle gain 1 xp.
Units that didn't retreat instead get 4 xp.