User avatar
JacquesDeLalaing
Colonel
Posts: 344
Joined: Tue Mar 09, 2010 11:05 pm
Location: Vienna (Austria)

Some reflexions on modding combat

Wed Apr 30, 2014 4:26 pm

Once more I thought that it could be usefull to write up the sequence that I'm using in modding combat and describe briefly the components and in what order I tweak them. Perhaps it might be usefull to someone else who's in the mood of modding some time in the future. However, one needs a basic understanding of the battle mechanics to comprehend what follows. Of course anyone is free to correct/comment!

I'm not concerned yet with specialities of individual units (just unit-subtypes), just with the overall battle balance, that is: How decisive do you want battles to be (under what circumstances)? How much luck or randomness should be involved? How evenly should hits be distributed amongst the participating elements? How large should the influence of certain factors be (quality)? How large should the influence of numbers be (quantity)?

Of course I have a certain idea of what I want in my mind (light troops, less decisive battles for the most part), but perhaps a similar approach might be usefull for other ideas as well.

STEP 1: DECISIVENESS / EFFECTS OF BEING OUTNUMBERED / RETREAT-CHECK-INTERVALLS

I had to begin with the issue of numbers/quantity, as everything else needed to be based on this. You need to know how many elements will fight in order to get an idea of how many attempts in fire- and melee-combat will be made (which you need as a basis for your desired hitchances) and also to get an idea of how decisive battles and especially being outnumbered will be. One of my aims was to reduce the importance of numbers, so that outnumbered stacks are not so much at a disadvantage.

My first step was to reduce the numbers of elements that are allowed to fight in each battle-round. As a base, I used to same values for most terrains and balanced the frontages so that there would be at max. 40 elements of heavy infantry fighting in each terrain and weather, regardless if you attack or defend. Note that I actually had to increase frontages for bad weather (in relation to clear weather) since movement time in bad weather is increased. Apart from that and in order to get a more transparent game, I declared all terrain-types as "not open", which means that the huge frontage bonus of generals in open terrain should be ruled out.

What I have achieved by having only ca. 40 battle elements fight in each round is that the intervalls at which C-in-Cs consider retreat are smaller. Whereas with 100+ elements fighting, there are usually lots of casualties and an outnumbered army gets virtually destroyed before a C-in-C even checks whether he'd like to retreat (except for the pre-battle-check); Now, with but 40 elements fighting, the C-in-C can check for the first time much "sooner" with less blood-shed, before his army is destroyed.

But one also has to see that reducing the number of fighting elements increases randomness in regard to which elements are selected to fight (of which I don't have any idea), and: as less elements are involved, their success/failures will be more dispersed. The more elements involved, the less random the results. But then again, concerning randomness, reducing frontage reduces a different and more important kind of randomness: the randomness of retreat-checks, which weighs much heavier than randomness in the combat of elements. Whereas before you depended on one single retreat-roll the result of which decided over lots of casualties, now you get more retreat chances for the same amount of casualties.

Note that one could also achieve this (less bloody and unforgiving battles) by drastically reducing fire-combat and melee-combat hitchances for elements, so that even though lots of elements are involved in one battle round, hardly any of them successfully hits an opposing element. However, I considered "frontage" to be the more elegant measurement, especially as I wanted to reserve very low hitchances for the targetting of light troops.

STEP 2: BLOODINESS OF BATTLE

Next, we can tune the bloodiness of battle in two ways: 1) in setting the number of battle rounds per battle and tuning retreat-wills and retreat-success-chance; 2) in setting combat parameters (how many shots are fired, hitchances, etc.).

The first way compensates for the reduced frontage by increasing the duration of battles. So, although there are much less elements fighting per round, if both commanders are determined to stand (depending on posture/ROE and the retreat-rolls), then the battle will drag on for longer and there will be more casualties. One can easily alter the number of rounds per battle (in vanilla RoP 6) and add the corresponding retreat-will- and retreat-success-modifications. In general, I think that these modifications (retreat settings for different ROEs/postures) are the most important factors when modding combat decisiveness. If you set them too high, an inferior force will always draw out of battle very easily with few casualties, leading to indecisive skirmishes rather than battles (but you can still tweak pursuit casualties!). If you set them too low, an inferior troop will tendencially get destroyed. But you should make sure to re-adjust retreat-wills once you've set all the combat-variables of elements as altering those will also alter their PWR, thus you could end up with more extreme power-relations (to which retreat-will needs to be adjusted).

