• Civilization 7 has been announced. For more info please check the forum here .

Reducing the extremely high number of units in mid- to late-game

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
I'd like to experiment around a bit to try to reduce the huge number of units that occur in mid- to late-game, for both AI and human. If this can be achieved, there would be several benefits: 1) faster game turns in late game; 2) less tedium; and 3) maybe, just possibly, a reduced effect of human tactical superiority (or conversely, AI tactical stupidity). The reason I say #3 is that I’ve noticed (as I posted in another thread) that as total unit numbers go up, my need to keep up with the AI in terms of unit ratio (#human units / #AI units) actually goes down. To illustrate this point: 10 AI units vs. 2 of my units -> almost certain loss for me; 20 vs. 5 -> I might prevail but the outcome is uncertain; 100 vs. 20 -> very likely a victory for me. So, every new building or feature that increases commerce and/or production leads to more units (for human and AI), which further exposes AI stupidity, which in turn leads to the need for more AI handicapping (primarily by inflating unit numbers even more).

I enjoy the early game when I have several hunters that I’m focusing on, or a mini-SOD of 5 axemen + 2 catapults going out for conquest, and my homeland is guarded by one or two units per city and a couple rapid response units. I don’t like the later game where I and the AI civs each have >100 units. To me, the early game is unpredictable and fun, while the later game is utterly predictable and tedious (and I blame this mostly on the huge number of units in late game). It would be a HUGELY different game if each civ only had a few dozen units in the late game. I don’t even know whether this is possible within the existing civ4 framework. There is already a thread on SODs and xUPT: my specific problem is not really with SODs, but with having to manage 100s of units. My question is: can this be changed while still maintaining a reasonably effective AI?

The simplest idea that I can see is to adjust unit support costs so that a dozen units can be easily supported but 100 units is prohibitively expensive. This may be annoying at first try for a human player, but human players can quickly adjust. The big issue is, what will the AI do? I see two possibilities:

  1. (my preferred outcome) Total unit number reduced for everyone. AI still sees weakness (in power ratio) and goes on offence when appropriate. When unit support gets high (even though total numbers are low compared to current gameplay), the AI knows to use them or to shift to city development.
  2. AI continues to build units in large numbers even when not at (or preparing for) war. Shuts down economy and fails to advance in tech.

IF the AI mostly does #1 and not #2, then the changes could be fairly simple and all in the civics XML. So I want to substantially increase unit costs for large numbers (i.e., more than 12) while maintaining or reducing the current costs for “smallish” numbers. The XML has the following (possibly) relevant tags, which are all set to 0 for all civics except iMilitaryProductionModifier (-20 to +15 for several civics) and iFreeUnitsPopulationPercent (+50 for Crusade; +20 for Military State and Warfare):

Code:
<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
<iBaseFreeUnits>0</iBaseFreeUnits>
<iBaseFreeMilitaryUnits>0</iBaseFreeMilitaryUnits>
<iFreeUnitsPopulationPercent>0</iFreeUnitsPopulationPercent>
<iFreeMilitaryUnitsPopulationPercent>0</iFreeMilitaryUnitsPopulationPercent>
<iGoldPerUnit>0</iGoldPerUnit>
<iGoldPerMilitaryUnit>0</iGoldPerMilitaryUnit>

First off, can anyone tell me why the warlike civics adjust iFreeUnitsPopulationPercent and not iFreeMilitaryUnitsPopulationPercent? I’d prefer to have these civics affect military unit support and not worker support. Anyway, here are the new baseline values for my first experiment:

Code:
<iMilitaryProductionModifier>-15</iMilitaryProductionModifier>
<iBaseFreeUnits>0</iBaseFreeUnits>
<iBaseFreeMilitaryUnits>12</iBaseFreeMilitaryUnits>
<iFreeUnitsPopulationPercent>0</iFreeUnitsPopulationPercent>
<iFreeMilitaryUnitsPopulationPercent>-20</iFreeMilitaryUnitsPopulationPercent>
<iGoldPerUnit>0</iGoldPerUnit>
<iGoldPerMilitaryUnit>5</iGoldPerMilitaryUnit>

My changes to iBaseFreeMilitaryUnits and iGoldPerMilitaryUnit are rather extreme. I may have to back off, but I want to have a BIG effect so I can see how (or whether) the AI adjusts at all. I’ll adjust iMilitaryProductionModifier from this baseline using the current modifiers from 0 (so Pacifism becomes -35; Military State becomes 0). I’m not sure if this will work but I’m going to apply the current iFreeUnitsPopulationPercent modifiers to iFreeMilitaryUnitsPopulationPercent (so Military State becomes 0; Crusade becomes +30). I don't want any of my modifications to change support costs for non-military units.

