Morale / bravery / panic system

Bug #895363 reported by Marshall
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ares
In Progress
Wishlist
Renegade

Bug Description

No prizes for why I want this!

And apologies for the wall of text, I've tried to be as concise as possible.

All units start with a Morale of 100. Morale is always between 0 and 100.
When Morale is between 50 and 100, units function normally.
When Morale is between 0 and 49 there is an increasing chance that the unit may panic (like the civilians waving their arms around) or go berserk (chaos).
When Morale is 0 the chance of the unit panicking or berserking is 100%.

Bravery= int ;between 0 and 100. Bravery affects a unit's morale loss/gain.

Events that affect morale:
A unit dies = +10 to all enemies of that unit, -20 to all friendlies of that unit. The killing unit gains an additional +20 (or -20 if it was friendly fire).
A unit is healed = +(percent of max health that the healing weapon could have restored) to just that unit (assuming medkits have stimulants, etc)
A unit is damaged = -(percent of max health lost / 2) to just that unit
A unit panics or goes berserk = +15 to just that unit (they've panicked and thus recovered a bit)

The above values are base values, which can be affected by the following:
Bravery acts as a multiplier. Multiplier to effect on Morale = 100-Bravery
So a unit with 100% Bravery gets no effect from Morale changes. A unit with 0% Bravery gets full effect from Morale changes.

Veterancy. The most veteran unit near to the person who is getting worried will reassure them, like so:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X+++++++++++++++++++++++++++++++++++++++++++++++++X
X+++++++++++++++++++++K+++++++++++++++++++++++++++X
X++++++++++++++I++++++++++++++++++++++++++++++++++X
X+++++++++++++++++#+++++++++++++++++++++++++++++++X
X+++++++++++++I+++++++++++++++++++++++++++++++++++X
X+++++++++++++++++++++++++++++++++++++++++++++++++X
X++++++++J+++++++++++++++++++++++++++++++++++++E++X
X+++++++++++++++++++++++++++++++++++++++++++++++++X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Unit # just got sniped by enemy E. Units I, I, J and K are all close enough to be upset by this, but only units I, I and K are close enough to Sergeant K to be reassured by him.

Each veterancy level of the best officer reduces the morale loss of units in range by 5%. So a rookie doesn't do anything, a veteran helps 5% and an elite helps 10%. This should be extended to multiple veterancy levels if they are added in future (which would be a nice accompaniment).

HOWEVER, an officer getting killed INCREASES morale loss, by double the amount.
So a sergenat getting killed will cause nearby friendlies to lose 22 morale, and enemies to gain 11 (33 for the unit that killed him).

There will be another thing that can affect Morale:
Use of a new Panic weapon: On the warhead, PanicAtack=yes means the attack will drain morale instead of dealing damage.
Panic weapons are not affected by the above modifiers in the usual way.
The amount of Morale drained is always equal to the weapon damage minus target Bravery.
So a Panic weapon with Damage=100 against a unit with Bravery=60 will drain 40 points of Morale.
You may want to add an anti-panic weapon, so negative damage on a panic weapon would have to disregard Bravery.

Bravery should default to 100% so that units are not affected by default.

Now, when do they panic?
Whenever a unit loses morale, if the resulting morale is below 50, the chance of them panicking is
100 - (2 x Morale).
IF the unit panics then there is a 35% chance that they will go berserk instead of simply panic.

Finally, many of these values I can see people wanting to control themselves so
[General]
Morale.Base=100
Morale.EnemyDeath=10
Morale.FriendlyDeath=-20
Morale.MyKillBonus.Enemy=20
Morale.MyKillBonus.Friend=-20
Morale.DamagedMult=0.5 ;multiplier to percent of max health lost
Morale.HealedMult=1.0 ;multiplier to potential percent of max health gained
Morale.PanicBraveryMult=1.0 ;multiplier to target bravery that will be deducted from the morale damage dealt by a panic weapon
Morale.VeteranSave=0.05
Morale.VeteranLoss=0.10
Morale.PanicThreshold=50
Morale.PanicBerserkChance=35%
Morale.PanicBerserkAmount=150 ;150 frames of chaos
Morale.PanicRecovery=15

Oh yeah, and a second health bar to indicate current morale! Like the plan for shields - so we could have green bar = health, blue bar = shields, purple bar = morale.
[Unit]Morale.DisplayBar=yes

Revision history for this message
Teleros (teleros) wrote :

Mmm, I can see this being a pain in the arse to code, especially with regard to weapons & morale damage. Do flamers do more than sniper fire (for example)?

Revision history for this message
Marshall (m-edward) wrote :

I don't think distinuishing between types of damage is important - simply based on damage received should be fine enough control.

For the sake of reducing complexity and making it less work to implement, the whole section on veterancy reassuring soldiers could be ommitted. The basic morale system + panic weapon are much more important.

Some other additions that would complement this feature:
Morale crate, like Healing, restores 100% morale to all your units
Bravery crate, boost Bravery, just like sight/firepower/armor
Bravery upgrade with veterancy, just like sight/firepower/armor

Revision history for this message
Renegade (renegade) wrote :

As someone who loves Dawn of War and the additional tactical possibilities morale brings, I am in full support of this.

So much, in fact, that I'm claiming it. ^^

It'll certainly take a while until I get around to coding it (I'm thinking Ares 0.3, but depending on how complex bug:684 turns out to be, it might get pushed to 0.5), though, and depending on feasibility, I may have to simplify it a bit.

