SP Native Battle Morale (v1.5 for 0.960Native)

正在查看此主题的用户

Chel

Master Knight

Battle Morale v1.5 for 0.960 Native

Download(15MB): https://www.mbrepository.com/file.php?cid=1&id=784

This is version 1.5 of Battle Morale modded into 0.960 Native.
It is a system that tracks the situation on the battlefield as well as player's contribution to the fight.
In a few words, if one of the sides is heavily overpowering the other, the losing side will rout.
Heavily wounded soldiers are more likely to flee the fight as well.
The player can see the cohesion of each side and health of his troops with 'T' key,
he can rally his troops with 'Y' key,
and call in reinforcements with 'U' key.

For more details on how it all works see below.

Currently morale does not apply to siege battles.

Install this as a separate mod by extracting into your modules folder.


----------------------------------------



Battle Morale

clipboard02aw7.jpg



I came up with a simple battle morale (and troop healthbars) system. It makes fights more interesting and dynamic. Routed units retreat as far as they can, still fighting off attackers who pursue them, but less effective, not helping the main group, and are generally easy prey. Routed cavalry runs away even faster so doesn't contribute almost any last sword swings to their side.

----
A video showcasing the system (30MB):
https://www.mbrepository.com/file.php?cid=6&id=741
Youtube version (lower quality, less clear what is happening):
http://www.youtube.com/watch?v=QfFr6wC8HTY

----

Battle Morale, detailed explanation (updated for v1.4)

Cohesion
Both sides in battle has a cohesion rating, the average health of the army. For example ten fresh troops have 100% cohesion. If two are killed, the cohesion rating drops to 80%. If four of the remaining eight are wounded to 50% health, the cohesion rating drops to 60%. The cohesion rating is continuously being tracked, and in general lower rating will cause the troops to rout and flee. A group of peasants has the same cohesion as a group of knights to start with, but because knights have more hitpoints and better armor, the peasants will lose cohesion much faster, and therefore run from the fight much sooner.

In addition, troops with high level have a larger effect on cohesion than lower level troops (the multiplier is equal to one tenth of their level). So for example a group of 2 peasants (level 5) and 2 knights (level 25) has 100% starting cohesion. If one of the peasants dies, it drops to 91%. If one of the knights dies instead, it would drop to 58%. Raw recruits are going to be much more likely to rout if the veterans who are with them are being killed off, and veterans aren't going to be bothered very much if the recruits are getting slaughtered. This also means you can cause more cohesion damage to an army by killing its Lord/King (who are very high level), and taking the easy targets of recruits will not affect cohesion very much.

Bravery Bonus
If the player character is actively participating in battle and killing many enemies, his troops are inspired by his bravery and are less likely to abandon him. The cohesion rating of the player's troops receives a bonus equal to half the number of enemies killed by the player in the ongoing battle.

Morale Check
Both sides have morale checks every 10 seconds. If the cohesion is below 80%, a check is made to see if the morale wavers. The chance of that happening is 5% at 80% cohesion up to 85% at 0% cohesion. So that as the battle goes on and cohesion of both sides drops due to wounds and casualties, morale of troops starts to waver more and more, as they become reluctant to continue the bloodbath.