So by tweaking the number of elements allowed per round (i.e. less blood will be shed in between each retreat-check-intervall), and by tweaking the number of rounds per battle in combination with the retreat-will-parameters, a lot of fine-tuning can be achieved.

Then you can tweak combat parameters. This is a difficult topic as there are so many combinations and things to consider. I personally started with the amount of "attempts" that could be made by each element in one battle round. Keep in mind that the more attempts are made, the less random will battle be. So, my first consideration was Rate of Fire and Range. Just multiply the number of elements allowed per round (in my case 40), and multiply that by their full rate of fire + 1 per range allowance greater than 1 (actually, it doesn't exactly work like that; in the battle-logs I sometimes notice that some elements fired less than their ROF, others more; but you still get an overall idea). So, with a rate of fire of 2 and a maximum range of 3, you can expect that your elements will get 40*2+2=160 fire-combat-attempts on enemy elements each round. If you now consider their fire value and multiply it by the basic to hit coefficient, and the result by fire-damage, you will get a rough idea how many hits your force will inflict in a single round of combat. So, assuming that all my elements had a chance of 20% and would inflict one hit for a successfull attempt, there would be 160*0,2=32 hits inflicted in each battle round, which translates into 256 casualties (1 hit = 8 men in my mod). As 40 elements represent roughly 8 battalions or 2 brigades, each battalion (well, hit-dispersion is not that easy, but still..) would suffer ca. 32 casualties, which is quite a lot for a single round of combat.

Therefore rate of fire and range are the first cog-wheels that you need to touch, simply because you need to know how many shots will be fired per round before you continue to tweak the hit-chance of each shot. However, there are a few things to consider when tweaking range and ROF: 1) For rate of fire, you need to keep in mind that shaken elements loose 1 ROF. So, if you set ROF of elements to 1, they won't be able to fire at all when they're shaken. 2) If you set range very low, you also need to tweak terrain-modifications on range in the terrain-files. I'm not talking about the maximum range, but rather about the range-penalty that elements suffer in certain terrains. E.g. if the terrain file gives a -1 on range, then elements that only have a range of 1 won't be able to fire!

Only now that we know how many elements will take part and how many attempts they have each round, should we consider the actual combat parameters (fire/assault and TQ, global assault and fire coefficients, damage, etc). As hitchances are thouroughly explained in the AGE-wiki ("Combat explained"), I don't need to expand on this too much. Don't forget to consider those factors that you cannot change (e.g. low strength/low cohesion penalties). I would always start with considerations of troop quality and assault, as TQ comes into play both in fire- and in assault-combat. One needs to keep in mind, however, that TQ also plays a role in siege-resolution, which needs to be adjusted accordingly. So for each variable, you should check if you don't mess up any others of their "uses" in the game. To give another example: When increasing protection, keep in mind that you don't necessarily need to set this on a unit-level. You can also do it on the level of element-subtypes via the terrain files. This latter approach has the advantage that it doesn't increase an elements' combat power which is used in other calculations (AI?, retreat-check, etc.). In any case, you can tweak all kinds of stuff until you end up with the hitchance and hitchance-dispersion of your liking.

When it comes to modding the close combat phase, I think that the attributes charge, disrupt and countercharge are essential, because they take into consideration the cohesion of the target element and are thus relative. With TQ and assault-values alone, there is just not enough freedom and the quality of the target doesn't matter a lot. I'm still testing stuff, but I think I will mainly handle combat via those three attributes in combination with abilities (in order to make countercharge more reliable; you can alter the counter-charge-probability, e.g. at least I hope so).

Also consider that cohesion and cohesion-damage is quite important. By setting cohesion damage of fire-combat and assault-combat very high, you will end up with more routed units and also, combat might get more one-sided (the element that got hit has worse chances to strike back once it is lower than 50% of its cohesion). Moreover, keep in mind that cohesion and hits certainly affect the calculation of power, and therefore might be the main influence on retreat-will.

What I can't touch on, since it has not been explained, is how rotation of elements works.

Last but not least, you should adjust pursuit casualties. The pursuit-sequence is also nicely explained in the ageod-wiki.

SUMMARY