e.g. veteran auras - while certainly a nice touch, unless D knows some dark magic I can't come up with right now, this'd require regular scanning for veteran units by all units on the map.
You can imagine how that wouldn't exactly help performance.
Of course we could invert the process and just have veterans push out experience, but that, too would require constant scanning.

One simplification I could think of here would be making it not constant, but a deployable function - easiest to implement as a deploy weapon effect, similar to Yuri's Psi Wave.

DoW implements a similar thing on Sergeants - they have a "Rally Squad" special ability which makes them call out to their squad, put them back in line and encourage them, thereby restoring their morale.

In fact, given that you already propose morale damage through PanicAttack, this would be achievable simply by dealing negative morale damage through a deploy weapon.
A drawback would, of course, be the fact that the secondary weapon slot would be occupied, and that it'd only work on chosen units, rather than all veterans.

It's possible there's an efficient way to implement the scanning that doesn't occur to me at the moment, and I'll explore that option first, but I do think that much scanning would be overkill for the game.

Is there any particular reason you want to implement PanicAttack as described, rather than having Morale.Damage=, for example?
Basically, imo, some attacks are more dreadful than others.
If I had been in battle for a year, I would probably be kind of used to people shooting bullets at me, and it wouldn't affect my morale too much...seeing some bald Transylvanians shooting fire with their minds, on the other hand, might just unsettle me.
And that's not even starting on the effect on morale losing control and being forced to fire upon my friends would have (Chaos Drone, mind control).

We could implement it so Morale.Bravery= works as an inverse multiplier to Morale.Damage=.
Would look like TrueMoraleDamage = (1.0 - Morale.Bravery) * Morale.Damage, unless my mind skipped something there - e.g.
Morale.Bravery=70%
Morale.Damage=100
TrueMoraleDamage = (1.0 - 0.7) * 100 = 30
would result in no morale damage for 100% Bravery, and full morale damage for the cowards.

Thoughts?

Revision history for this message
Marshall (m-edward) wrote :
Download full text (3.6 KiB)

Bravery as an inverse multiplier to morale damage received:
Yes, that does make more sense in RA2.

Morale.Damage
Yes, that sounds way better. Normal Damage + Morale.Damage = awesome. The finer adjustment for specific weapons being more scary does make much more sense put that way.
Further to that, we wouldn't then need any separate morale adjustment events for taking damage/being healed - units with more Strength should just be given a relatively higher Bravery than someone with lower Strength (i.e. tanks should be more brave because their driver is better protected), and healing weapons can dictate how much stimulant they provide.
So a unit with Bravery=20 hit by a weapon with Morale.Damage=10 would lose 8 morale points per hit from the weapon.
Verses should not affect Morale.Damage, however CellSpread and PercentAtMax should!