Someone please let me know if I’m totally misunderstanding these modifiers. Or if you really know that the AI can’t deal with increased support costs. Otherwise, I’ll give this a go and see what happens over the next few days.

If this doesn’t work (because the AI can’t adjust to increased unit costs) then I’m not sure what to try. I thought about increasing production costs for all units across the board. But this would just favor a builder strategy over conquest/domination. I don't want to make conquest less viable, I just want it to happen with fewer total units for both attacker and defender.
 
I don't know enough technical details to go deep in this, but I wholeheartedly support this. smaller armies in the later stages would mean A LOT for the enjoyment of the game. much better than a forced units per tile limit. it shouldn't even be so difficult btw. for example you could change the unit maintenance cost formula to give increasing penalties as you get more and more units. so 10 units cost x, and 100 units cost way more than 10x. that should be easy enough, so then all it's left is telling the AI to not build units if they already have enough. sounds like the gameplay benefit would far outweigh the effort in coding this in.
 
i wholeheartedly agree, if the ai can handle those changes this would be an awesome contribution to this mod :)
 
I approve of the idea, but i don't think it's going to be so easy. If the total number of units goes down, then all the national unit caps and the heroes need re-balancing.

The values of many military techs will also change dramatically, as it'll be all about quality over quantity.
 
Rebalance later (it would have to be extensive, yes). But the first question for me is whether the existing AI will react to increased support costs. If not, this problem is beyond my modding skills.
 
I approve of the idea, but i don't think it's going to be so easy. If the total number of units goes down, then all the national unit caps and the heroes need re-balancing.

The values of many military techs will also change dramatically, as it'll be all about quality over quantity.

not really if the ai can adjust to higher upkeep you could set the upkeep for more important/advanced units much higher.

@pazyryk i can't answer your question besides stating the obvious answer to just try it and see if the ai can handle such changes.
 
Well, it's possible (although a lot of work) to set different support costs in the units xml. So you could have tier 1,2,3,4 units cost 2, 4, 6, and 8 gp per turn, or you could even have a non-linear scale like 1, 2, 4, 8 gp per turn. The latter scale would completely flip "quality over quantity" to "quantity over quality". So you should be able to get any balance you like with sufficient trial and error. You could even tailor this so that some civs were pushed more toward quantity over quality (Orcs, Doviello) and others were pushed more toward quality over quantity (Elves).
 
i suggest you mod one race for testing purposes and see how well the ai does with this civ. you could even make a quick copy of an existing civilization mod the copy and put both in the same game.
 
not really if the ai can adjust to higher upkeep you could set the upkeep for more important/advanced units much higher.

@pazyryk i can't answer your question besides stating the obvious answer to just try it and see if the ai can handle such changes.

I'd say adjusting the upkeep for a unit counts as a form of re-balancing it. ;)
 
care to tell why? i have the most fun in civ4 when the unit count is somewhat manageable.
 
I wholeheartedly support this initiative.

mid-late games on SMALL, yes SMALL, with 9 civs cause OOS every turn for us. It is unplayable :(

I think the number of units is the cause - my personal opinion. I think reducing number of units will help here.
 
Well, here is what I’ve learned so far:

I can’t get the desired effect on unit upkeep in the Civics XML. I tried adding negative modifiers to iFreeUnitsPopulationPercent and iFreeMilitaryUnitsPopulationPercent. Strangely, the effect I want is indicated in the civic page (I can see “-90 free units” or “-90 free military units” under the particular civic that I edited) but this has no actual effect on the budget page (unit support, free units and free military units are absolutely unchanged). That's weird. Unfortunately, I think that means that I simply can't reduce the number of free units by any XML modification. iGoldPerMilitaryUnit also does not do what I want. Again, I see a change in the civics selection, but it has no actual effect on “unit upkeep” in the budget page (also, strangely, if I put a 5 there I only see +1 gold per unit in the civics selection).

There is no possible modification in the Unit XML either. The only military upkeep tag in the units xml is Boolean not integer. There is an interesting tag in the Unitclass XML called iInstanceCostModifier. If you put 10 there, the effect is that each additional unit of a particular type costs 10% more hammers to build. That looks interesting but is not really what I’m looking for.

So I believe the only possibility left for simple modding is the handicap XML. I did not want to modify this because when I do, it will be very hard to evaluate and compare AI performance before and after. Unfortunately, there is no way here (or anywhere else that I can find) to lower the free units from empire size. Perhaps this is OK because both human and the AI exceed “free units” be very large numbers as unit numbers go exponential in mid game. So my approach then is to leave free units as they are but make extra units prohibitively expensive by jacking up iUnitCostPercent and iAIUnitCostPercent.

Before I start a new test game, I thought I’d load up a couple previous savegames where I thought unit numbers were going exponential. The first of these is Os-Gabella, turn 322, Emperor difficulty, Standard size map, Normal speed. I have 10 cities, 145 military and 26 non-military units (budget page indicates 124 gp unit upkeep with 50 free units; 26 free military units), and I can run 90% research which gives me ~800 research and close to 0 net gp income. That’s under untweaked Emperor settings with iUnitCostPercent = 115 and iAIUnitCostPercent = 85). I changed both modifiers to 500 and loaded the same game. Now I have to set the research slider to 0% to have positive income. So, at this level you can have >170 units, but only if you dedicate an entire well-developed economy for it. OK, I’m not sure if that’s exactly what I want but it’s getting much closer. On the other hand, you could have up to 50 units without paying anything. That’s more free units than I wanted but I can’t change it (as far as I can tell) and I guess I can live with it.