1. Adjust frontages in all terrains/weathers. (+ set range-malus; + declare as (not-)open terrain to disable or enable leader-frontage-boni)
2. Determine the maximum number of rounds you want a battle to have - it can't be helped that the detailed combat report only shows 6 rounds
3. Adjust retreat-will and retreat-chance for each round and each posture
4. Set range and rate of fire for elements (keep in mind that shaken elements loose 1 attempt)
5. Set other combat parameters (element-, terrain/weather-, gamelogics-specific; e.g. set the leader-boni in the gamelogics file); it's a good idea to start with TQ, which is needed for both melee and ranged combat; Keep in mind that you can set protection in the terrain files
6. Fine-tune melee combat (attributes: charge, disrupt, countercharge; finetune the results via abilities)
7. Set the damage-stats; Keep in mind how they affect combat (hard-coded!) and the campaign (e.g. considerations of the effects of cohesion on movement speed)
8. Adjust pursuit casualties
9. Test your settings in the game and study the battlelogs!


EXCURSION: Retreat-will

As for retreats, which are probably the most important aspect when it comes to moddeling battle mechanics, the retreat-will seems to be calculated like this (from what I've read in the battle-log):

I'm pretty sure that only the side which has less power in a battle checks whether it likes to retreat, the more powerfull side always gets a message like "No need to retreat from this battle: OppPower: 334 FacPower: 425". So the following calculations are only made for the less powerfull side:

1) take the base retreat will according to command-posture (e.g. 80%);

2) modify that with penalties for being out of ammo, having less trench-level than the opponent, and lack of of command points. The exact factors remain unknown to me (what I know is, for example, that 50% ammo doubles retreat will).

3) most importantly you add up the opponents' power (only of those stacks that take part in the battle? – e.g. a passive stack might not commit in round 1 if there are more aggressive stacks around) and compare it to your own power. E.g. If the enemy has a power of 425 and you have a power of 334, then the power factor is 127%.

For the final retreat-will-chance, you multiply your disadvantage with the modified base chance:

modified base-retreat-will (mainly based on posture): 80%
Power of opponents compared to us: 425 vs. 334 --> 127%
Retreat-will-chance = 27 * 0,8 = 22
--> There is a chance of 22% that the C-in-C will initiate a retreat prior to this combat-round.

Then a d100 is rolled and if the result is lower than 22, the faction tries to retreat. In contrast to the retreat-decision which is made by the C-in-C in a region on a faction-basis, each STACK of the retreating faction now has to carry out its own retreat-check. Unfortunately, retreat-check-parameters don't seem to be open for modding in RoP.
[CENTER][color="#A52A2A"] S I L E S I A I N R U P T A[/color]
- a work-in-progress mod for Rise of Prussia - [/CENTER]

User avatar
Jim-NC
Posts: 2981
Joined: Wed Feb 25, 2009 4:21 pm
Location: Near Region 209, North Carolina

Wed Apr 30, 2014 5:57 pm