Veterans mitigating morale loss
I think this is a pretty minor thing compared to the rest of the system and also a bit complicated. Wish I hadn't mentioned it now!
Heroes using a morale-boosting weapon instead would be just fine.
HOWEVER, I have a new idea to simplify this and have Bravery affect the morale events (see very end of this note).

===========================================
===========================================
===========================================
So, to draw a line under the above and reiterate the proposals for this new system as simply as possible:

All units (except BuildingTypes) start with Morale=100 and always have between 0 and 100. This is not an INI flag.
All units have a Bravery= flag, between 0.0 and 1.0, defaults to 0.
Warheads have a Morale.Damage= flag that dictates how many Morale points to drain from the targets hit (default 0, can be negative to restore Morale).
Morale points drained from a target = Morale.Damage * (1.0-Bravery)
Unaffected by Verses/Prone/etc but should be affected by CellSpread and PercentAtMax.

[General] ;for morale events that are not related to Morale.Damage warheads
Morale.CellSpread=10 ;the CellSpread to use to find units that will be affected by another unit dying (-1 = infinite range, 0 = disable non-weapon morale events)
Morale.EnemyDeath=10 ;morale points gained (before Bravery modifier) when an enemy dies within Morale.CellSpread
Morale.FriendDeath=-20 ;morale points gained (before Bravery modifier) when a friend dies within Morale.CellSpread
Morale.NeutralDeath=-10 ;do we need this? how to distinguish between NeutralPassive and NeutralHostile? I'm thinking civilian casualties here
Morale.MyKillMult=3.0 ;multiplier to above morale gains if the unit gaining morale was the person who did the killing
Morale.PanicThreshold=50 ;Morale below which a unit has a chance to panic/berserk (0% chance at 50, 100% chance at 0)
Morale.BerserkChance=35% ;chance that a panicking unit will go berserk instead of just panic
Morale.PanicDuration=150 ;number of frames that a panicking/berserking unit will be panicked/berserk for

