Jump to content

Morale System for 0 A.D


Recommended Posts


This mod adds morale system to 0 A.D. Please read an overview of morale in Wikipedia page here. This mod tries to represent military morale and to some extent also employee morale (for workers).

Morale system here is inspired from a mix between Total War and Stronghold style morale. So basically the higher the morale, the better your units at gathering, building, and fighting, and vice versa. Morale is influenced by unit's health, being attacked, being near other units, etc. On a very low morale, units will flee the battlefield.

I originally develop this mod for Happiness system in my City Building Mod, however it became more complicated so I decided to release it separately as Morale system. Therefore, this mod is designed to be as bare-boned and customizable as possible, so it will be compatible to many mods, although the mod should be quite playable as it is. 



  • Every unit has morale icon to represent its current state. 
  • Some aspects that can influence unit morale:
    • Presence of other units on viewing distance. Allies increase morale and enemies decrease morale.
    • Being attacked. Arrow shots would decrease morale, even if it missed.
    • Health increase/decrease. Morale would increase/decrease accordingly.
    • Unit death would cause significant morale decrease to nearby allies and vice versa.
  • Low morale can cause a unit to have decreased gathering rate, building rate, and attack rate. Extremely low morale cause unit to flee from enemy and became passive. Units reaching max morale would cheer and start becoming violent.
  • Structures can also have morale. Structures with low morale can have reduced attacks speed and also slower training and research time. Garrison units with high morale inside for increased morale.
  • Some variables that can be customized for further modding (mostly need to edit component variable but later planned to be customizable via template):
    • Significance (the higher unit significance the higher influence it has on nearby units)
    • Range (by default it uses unit vision but can be altered)
    • RegenRate (default morale regenerate rate)
    • etc (please look at Init function of Morale.js)


Clone or download the mod from GitHub page to My Games/0ad/mods folder. (I will add mod.io link later)


This mod is very much a work in progress. Everyone is certainly welcome to contribute by testing the mod and tell me what you think! If you found issue or have some ideas you'd like to implement, feel free to discuss here or even create Pull Request to the GitHub repo. 

I also currently have no access to a better quality computer to create high quality screenshot/video preview, so you can share your screenshots here as well!


Thank you very much to:

  • @Freagarach, @wraitii for helping out on problems I encountered with some components (see the discussion behind the scene here)
  • @Grapjasfor letting me adapt his Wounded feature from Grapejuice mod (another interesting mod you should check)
  • @wowgetoffyourcellphone for arrow morale damage suggestion and fear units (implementable by Significance, but not yet). 
Edited by azayrahmad
  • Like 7
  • Thanks 5
Link to comment
Share on other sites

Posted (edited)
On 29/3/2021 at 10:34 AM, wowgetoffyourcellphone said:

Nice. You could make the presence of a hero give a morale boost, while his/her death would cause a morale decrease. :) 

This is achievable using Significance, which multiplies morale regenerate rate effect and death instant morale damage/bonus to nearby enemies/allies. 

However I avoid editing template files for now to keep compatibility with as many Alpha versions and mods as possible. I'd probably release template changes either as separate mod or as part of City Building mod. 

Edited by azayrahmad
  • Like 1
  • Thanks 3
Link to comment
Share on other sites

  • 2 weeks later...
Posted (edited)

Recent changelog:

  • Improved fleeing behavior (low morale units flee when sighting enemy or being attacked)
  • Unit Stance change based on morale (low morale units automatically have Passive stance, high morale units have Violent stance).
  • Units reaching maximum morale will cheer.
  • Average morale display on multiple units selection in selection panel.
  • Morale for structures is now supported, complete with garrison morale effect and capture points reduction on low morale.

Plans for next updates:

  • Improve performance (currently noticeable in large battles, but should be fine on smaller maps).
  • Rage/amok behavior (raging unit attacks both ally and enemy)
  • Multipliers for specific classes (e.g. cavalry should decrease enemy infantry morale more, or camel's stench should decrease cavalry morale for allies and enemies alike).
  • Player's multiplier (players with bigger city and more kills will decrease enemies' morale more)
  • Complete morale setting differentiation of different unit types and ranks and also structures. (Higher ranks units, champions and heroes should have higher Significance and max morale)
  • Complete code documentation to make the mod easier to use as dependency for other mods.

Let me know if you guys have some more suggestions!

Edited by azayrahmad
  • Like 5
Link to comment
Share on other sites

A preview of Morale System on Gaul (me) vs Rome (AI) swordsmen fight. 0AD 24b.

Due to UnitAI that makes units in formation break formation while attacking, manual interventions are needed to ensure the Gaul swordsmen to stay in formation.

  • Thanks 4
Link to comment
Share on other sites

  • 2 weeks later...
Posted (edited)

Recent changelog:

  • Cheat codes for morale. Type 'moralize' or 'demoralize' on selected unit(s) to fill up or empty morale respectively.
  • Flank morale bonus. Units attacked from the side or behind deplete morale faster.
  • Class morale bonus. Units can have morale influence bonus on specific classes and alliance.
  • Template differentiation. Now units with different classes and ranks have different morale points and significance.
  • Code has been documented for easier modding.
  • Separate Morale and Influence. It is now possible for an entity to have influence without being affected itself.


Edited by azayrahmad
Add template differentiation
  • Like 5
Link to comment
Share on other sites

Then civs will have morale bonuses, whether they use formation or not
Romans and Greeks, with closed formations will have bonuses, on the other hand the Celts and Iberians in open formations or without formations
The naked fans and the fire cav iber will have more morale than normal if they go alone and have more than x% HP 

i love this concept 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...