We-the-People-civ4col-mod / Mod

This is the repository where the mod resides.
89 stars 37 forks source link

Debate on how to make a fair combat system #177

Open afwbkbc opened 5 years ago

afwbkbc commented 5 years ago

Yesterday I tried to attack enemy Galleon ( strength 36 ) with Privateer ( strength 33 ), and Privateer died while dealing zero damage to Galleon. So 10% strength difference resulted in 100% defeat ( no damage dealt to Galleon at all ). I wonder if it's just me being unlucky or some kind of bug?

Nightinggale commented 5 years ago

Combat is done by rounds where each round has a winner and only the winner deals damage to the other one. This means if you are unlucky enough to lose every single round, then the enemy will stay unharmed.

It's vanilla behavior and as such intended behavior. I would recommend watching Sid Meier's talk about combat as it gives some insights into vanilla.

Personally I find it somewhat flawed. I would rather have rounds to work more like say D&D where each side has one or more attacks, to hit chance and the other one has chance to avoid and possibly damage reduction. This means even if you are unlucky and get hit each round in combat, you still have a chance of damaging the other one. We talked about this a while ago on the forum (RaR?, M:C? something else? I can't remember, but it applies to all mods), but the complexity of rewriting combat means nobody ever produced anything worth using.

devolution79 commented 5 years ago

While the combat system can surely be debated, it is not buggy just because you dislike the outcome. Do you remember all the times that you won against all odds ? Funny how people don't complain about that!

Nightinggale commented 5 years ago

While the combat system can surely be debated, it is not buggy just because you dislike the outcome. Do you remember all the times that you won against all odds ? Funny how people don't complain about that! Is that Erik or Sid Meier talking? You get more or less the same from the link. Sid Meier talks about how players think it's unfair if they lose when the AI has 1:3 chance of winning while they think it's ok to win with 1:3 chance because they are good and can defeat the odds or something like that.

I agree the outcome of this combat isn't a bug. I view it more like disagreement with the combat system design.

afwbkbc commented 5 years ago

"This means if you are unlucky enough to lose every single round, then the enemy will stay unharmed." - so how many rounds did i lose there to do zero damage with str 33 vs str 36? "Do you remember all the times that you won against all odds ?" - nope, not even once. This combat system makes it kinda hard to do any strategy at all. I had privateer and 2 lesser ships ( with str 27 i think ), the plan was to either win with privateer or finish the job with lesser ship in case privateer fails ( galleon was supposed to be damage in this case with very high chance of at least 50% damage ). Zero damage to galleon was completely unexpected outcome and one that can't be accounted for.

ShadesOT commented 5 years ago

Let's put rewriting combat logic on the todo list. :-) I would like it.

so how many rounds did i lose there to do zero damage with str 33 vs str 36?

You actually can look that up in the message log under the combat tab.

MichaelQuell commented 5 years ago

I think a draw should be far more common in this game.

ShadesOT commented 5 years ago

What happened to "fight to the death"?

Nightinggale commented 5 years ago

What happened to "fight to the death"? It died because it failed to accept a draw when it was overpowered.

There is a good point to a draw. Damaged units can then flee back to the colonies to heal. This means it can be beneficial to use troops, which have sacrificed combat power for speed as they can be used to chase such damaged units.

It's a balance though because if units never die, the gameplay is hurt. A draw should be a possible outcome, not the close to default outcome. Also the chance of a draw should increase the more both sides are equally strong.

LibSpit commented 5 years ago

Draws come from the withdrawal chance 'skill'. The ability to 'not lose' in a bad outcome.

So if you wanted things to 'draw' more often then you just apply withdrawal chance amounts as a default.

then you adjust the amount of withdrawal to match the 'speed' of a ship. So a light chaser has greater chance to withdraw against a heavy ship of the line. Being more manoeuvrable than it's larger counter part.

Though that being said I found many of my ships seemingly withdrawing from combat when they still had more health than their opponent so i got a bit lost as to what was happening there...

NoFreeUsernameDammit commented 5 years ago

Draw comes from two things: withdraw ability and running out of combat rounds.

The combat is turn-based, and number of rounds is, in vanilla Colonization, unlimited-meaning combat will go on until death, unless attacker withdraws. RaR changed rounds to limited, so now the units often run out of combat rounds.

Withdraw chance applies only for attacker, and I think it's rolled every time attacker loses a round. The idea in original design was to allow some units to act as skirmishers, weakening the enemy and retreating.

LibSpit commented 5 years ago

I may be thinking of a civ4 mod that changed withdrawal to work for defenders as well.

devolution79 commented 5 years ago

In case anyone would like to experiment with the combat calculations, have a look @ CvUnit::resolveCombat(...) Currently the number of combat rounds are hard-coded to 7. Arguable, this should be a XML parameter. Note that if you change it, you'll also have to change the following constant "int iMaxCombatRounds = 7" in ::getCombatOddsDraw(...) to make the combat odds calculation remain correct.

orlanth commented 5 years ago

Nice, moving in the direction of getting more combat variables exposed to XML will be great for moddability. šŸ‘ There is plenty of scope for making vanilla combat more interesting, by promotions enabling situational modifiers that can make combat more than a generic contest of ā€œstrength value vs strength value +/- randomnessā€.

Rather than a single generic value for ā€œstrengthā€, some mods like FfH2 have enabled attack strength and defense strength values that can be set independently. In many cases I liked this a lot, but I think many modders may not to deal with separate attack/defense values for all units and some may not want to use this at all. Perhaps a simple way to enable moddable attack/defense advantages when desired would be promotioninfos iAttackModifier and iDefenseModifier tags that can provide % strength modifiers when attacking or defending.

I agree more ā€œdrawsā€ / partial defeats could be nice in enabling more nuanced battle outcomes and and result in less player frustration from outright losses; however as Night said this should be balanced with avoiding frustration from constantly chasing retreating ā€œunkillableā€ units. To enable moddability of withdrawal for attacking or defending units, iWithdrawalAttack and iWithdrawalDefense tags in Promotioninfos could be added. To enable some units to be better at chasing down evasive prey, an iPursuit promotions tag could be subtracted from the Withdrawal chance of their retreating opponent.

I canā€™t recall what was discussed about unit capture, but an iCapture chance that allows a victorious unit to capture a defeated opponent that failed to retreat could also be very cool.

M:C had also brought back the option of ā€œFirst Strikeā€ attacks from civ4bts, another nice option for adding some strategy and flavor beyond ā€œstrengthā€ values to vanilla combat.

LibSpit commented 5 years ago

yeah in FTTW we added a ranged strength stat, and we had attack and defense modifiers this gave us the ability to have melee/ranged strengths and an ability to have very strong attacks and weak defensive, health etc. there was a mod/feature once upon a time that added surround bonus, so the more squares around a target you had units in, the greater the attack bonus each unit received, so position, speed and flanking became very useful. Do you maintain a stack for combined protection, or do you spread out to try and overwhelm the enemy, coupled with stack damage units, it makes for quite a fun decision process.

Nightinggale commented 5 years ago

We technically have 4 combat cases. Attack and defend and in both cases the unit can both try to hit and avoid being hit. Think pikemen vs cavalry. The pikemen are slow and can't be aggressive against cavalry, hence not good at attacking. However if cavalry try to charge pikemen, all they meet is a wall of spikes and they will be slaughtered. This would give pikemen a really high change to hit and damage vs mounted units, but only when the mounted unit attack.

I would like to add that #127 brings up the concept of units having a list of UnitCombatTypes rather than just one. This means a unit can end up with both gunpowder and mounted, accepting promotions for both and the enemy can use +% combat strength vs either (though should they stack or just best for each promotion? Something to consider).

We can also consider two types of armor: hit avoidance and damage reduction. An unarmored unit can be very agile in moving out of where the enemy hits while a heavily armored unit might not be able to move around, but it takes less damage each time it's hit because the armor does the job.

M:C had also brought back the option of ā€œFirst Strikeā€ attacks from civ4bts, another nice option for adding some strategy and flavor beyond ā€œstrengthā€ values to vanilla combat. The idea is interesting, though I'm not happy with the implementation. We should keep it simple. Just have units have an int of number of first strikes. During combat each unit gets a counter of number of first strikes from the enemy and if it's > 0, subtract one and skip the turn. It's much simpler for the code and more intuitive. Mixing it with armor type has made the code.... rather complex and less intuitive to the player.

CommanderBello commented 5 years ago

Currently the number of combat rounds are hard-coded to 7. Arguable, this should be a XML parameter.

Hello guys, a new contributor here. Please forgive me my poor English, as I am not a native English speaker. As the above mentioned number of combat rounds was introduced to RaR based on my modmod at that time, I would like to point out some things. The number "7" was based on experience and chances to have some draws in combat while still giving either side the chance to have a win. At that time I was (and still am) quite inexperienced in programming, so for me it was the easiest way to have that number hardcoded. I agree wholeheartedly that having it in XML would be a much better way. (Will continue this later as some RL action is requested right now)

CommanderBello commented 5 years ago

What made me introduce limited combat rounds to RaR was that I wanted to have some "unexpected" results in terms of the stronger unit not necessarily winning the battle while not changing the combat system too much at that time. Experience told me that when having units of comparable strenghts, you would just need to have around 1.5 times more attackers than the defender has and you would win the battle, meaning that you would be able to take the defenders plot. Having the chance of draws in my experience greatly added to the fun for the human player, as he now was presented with additional choices on the next turn: continue battle, hold position or retreat? Furthermore, this addition at that time was meant to be a first step leading to a almost complete redesign of the combat system which sadly, due to RL issues, I was never able to finish. Nevertheless, I still have most of my notes from that time and if you would allow me, will contribute to your discussions in the future. And finally, I am happy to see some skilled programmers continuing work on the Colonization mods.

devolution79 commented 5 years ago

I am working with f1rpo to overhaul the civ4 combat mechanics: https://forums.civfanatics.com/threads/advanced-civ.614217/page-9 (the discussion started on page-2)

Anyways, I am mentioning it here since when completed some or parts of it could be ported to WTP.

@CommanderBello : Your limited combat rounds mechanic will be included :)