Military Unit Building Discussion (example: continue knight when rifleman available?)

Roland, unless the AI has a lot of sight visibility about it's opponents (thru units used as scouts and/or esp points visibility); that would be called cheating. The human does not have access to a broken down force count by air/sea/land, just a combined total solders on the stats screen.

I was proposing a rules change, not breaking the rules so it has nothing to do with cheating. Cheating has to do with breaking the rules.

At the moment, we get to see the power rating of other civilisation once we have a low level of espionage points against this opponent. I would suggest seeing three values for land, air and sea so that the AI and you know what you're dealing with.

BTW, the AI in the present version of Civ4 BTS always knows the other players power rating independent of whether it has the espionage points to do so. It's called a handicap bonus for the AI because it is essentially ********.

And there are times when it comes to air and sea that if you don't have the techs, it's just a waste of hammers to try to compete with massive inferior units.
(Such as if you can only build Airships and your opponent has several fighters. Or you can only build Frigates and your opponent has several Destroyers (or better).)

Yes, that's very true and is already a problem for the AI now as it already tries to compete with visible frigates and pirates by building massive numbers of caravels. What you would essentially want is that at some power discrepancy and some technological discrepancy, the AI just starts to focus at making it harder to be conquered instead of trying to become dominant in every area of warfare (land, air and sea).

The AI has several war strategies at the moment. When the AI is technological and numerically inferior in such a way that it can't even compete in that area, then it should use a strategy of stubborn defence; making it as costly as possible to be conquered. But of course, programming a new AI strategy dependent on technological unevenness is not something that's easy to do.
 
AI prefers to use fast units which might withdraw from strong defenders, wearing them down (like siege units, only faster). The STUPIDS:mad: insist on going in unescorted by defensive units (most of the time), yet persist in using hills/forests as if they could benefit from them. I've even seen lone siege units approaching through forests within MY borders.

1/3 to 1/4 of the attack force should be defense-capable (archer/melee/gun class) units to prevent the potential attack survivors from being destroyed in a counterattack (and provide those terrain defense benefits). This is a bleepin' ESCORT, and attacks only under favorable odds.

--
I would also prefer an attack/counterattack force less dependent on horse. Stronger combo of (defense-capable) foot and siege.
 
Why isn't there any:

Code:
	case UNITAI_CITY_COUNTER:
	case UNITAI_CITY_SPECIAL:

in CvPlayerAI.cpp? Will they be ignored by the AI?
 
UNITAI_CITY_COUNTER

This is a pretty frequently created AI type actually. I see it on plenty of units when testing. Don't see many of the special though.
 
so... the AI would not build knights when they have only 1 move?

maybe we should lower the value of additional movement points... withdraw is good but not important either... imo. what do you think?

Withdraws and 2 moves are *very* material. The AI doesn't use the 2 moves to its potential, but it still uses it to "see" further and pull off limited hit and runs (with flank attack). It would have a hard time doing that with rifles.

Also, your comparison between cavalry and infantry earlier didn't take the withdraws and 2 moves into account...and cavalry cost less hammers.

I'm not saying the AI gets it right but it's true that mounted has a lot of value in this game.
 
What's better: Winning a battle or losing a battle by withdrawing? :P Cavalry may be useful versus infantry, but not versus ALL older units like rifleman, grenadier, knight, pikeman, maceman, ... .
 
@jdog: I've noticed you changed

PHP:
	case UNITAI_ATTACK:
		iFastMoverMultiplier = AI_isDoStrategy(AI_STRATEGY_FASTMOVERS) ? 2 : 1;
		
		iValue += iCombatValue;
		iValue += ((iCombatValue * GC.getUnitInfo(eUnit).getMoves() * iFastMoverMultiplier) / 2);

to
PHP:
	case UNITAI_ATTACK:
		iFastMoverMultiplier = AI_isDoStrategy(AI_STRATEGY_FASTMOVERS) ? 3 : 1;
		
		iValue += iCombatValue;
		iValue += ((iCombatValue * GC.getUnitInfo(eUnit).getMoves() * iFastMoverMultiplier) / 3);


but this won't do anything since this also reduces the iCombatValue for non-fastmovers units.

Should not it be something like this?

PHP:
		iFastMoverMultiplier = AI_isDoStrategy(AI_STRATEGY_FASTMOVERS) ? 2 : 1;
		
		iValue += (iCombatValue * 2);
		iValue += ((iCombatValue * GC.getUnitInfo(eUnit).getMoves() * iFastMoverMultiplier) / 2);