JacquesDeLalaing wrote:Then you can tweak combat parameters. This is a difficult topic as there are so many combinations and things to consider. I personally started with the amount of "attempts" that could be made by each element in one battle round. Keep in mind that the more attempts are made, the less random will battle be. So, my first consideration was Rate of Fire and Range. Just multiply the number of elements allowed per round (in my case 40), and multiply that by their full rate of fire + 1 per range allowance greater than 1 (actually, it doesn't exactly work like that; in the battle-logs I sometimes notice that some elements fired less than their ROF, others more; but you still get an overall idea). So, with a rate of fire of 2 and a maximum range of 3, you can expect that your elements will get 40*2+2=160 fire-combat-attempts on enemy elements each round. If you now consider their fire value and multiply it by the basic to hit coefficient, and the result by fire-damage, you will get a rough idea how many hits your force will inflict in a single round of combat. So, assuming that all my elements had a chance of 20% and would inflict one hit for a successfull attempt, there would be 160*0,2=32 hits inflicted in each battle round, which translates into 256 casualties (1 hit = 8 men in my mod). As 40 elements represent roughly 8 battalions or 2 brigades, each battalion (well, hit-dispersion is not that easy, but still..) would suffer ca. 32 casualties, which is quite a lot for a single round of combat.


In this paragraph, is it supposed to be 40*(2+2)=160? or 40*2*2=160? I ask, as both equations give different results when used for other values (for example, if your range was 4, you get either 240 or 320 fire combat attempts).
Remember - The beatings will continue until morale improves.
[SIGPIC][/SIGPIC]

User avatar
JacquesDeLalaing
Colonel
Posts: 344
Joined: Tue Mar 09, 2010 11:05 pm
Location: Vienna (Austria)

Wed Apr 30, 2014 6:58 pm

Sorry, my bad!

It should read 40*(2+2), and it is only true for the first round of battle.

With a range of 3 and a rate of fire of 2, an element would fire its full ROF (=2; if not shaken) at max range (= range 3), one "shot" at range 2 and one "shot" at range 1.

In subsequent rounds, range is capped at 1, so each element can fire its full rate of fire at range 1.

Once again I need to point out that, when looking at the battle-logs, I found out that there seem to be deviations, but you should get the rough idea.
[CENTER][color="#A52A2A"] S I L E S I A I N R U P T A[/color]

- a work-in-progress mod for Rise of Prussia - [/CENTER]

User avatar
Jim-NC
Posts: 2981
Joined: Wed Feb 25, 2009 4:21 pm
Location: Near Region 209, North Carolina

Wed Apr 30, 2014 7:44 pm

Thank you for the clarification. I thought it was that way (the 40*(2+2)).
Remember - The beatings will continue until morale improves.

[SIGPIC][/SIGPIC]

User avatar
JacquesDeLalaing
Colonel
Posts: 344
Joined: Tue Mar 09, 2010 11:05 pm
Location: Vienna (Austria)

Mon Jan 04, 2016 10:56 am

YET MORE REFLEXIONS ON MODDING THE DECISIVENESS OF COMBAT

The performance of troops, the randomness of their performance and the overall amount of casualties, all described in the first post, are just one side of battle. The question of whether one side actually wins and forces the opponent to switch to passive stance and either rout or retreat, with the potential to inflict pursuit-casualties, is the other side. Here are some observations from my modding experience [Rise of Prussia] - I hope that most of it is correct:

There are three mechanisms that decide whether a FACTION in a region wants to retreat:

1. "Voluntary" retreat

Basically speaking, only the faction that has the lower combat power (the numeric value for each model/unit/stack that takes into account many factors, like current cohesion, troop quality, etc.) in a region tests whether it wants to retreat. Retreat-tests are carried out prior to each round of combat, even before the first round. The base chance is the difference in combat power between the two factions, and the test is carried out with a d100. So, for example, if your combat power in a region is 367, and the opponents' combat power is 678, then your faction will do a retreat-will test (since your combat power is lower) and the chance will be 84% (678 is 184% of 367). If the d100 rolls 84% or lower, then your faction wants to retreat and each STACK in the region will carry out a retreat-success-check to see whether it manages to retreat or not (in which case it suffers some minor effects for the round; -1TQ and another small malus - can't remember; and of course stacks that have retreated successfully are no longer there, so that any stacks that have failed to retreat might be targeted by more enemy troops). If the roll is 85 or higher, then your faction stays in battle for one more round of battle. It will test again before the next round.

Note that the retreat-will-chance can be modified. One important factor is the ROE/stance of the C-in-C (commander in chief, the highest ranking/most senior leader-unit in the region). Each stance gives you a "bonus" or "malus" on the checks for retreat-will for each round of combat. You can look them up by opening your gamelogic file and searching for "ROE". For example, if you set the retreat will to 010 (10%), then the base chance for retreat-will is only 10% of the difference in combat power. In the case above, retreat-will would be reduced from 84% to 8.4%.

Note that the ROE-retreat-will-modifications only work if there is a C-in-C present and that they work on a faction/region-basis. If there are no leaders in a region, then the unmodified 100% of power-difference always applies, regardless of the posture of your stacks in the region (their chance for a successfull retreat is still modified by their posture though).

Note that it can be a bit problematical that the combat power of all stacks in the region are considered (at least that's what I assume, but I'm pretty certain), not only the troops that actually take part in a battle. So, the combat power of units that do not take part in the battle (due to their stance, due to frontage) still counts for the retreat-will-test.


2. Auto-retreat

Another method to generate retreats is via auto-retreat. As the name suggests, it's not a test, but an automatism. The parameters can all be found in the gamelogic file. If a faction suffers a certain amount of casualties and/or cohesion loss at any time during a (day of?) battle, then it automatically wants to retreat. You can mod both the amount of casualties and the balance between casualties and cohesion-loss. E.g. If the base auto-retreat-casualty-threshold is set to 15% and the "CohBonus" (the parameter to determine the influence of cohesion) is set to 10, and your force is at 70% average cohesion, then it will autoretreat once it has suffered 12% casualties: threshold * [(current cohesion + CohBonus)/100] = 15 * [(70+10)/100) = 12. If your force in the region had a starting strength (I assume it considers starting strength of the battle, not absolute maximum strength at the start of the scenario) of 156 hits, then the auto-retreat will be triggered once you've lost 19 hits.