Fleeing Troops
If the morale wavers, each troop decides whether to flee or not. The decision depends on their health. Those with full health will not flee (0% chance), and heavily wounded are more likely to flee (at 1% life the chance to flee is 33%). Player's Leadership score is a slight bonus. Overall this effect is small, only few wounded troops are likely to flee the battle every so often. Higher level troops are less likely to flee the fight. The exact formula is for the chance of fleeing is
1/2 * (100 - ([troop's health] + [troop's level]/10 + [player's leadership]))

Routing
If the cohesion of one side becomes greater than the cohesion of another by 40 or more (in a siege by 60 or more), the losing side is routed. A check for this is made every 4 seconds. This effect allows powerful blows to one of the sides, such as knight charges or archer volleys to rout the enemy. Or in case of an uneven matchup, when one side is easily winning the battle, the losing side will be routed before they are all killed.

Once one of the sides is routed, every troop makes the decision to run or keep fighting. It is very similar to the fleeing decision, but with much greater chances of routing, even for troops with full health. Player's Leadership value is a significant bonus in this case.
The exact formula is for the chance of routing is
100 - (1/3*([troop's health] ) + [troop's level]/10 + [player's leadership])

Battle Cry
The player can use a Battle Cry combat ability (press Y) once in every battle. It inspires the troops to keep fighting, increases overall cohesion, and can help rout the enemy. Wounded troops get a small bost to health that is dependant on player's Leadership skill. Then every troop makes a decision whether to rejoin the fight at the player's call or not, depending on his health.
The exact formula for percent health increase is
10 + [player's leadership]

Rally Check
A Rally Check is made every 8 seconds. Every troop makes a decision whether to rejoin the fight not, depending on his health. Those with full health will nearly always rejoin the battle while heavily wounded troops are much less likely to do so. If reinforcements arrive and improve the cohesion of one side, the routed soldiers will rejoin the fight together with the fresh troops. The exact formula for chance to rally is
[troop's health]

Reinforcements
When reinforcements arrive in battle, they raise the cohesion of their side by virtue of new fresh troops being introduced, and are therefore important to keep an army from routing. The player can call for reinforcements (press U) in battle every 100 seconds, if there are fresh troops avalible in his party they will arrive shortly. However the enemy will also be reinforced at that time. In addition, I've made the automatic reinforcements arrive slightly sooner, when the remaining number of troops is not quite as low. And I allowed for one extra wave of reinforcements before the battle has to start anew.

Troop Health
Knowing troop health and cohesion can be important to be more aware of the situation on the battlefield, or to see if that valuable troop of yours is going to need your help if he is to come out of the melee alive. The player can display the health status of his troops, his bravery bonus to cohesion, and the cohesion of both sides at any time (press T). Green markers are shown above troops with 70%-100% health, yellow markers for 30%-69% health, and red markers are shown for heavily wounded troops and bodies of those fallen in battle.


==============================================
This is the first release of the Battle Morale system, made as a patch for EGII mod.

Download: https://www.mbrepository.com/file.php?cid=6&id=733
==============================================

The source code and instructions are now posted here http://forums.taleworlds.com/index.php/topic,38237.0.html




 
Looks great, would make the game way more interesting.
One thing though when you have routed a couple of enemy's and they don't come back what happens to them?
Do they just hang around on the maps edge?
 
Wow, just wow :shock: This opens up different aspects to combat for sure.
Amazing work, Chel.

Zathan
 
This would sure add more realism to the existing battle!

1 nord recruit running against dozens of rhodok spearmen...ahem

 
Ewout 说:
One thing though when you have routed a couple of enemy's and they don't come back what happens to them?
Do they just hang around on the maps edge?

Yep. I suppose I could make them leave the map and rejoin the remaining party once they reach the end of the map, but I don't think it is better that way, and it would be complicated.

It would be better if the condition of the army as a whole influenced the chance, I'll see if I can get that to work. Then if, for example, you deliver a strong charge to an infantry line, half of them might rout, not just the ones you wounded.
 
YES!

these are the very basic AI morale features I hoped for MaB to have. Awesome work Chel!
Will you release this open source for other mods too?
 
Chel, you are a monster of code.

One thing to consider though is how you will want to handle this when concerning sieges.

The attrition rate for a besieging army can be atrocious, and might end up in a siege attempt being ineffectual
 
Chel 说:
Ewout 说:
One thing though when you have routed a couple of enemy's and they don't come back what happens to them?
Do they just hang around on the maps edge?

Yep. I suppose I could make them leave the map and rejoin the remaining party once they reach the end of the map, but I don't think it is better that way, and it would be complicated.

It would be better if the condition of the army as a whole influenced the chance, I'll see if I can get that to work. Then if, for example, you deliver a strong charge to an infantry line, half of them might rout, not just the ones you wounded.

Now that would be fun to do, stampede in and see all of them chicken, maybe you can let morale depend on what kind of numbers you are facing? for instante; 1-10 means low moral and big chance of routing as 10-1 means high morale and almost no chance of routing?
 
ealabor 说:
The attrition rate for a besieging army can be atrocious, and might end up in a siege attempt being ineffectual

I'm thinking that in a siege the attacking army will take more damage in general (or no? I haven't actually sieged anything in the game), so will be more likely to rout first. If that's not enough I can make sieging take an even heavier toll on morale?

Now, things work as I expected so I'll be able to make the routing dependant on the overall damage each side sustains (both killed/knocked out and wounded troops).
The base chance to rout will then generally increase as the battle goes on (as more guys are killed/wounded), or you can get them to rout with one charge.

I think also chance to rout should decrease slightly as the battle drags on. Maybe.. So that in the first minute it takes less damage to an army to make it rout, but if neither side can deliver such a blow from the start (no knight charge/arrow volley) and the fighting drags on, the first army to start routing will be the one taking more damage. The numbers will take some fine-tuning.

I'm not sure its necessary to further reduce the morale of a smaller party when facing a bigger one, it will be impossible to get your 20 knights to fight a lord army. The bigger one will get more reinforcements, which will bring fresh troops, and it already has more troops on the field, so will take less fractional damage and deal more.

How about the 'healthbar' indicator, do you like the one above better, or like this:

eg12zc1.jpg

eg14on1.jpg


I like both..
 
I like the second one better.

I wonder if we could ad the effect when the troop in total despair decides to "fight to the death" as in RTW sometimes. They have these cute skull signs above their heads :smile:
 
Sounds awesome, Chel. This should make fighting more interesting.


The second one is better, IMO.
 
Oh ********  i'm never going to be able to take the vaegirs on in a siege now. All my men wil run like pansies. Is it possible to make the chances increase according to how many heavy cav the opponents field? Heavy cav charges are bloody scary.
 
woow good work :grin:
i think sieges should give the attacking force a moral boost after holdig the siege 2 days?
so it will nott be impossible to take a castle
 
Very nice idea for small battles. But, doesn't it make a little chaos in bigger battles?

Yes, second one effect is much better!
 
You can't avoid chaos in a big battle. Keeping a coherent fighting force is the challenge!

I've got the basic code down, its seems to work very well, now just have to adjust the numbers, add some extras (battle cry combat ability to rally the troops), and decide what to do about reinforcements - when should they be brought in, should the player be able to call them at any time (but then if he does, the AI gets reinforced as well)?
 
后退
顶部 底部