This would increase the value of stock unit strength.

Result:

Rifleman = 100 * 2 + 100 / 2 = 250

Knight: 71 * 2 + 71 * 2 / 2 = 213

Grenadier: 85 * 2 + 85 / 2 = 212


As you can see, even factor 2 seems to be very low - without any bigger consequences.
 
The iValue of a unit is used to compare with other units.

What JDog did was said "if we aren't doing the fastmover strategy, then the value of a unit is (1+moves/3)*combat value", instead of "if we aren't doing the fastmover strategy, then the value of a unit is (1+moves/2)*combat value".

If the AI uses the iValue to decide between which unit to build (and not in comparison to other things, like building a building), then what matters is the relative change in the iValue, not the absolute one.

Does the AI use the iValue and compare it to things that aren't other unit's iValue?
 
Ok, so if 2 units have the same strength value but one has 2 moves and the other 1 move than in the old rules the 2 move unit would have a higher iValue by a factor of (1+2/2) / (1+1/2) = 1.3333 and in the new rules by a factor of (1+2/3) / (1+1/3) = 1.25

Compare knight 1 2/3 *10 = 16.67 to riflemen at 1 1/3 * 14 = 18.67
Compare cavalry 1 2/3 *15= 25 to infantry at 1 1/3 * 20 = 26.67

Old rules:

knight vs rifleman 20 vs 21
cavalry vs infantry 30 vs 30

Did I understand this correctly?
 