Note that it can be a bit problematical that the hits of all stacks in the region are considered (at least that's what I assume, but I'm pretty certain), not only the hits of the troops that actually take part in a battle. So, having a lot of elements (and therefore hits) present will increase the absolute amount of casualties needed to trigger auto-retreat. In general, I think the engine needs some way to link frontage and retreat-will-mechanisms. Overly large accumulations of troops might not be usefull in battle (due to frontage), and they suffer more hits if they retreat (which is very nice!), but overcrowding does not give a malus on retreat-will-decisions.

3. Rout

Whenever elements suffer casualties in combat, they need to do a cohesion-test. They need to roll under their current cohesion (expressed as % of their maximum cohesion). So, an element with a cohesion of 44/90 (=49%) has a chance of 49% to be routed (and not take part in the battle anymore) when it suffers casualties. Once the majority of elements in a unit are routed, the unit is routed. Once the majority of units in a stack are routed, the stack counts as routed. Not everything is clear here. I assume that the retreat-will-checks are still conducted normally, regardless of the rout-status of individual stacks (or perhaps indeed individual elements and units). Remember that retreat-will-checks are carried out on the faction-basis, while the rout-status is given to individual stacks. So I think that routs only come into play as a modification for pursuit-casualties, but plays no role for retreat-will-tests.

Retreat chance and pursuit

  • If a faction wants to retreat, all stacks will carry out a retreat-check to see whether they can retreat successfully or are forced to stay in battle for another round. Take a look here: http://www.ageod.net/agewiki/Retreat_Chance_formula_and_modding
  • If a stack retreats, it is switched to passive stance and moved to an adjacent region. The direction of retreat can be altered by changing the interest in depots/landlinks/cities, etc. in the gamelogic file ("Control and Retreat").
  • Any stack that retreats (due to voluntary retreat, auto-retreat, but probably not due to rout, as explained above) may suffer pursuit casualties. I don't need to explain anything here as the information is available in detail here: http://www.ageod.net/agewiki/Pursuit. It's important to note that it seems as if pursuits work on the stack-level, i.e. individual stacks pursue other individual stacks. Moreover, no pursuit casualties are inflicted if the retreat happened prior to combat round 1.


Number of combat rounds

The number of combat rounds per day of battle (in combination with the overall bloodyness-setting of your battles, which results primarily from unit stats) is an important factor for the decisiveness of combat. As a general rule, fewer rounds of battle generate less decisive engagements.

1. That's due to the fact that stacks (or factions?) check their overall combat strength if they're in offensive posture before they initiate a battle on each day. If a stack notices that it is low on cohesion (I don't know the exact thresholds), then it will simply switch to defensive stance and not engage in combat (unless the opponent is in offensive stance, of course). There will be a message informing you in the log (something along the lines "Cohesion being low, stack x has stopped offensive action."). Therefore, by having a lower number of battle-rounds per day, you decrease the intervalls of these "low-cohesion"-checks that are likely end a combat for the rest of the turn. Instead of fighting with low cohesion (and therefore with a higher chance of being forced to retreat), stacks simply stop offensive action because of low cohesion and do not engage in battle.

2. At the same time, a lower number of battle-rounds per day also decreases the intervalls of "safe retreat" chances. Remember that no pursuit-casualties are inflicted if the retreat happens prior to round 1 on each day. So, if you use 6 combat rounds per day, then there are but 2 chances (prior to round 1 on day 1 and prior to round 1 on day 2) for safe retreat out of 12 retreat-chances. If you're using 3 rounds, there are 2 safe retreats out of 6. If you want to keep the number of battle-rounds per day low, you can change this by setting retreat will or retreat chances very low for the test prior to combat round 1 for all stances/ROEs, but it only applies if there is a C-in-C present and it comes with other implications that I can't touch here.

Note that in most of ageods' games, you don't even notice the effect of the number of battle-rounds per day, as they use a very "decisive" setup of unit-stats and 6 rounds of battle per day. In most cases, one side is forced to retreat in the course of one day of battle anyway.
[CENTER][color="#A52A2A"] S I L E S I A I N R U P T A[/color]

- a work-in-progress mod for Rise of Prussia - [/CENTER]

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 26 guests