Bravery also needs to affect the death events - if a friendly unit dies with high Bravery then they should be a bigger loss to Morale (I'm thinking that a Tank loss will be more upsetting and a Building los...

Read more...

Revision history for this message
Teleros (teleros) wrote :

What about morale regeneration rates? Eg:

Morale.CombatRegen= ;either integer for Morale per second / per X frames, or % of total morale per second / X frames.
Morale.SafeDelay= ;time delay before next tag takes effect. Reset if you take damage, fire weapons etc.
Morale.SafeRegen= ;presumably higher than Combat.Regen.

Unless you go to the trouble of having a variety of morale-regenerating units in a mod, I can see this being an issue after say a battle. You'll have a bunch of tanks & infantry with low (or at least not 100%) morale, even with max health, which will actually put you at a disadvantage to someone who's army got wiped out and has built a new one.

Revision history for this message
Marshall (m-edward) wrote :

If a squad survives a battle then they should have fairly good morale, depending on the settings you've used for the system, although a regen property for the unit might be a good idea. But you would only need 1 flag - Morale.RegenDelay=frames before 1 morale point is regenerated. (keep it nice and simple)

Revision history for this message
Renegade (renegade) wrote :

Would you like fries with that?

In all seriousness, as said above, I may simplify this when I implement it.
I'm just a slave to the engine and my own (lack of) skill, after all.

Revision history for this message
WoRmINaToR (worminator) wrote :

---"All units (except BuildingTypes) start with Morale=100 and always have between 0 and 100. This is not an INI flag."

I don't think this is the way to go. What if I wanted only infantry to be affected by morale, and not vehicles? It would be more complicated for the game to process a unit with Morale=100 and Bravery=100 than just a unit with no morale effects at all.

And really, right now, all we need to do is get the basic "weapons do morale damage, which impacts the unit's effectiveness, and then that morale can auto-regenerate over time when not in battle"

That's the first step, as that is the most basic system that can be accomplished for this functionality.

[WEAPON]
Morale.Damage=X
[TECHNOTYPE]
Morale=X
Morale.Bravery=X (Tapers morale damage, as discussed)
Morale.RegenRate=X (This could either be like a ROF, delay in frames between each point restored, or a number that specifies the rate, like with Speed=)
Morale.RegenDelay=x (This would be how long the soldier has to be away from combat (particularly morale-damaging weapons) to start regenerating morale)

I think for basic functionality, this is all that is really necessary. For morale-boosting sergeants, what is wrong with just having one specific sergeant unit in the training list that can go out there and boost morale? That's what it was like in DoW, be it that it was an add-on squad member.

Revision history for this message
Bug Importer (bug-importer) wrote :

what handicap will have a unit with low morale? for example i was thinking that a unit with low morale would flee from battle, i was thinking it because a game called american conquest xP they ran to the fortress(barracks maybe) also because there is a new usa weapon the heat-ray gun that makes angry mobs flee well it is in this page :P

http://www.http://www.thewe.cc/contents/more/archive/sound_as_weapon.html

it also may delay the enemy unit, as the function of a machinegunner, they shoot and shoot, so the enemy cant get out of where they are and they cant shoot, also i was thinking that maybe a unit can have an aura, not only for morale but also for rate of fire or damage

Revision history for this message
Renegade (renegade) wrote :

Fleeing is a nice idea, actually...I'll see if I can trigger that via API when I implement this. ^^

Revision history for this message
Marshall (m-edward) wrote :

I thought fleeing was already part of my suggestion?
[quote]
Morale.PanicThreshold=50 ;Morale below which a unit has a chance to panic/berserk (0% chance at 50, 100% chance at 0)
Morale.BerserkChance=35% ;chance that a panicking unit will go berserk instead of just panic
Morale.PanicDuration=150 ;number of frames that a panicking/berserking unit will be panicked/berserk for
[/quote]

Revision history for this message
Bug Importer (bug-importer) wrote :

well, panic doesnt means flee really, also i dont know about fleeing, lets suppose we send him to barracks when he flees, if there is no barracks, where would he go? or we write fleeingtarget=BARRACKS,HOME and what if there is no home? :S i think that it also would be good to add 2 kinds of panic, the panic that delivers the machinegunner(1rst panic), units in panic cant shoot, move slowly and receive less damage and if the infantry has too much panic, it switch to the second panic and then they flee, but if there is nowhere to flee they keep with the first panic

(it would be good if first panic panics people inside buildings, if the building is full of soldiers it wont prevent buildings from shooting but it will shoot less people)
(also maybe there would be a good idea if there is just the first panic, and the second panic would be optional like a button somewhere or a hotkey to send the infantry to retreat for example, there is a infantry in panic, and i have maybe an helicopter near, i can save them, or maybe they are alone and i have no units near, then if i dont sound the retreat they will eventually die

Revision history for this message
Renegade (renegade) wrote :

I wasn't actually considering it that complex...I think before, I had considered just placing the infantry in panic mode, and yesterday, I was wondering if there is an actual "fleeing" mission for the AI - even if there isn't, I could simulate that by putting the unit into a strong "head back to base" mission or something.

Ultimately, this is scheduled for 0.3, so nothing, especially not the implementation details, is fixed yet.

Revision history for this message
Bug Importer (bug-importer) wrote :

i suggest to have two panics,(sorry for my obstinacy XP) that would be customizable from the weapon, it would have many uses, for example a flashbang or a machinegun supressive fire, panic 2, and a tear gas or a heat ray tank panic 1 in a great magnitude, and normal weapons just a little magnitude in both

Revision history for this message
Firefly (firefly) wrote :

IMO it would be almost impossible to adjust moral.damage and bravery correctly

to much moral.damge and your units will freak out constantly.
this would mess up the gameplay.

to less and they will die before they have the chance to go crazy.
this would make the feature useless

therefore, i do not support that feature

Revision history for this message
Marshall (m-edward) wrote :

Well the values I suggested are based on the actual values used in UFO Enemy Unknown - different game I know, but some basis on a working model.

Revision history for this message
Bug Importer (bug-importer) wrote :

what about if every unit gives morale or maybe units give morale if at least 5 units are near, my idea is for that the infantry flees if there are few soldiers in battle

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.