So what does the AI do? I really didn’t have the patience to test out the game above (with AI turns taking >1 minute). So I reloaded the same game back at turn 248. At this stage I had ~30 units, a little under the free unit cap (only 4 cities at this time). My power ranking was 0.2 or 0.3 compared to several AIs so most AI civs are probably well above their free unit level. I ran out the game for 12 turns to see what would happen to the AI in the power and gdp graphs. All AIs took a huge dip in gdp, with several (not all) going negative. Power graphs, which were previously exponential in shape for most AIs, all stalled out (some were headed down, some went down a bit and seemed to stabilize). I suppose for the AIs that went negative gdp, the power dip was probably related to auto-disbanding units. The good news, I think, is that AIs that always maintained a positive gdp either dipped or at least stopped growing in power. They were either not building more units (I hope) or they were building and disbanding at the same time. Also, the 4 civs that went negative in gpd gradually (over 4-5 turns) got back to 0 gdp (probably due to involuntary disbanding) but then continued to grow into positive gdp. Therefore, I can say that the AI isn't just sitting there at 0 gdp and max unit capacity without doing anything. This is a good sign.

Next step is to try some games from the start. I’m changing iUnitCostPercent and iAIUnitCostPercent values from 115/85 (normal Emperor) to 575/425 (modified Emperor). My justification for these numbers is that I have to pay ~35% more than the AI for any number of units (in excess of free units) in both pre- and post-modification. I’m also going to bump up iFreeUnits from 3 to 6. I don’t know if this affects both player and AI (there is no “iAIFreeUnits” tag at all, so I'm guessing that IFreeUnits works for both) but this seems necessary to survive the early barb onslaught and will have no significant effect at later stages. I can see already that the optimal strategy will probably be to hover right around the “free unit” level, and I know this as a human player but obviously the AI doesn’t. I’m hoping that the AI will respond to rapidly rising unit costs by either going warlike (to burn off units) or shifting away from unit production. We’ll see. If anyone else wants to try this, please do (just tweak the 3 settings above for whatever difficulty level you play).
 
sounds promising :)
maybe sephi can make this an game option: "reduced unit amount"
or something akin to this
 
Well, only if the AI copes and it is fun. It will need to be tested extensively and then (if it works at all) balanced.
 
Well, only if the AI copes and it is fun. It will need to be tested extensively and then (if it works at all) balanced.

Pazyryk,

When I worked on "The Ancient Mediterranean", the engine from "Civ4" to "Civ4BTS" went through a major overhaul (upheaval) that was not very organized or tested. The net result was too many things got changed at once, and the core issues were buried under the confusion of who did what where. My point here is not to discourage your efforts, or to even forwarn you, as much as to inform.
One of the things that tanked in the confusion was the economic engine, and its relativeness between unit upkeep and your base income from buildings/civics etc.

I ended up making an excel matrix sheet to record every major event (like tech discoveries, build new cities, etc) to help track the curves in the economics. The problem there was after 5 or 6 cities, the economy would zero out due to unit and city maintenance costs.

Anyway once you get a working engine up and running for a long test, let me know, and I will try to help you run them if you want and turn in a report back to you to analyze.
I would have to pull double duty between that and my normal testing for the official versions, but right now things are relatively calm so I should be able to.
 
Thanks for the offer. I'm very uncertain whether my general approach (ie, jacking up support costs) will achieve the desired results. I'm quite certain that my initial settings will be unplayable. I'll update as I see what happens and try different settings. The best thing anyone else can do is to try to think of other approaches or mechanisms that might address the objective. Is there any other (or better) way to reduce unit number? (besides the obvious "hard limit", which I don't like)
 
there is a tag in the jotnar files:
<iExtraGoldSupport>
but i don't know if it works it is commented out on all units

edit: does not work since it is not defined in the schema
 
Pazyryk :
do you know if the AI understood that it is better to disband warriors and not champions to keep the upkeep low ? and a champion instead of a hero ? or upgrade high xp warrior and kill a low xp axe ?
 
Top Bottom