Can this be done with Python modding?

LateGameWarMong

Warlord
Joined
Jul 28, 2008
Messages
115
OK, I'm willing to bet this has been proposed before, maybe one can just point me to a download link....

Everyone complains about losing their super promoted unit when it had 99% victory odds (or even >99.9)

So, I'd like a threshold system to be put in place...

Something like:
If: Odds caculator result = 99 or greater
Then: <iWithdrawalProb> set to 100

If: Odds calculator result = 1 or less
Then: <iCombatLimit> set to 99

Thus a unit cannot be killed if it attacks at greater than 99% odds, it can "lose" and retreat, and be left with 1 hp.
Also, a unit cannot be killed by an attacker with less than 1% odds, it can "lose" and be left with 1 hp, while the attacker retreats.

Between 1% and 99% combat odds, nothing changes.

Obviously, a unit left with 1 hp can be killed by a second unit, even if it is a warrior, so this doesn't mean really strong units are *unkillable* or *unstoppable*, it just means a single very unlikely combat result is not enough to kill a unit, or result in the loss of a city.
Units that lose when they had over 99% odds, would be fairly safe within a stack though.
 
I'm not qualified to say for sure, but I bet this would be a SDK hack.
 
Whenever the chances are less than 100%, losing a unit is a possibility. It's the stupidity of us humans to assume we will win if the chances are above 51% or some other threshold. I'm disappointed when I lose a fight where I can 75%+ chance to survive and get cranky when a 90%+ fight ends badly for a valuable unit but that doesn't mean the combat system is broken. It's my own fault for assuming something about an outcome I can't predict.

You could however make it so that when a 100% chance of victory is displayed because of rounding, the battle can never end badly. Imagine the frustration if you lose a 100% fight ;) Though I never saw anything like that, it shouldn't happen all that often, if at all.

I'm also pretty sure you should do that in the SDK, probably not even possible outside.
 
For what it's worth I took a different approach for my mod and it seems to work pretty well. I totally changed the combat code in the SDK. In the standard game the code that is used for calculating combat damage is cycled indefinitely, applying damage to each unit until a unit is killed or one withdrawals. In my code the code has a limited number of times that it cycles - if no unit is killed during that time and no unit withdrawals then combat ends with both units still alive. The number of times that the code cycles is set in GlobalDefinesAlt.xml so it is easy to change how lethal combat is by increasing this number or lowering it. Using this method it usually takes more than one attack to kill a unit, and a weak unit never kills a strong unit unless it is already heavily damaged.
 
Yes, that's a much better approach. It makes war slower (good for slower gamespeeds, bad for normal and faster) and gives the player with the bigger army even bigger advantage, so I honestly don't they it's the perfect solution but it isn't bad either.
May I ask what your mod is, in your signature and file list only the xml editor appears.
 
Perhaps units should be able to attack several times in one turn also, so that the war can be ended in the "regular" amount of turns.
 
I haven't released it because it isn't finished. It's a classic example of trying to do to much. I've spent a lot of hours making major changes to the combat system over the last year and a half and most things are around 90% complete, but the mod currently isn't playable. I decided recently that I'm going to do a post showing all the changes in case there is any interest in helping with the mod and/or others using some of the code for their own purposes. If I can find the time, I'll do it this weekend.
 
Yes, that's a much better approach. It makes war slower (good for slower gamespeeds, bad for normal and faster) and gives the player with the bigger army even bigger advantage, so I honestly don't they it's the perfect solution but it isn't bad either.

Yes, not perfect, but promising!

Bigger organizations (armies, corps, divisions, Roman Legions..) would tend to rotate units rather than lose them completely. A WWII US infantry division was usually 3 regiments, but only 2 "on the line" and 1 held in reserve. Smaller units would be deployed similarly.

At least in an organized army anyway and being the attacker certainly helps. How many WWII movies are there with no talk of units rotating out of the line?

It does probably necessitate some additional considerations, like upping unit build costs and perhaps a different mechanism to heal units other than simply sitting around (ie have cities build "replacements" in order to heal units past.. 60%?). And if there are fewer units killed should war weariness be tied to strength loss as well?

The US hasn't lost even 1 complete company in either of the current wars, yet there is still some WW over loses. Overall the total casualties are somewhere around a division size (20,000+), but no units have been wiped out. So in Civ terms no WW from loses! WW from damage is trivial to implement.

Anyway, too far ahead there! For now I'd like to try it and see how it goes.
 
For what it's worth I took a different approach for my mod and it seems to work pretty well. I totally changed the combat code in the SDK. In the standard game the code that is used for calculating combat damage is cycled indefinitely, applying damage to each unit until a unit is killed or one withdrawals. In my code the code has a limited number of times that it cycles - if no unit is killed during that time and no unit withdrawals then combat ends with both units still alive. The number of times that the code cycles is set in GlobalDefinesAlt.xml so it is easy to change how lethal combat is by increasing this number or lowering it. Using this method it usually takes more than one attack to kill a unit, and a weak unit never kills a strong unit unless it is already heavily damaged.

This seems similar to how aircombat goes, which is why air units often "lose" the combat without being destroyed, right?

It's the stupidity of us humans to assume we will win if the chances are above 51% or some other threshold. I'm disappointed when I lose a fight where I can 75%+ chance to survive and get cranky when a 90%+ fight ends badly for a valuable unit but that doesn't mean the combat system is broken.
I'm fine with losing if I had 51% odds, or 75% odds.
Its the odds system itself I don't like, the thought of warriors taking down gunships... utterly ridiculous.
Many Real time strategy games have elements of randomness in them. For example, in Homeworld every unit had a DamaeHi and a damageLo value, and the actual damage it dealt was somewhere randomly between the two values.
Likewise fighters had a % chance to perform an evasive maneuver (making most projectiles miss, although its possible they then get hit by a different projectile, or the velocity+ distance makes evasion useless)
There was randomness, but it was bounded randomness, and thus for large differences, the outcome was certain, the only difference was how much damage your ships took.
Sure the turrets of a heavy cruiser(the biggest capital ship aside from the mothership) may need randomly between 2 or three hits to take out an attack bomber, and the attack bombers may get lucky and keep rolling dodges, but a single attack bomber... there was no way it could win.
The self repair of the heavy cruiser meant that it would take several minutes (or more) of continuous firing from a single attack bomber to bring it down, minute after minute of rolling dodge after dodge from 6 turrets....
A light interceptor was even worse off, granted you could build 105 of them for the cost of one heavy cruiser, with a little extra left over.
I suppose in the fighter vs capital ship case, the fighter could win, but the odd are orders of magnutde of orders of magnitude less likely than what we see in civ, and the player can intervene with an anti-fighter corvette, or another fighter (some of which have projectile velocities high enough that they cannot be dodged within a certain range, at which point the bounded randomness appears with the minimum damage values, and the single fighter is then guaranteed to lose)

Likewise, a heavy cruiser, equipped with 6 mass drivers and 4 ion cannons, would always beat an ion cannon frigate (mounting a single ion cannon), even if all its weapons kept rolling for their minimum damage, and the ion cannon frigate kept rolling for its maximum damage.

Is Civ's combat system broken? what does that even mean?
All I know is I would prefer bounded randomness.
 
Back
Top Bottom