Basically, but iCombatValue is actually a ratio of strength compared to best land combat strength. The ratios between the numbers you have above are right, but the numbers themselves are different (which matters when they're integers). iCombatValue works like this:

1. (Combat strength)*100
2. Multiply by some fraction greater than 1.0 if unit has first strikes/chances
3. Divided by the best land unit combat strength anyone has built

So, it's basically a ratio of combat strengths. Note that all of these factors are based just on XML, they ignore any combat bonuses the units will get when built.

For the knights/riflemen case, we have:

Best land unit combat strength: 14
iCombatValue for rifleman: 100
iCombatValue for knight: (10*100)/14 = 71

So, the iValue calculations for the two are then (note: AI will not use fast mover strategy in this case, since combat value of slow rifles is higher than fast knights):

New: (ratio 0.89)

iValue for rifleman: 100 + 100/3 + 0 = 133
iValue for knight: 71 + (71*2)/3 + 0 = 118

Old: (ratio 0.95)

iValue for rifleman: 100 + 100/2 + 0 = 150
iValue for knight: 71 + (71*2)/2 + 0 = 142

New: (ratio 0.94)

iValue for infantry: 100 + 100/3 + 0 = 133
iValue for cavalry: 75 + (75*2)/3 + 0 = 125

Old: (ratio 1.0)

iValue for infantry: 100 + 100/2 + 0 = 150
iValue for cavalry: 75 + (75*2)/2 + 0 = 150

So, it's not a big change in this circumstance, more of a small tweak. There's also no change in the circumstance where the AI is running fast movers.

New:

iValue for maceman: 80 + (80*3)/3 + 0 = 160
iValue for knight: 100 + (100*2*3)/3 + 0 = 300

Old:

iValue for maceman: 80 + (80*2)/2 + 0 = 160
iValue for knight: 100 + (100*2*2)/2 + 0 = 300
 
Thanks for the explanation.
 
What's better: Winning a battle or losing a battle by withdrawing? :P Cavalry may be useful versus infantry, but not versus ALL older units like rifleman, grenadier, knight, pikeman, maceman, ... .

A withdraw isn't a loss. Even the stock AI will run withdrawn units away to heal if it has movement points, I'd have to imagine it's far more effective with better AI.

But, of all the units you listed, cavalry beat them handily except rifles. However, a rifle WILL LOSE to a cavalry in the field if the cavalry has pinch. Granted, the infantry will beat the rifle more cost effectively (and possibly the grenadier), but otherwise the cavalry is more cost-effective and far more dangerous to massed siege.

This question once again ignores the potential in 2 moves and disregards a very marked advantage in withdrawals (the attacking unit, if part of enough attacking units to win, gains an increased survival rate. *If* the attacking force eliminates all defenders on that tile, a withdrawal counts as a win, not a loss. You get to heal the unit, and the target is dead.

Also notable is that cavalry ignores first strikes with flanking II, and you conveniently forgot to include machine guns in your list, which cavalry are far superior to infantry when attacking.
 
I modded in a final cav unit after cav, so the gap to gunship is not so big

While it's true what you say about cav being better, it's degrees of better, Infantry is pretty poor vs MG's but cav will still loose aswell, having said that if someone has infantry and you are still stuck in the previous era, cav and cannon are probably the most effective units to build, although in truth it would be far better to forgo war altogether as you would need a huge numbers to overcome that unit gap
 
I modded in a final cav unit after cav, so the gap to gunship is not so big

While it's true what you say about cav being better, it's degrees of better, Infantry is pretty poor vs MG's but cav will still loose aswell, having said that if someone has infantry and you are still stuck in the previous era, cav and cannon are probably the most effective units to build, although in truth it would be far better to forgo war altogether as you would need a huge numbers to overcome that unit gap

A human against the regular AI can get a better than 2:1 kills to death ratio using renaissance troops vs infantry, machine guns and artillery.

On immortal.

The numbers don't have to be *that* huge ;).

A mix of combat and pinch Cavs, cannons, and airships make it extremely difficult to attack anything in the field until someone gets marines or tanks. Combat II cavalry (easy to come by) are 50% against arty, better if airships factor in. In fact, machine guns can't attack cavalry and if hit by airships (I know they'll intercept them but they're bad at it) the odds on a combat II cavalry usually aren't bad at all. If you go flanking II and ignore first strikes (the only promo MG's can take w/o being upgraded from former units), it's conceivable that you'll keep 60-70% of your cavalry vs them.

A big stack of that can easily keep the AI away from you while you march to their cities, where the CR cannons + airships take over again.

The issue with the AI isn't that it builds cavalry when it has infantry available (best would be a mix anyway, if you have both available, since cavalry can sweep damaged units and return to the stack)...it's the tactics the AI uses.
 
"The issue with the AI isn't that it builds cavalry when it has infantry available (best would be a mix anyway, if you have both available, since cavalry can sweep damaged units and return to the stack)...it's the tactics the AI uses."

Then surely the values the AI places on the units should reflect the AI ability to use them not yours.

Therefore even you are admitting it might be an idea if the AI builds the stronger more general purpose unit rather than faster more specialised cavalry.
 
A human against the regular AI can get a better than 2:1 kills to death ratio using renaissance troops vs infantry, machine guns and artillery.

On immortal.

The numbers don't have to be *that* huge ;).

A mix of combat and pinch Cavs, cannons, and airships make it extremely difficult to attack anything in the field until someone gets marines or tanks. Combat II cavalry (easy to come by) are 50% against arty, better if airships factor in. In fact, machine guns can't attack cavalry and if hit by airships (I know they'll intercept them but they're bad at it) the odds on a combat II cavalry usually aren't bad at all. If you go flanking II and ignore first strikes (the only promo MG's can take w/o being upgraded from former units), it's conceivable that you'll keep 60-70% of your cavalry vs them.

A big stack of that can easily keep the AI away from you while you march to their cities, where the CR cannons + airships take over again.

The issue with the AI isn't that it builds cavalry when it has infantry available (best would be a mix anyway, if you have both available, since cavalry can sweep damaged units and return to the stack)...it's the tactics the AI uses.

If you have the promotions i think charge works vs MG's as it classed as a siege unit
 
right but charge is nearly never used.

That possibly shouldn't be the case. Arty in stacks is the other major snag for cavalry (though they do have favorable odds when combat II or better once you factor withdraws). However charge would give them winning odds against the only units that don't hold collateral, if it actually does work on MG's.

Flanking II is a good call vs the MG's too since drill is the only promo they usually have.
 
...if it actually does work on MG's.

Flanking II is a good call vs the MG's too since drill is the only promo they usually have.

Yes it does, and I was surprised once when I saw a cavalry kill one of my machine guns until I realized it cancelled all it's first strikes.
 
"The issue with the AI isn't that it builds cavalry when it has infantry available (best would be a mix anyway, if you have both available, since cavalry can sweep damaged units and return to the stack)...it's the tactics the AI uses."

Then surely the values the AI places on the units should reflect the AI ability to use them not yours.

Therefore even you are admitting it might be an idea if the AI builds the stronger more general purpose unit rather than faster more specialised cavalry.

It might as well not build units if we continue your argument :p. My point is that the AI should probably continue building cavalry in some capacity right up until it gets tanks. The whole point of betterAI is to get the AI to perform better within the current rules...I do believe it can be effective even in AI hands.
 
Back
Top Bottom