@ADragon8602 @Cobaltdragon913
Edit: Updated with the root cause, two tests that confirm it, and an AI-only workaround. My earlier hint about the tree’s own gatherer override was a dead end and has been removed.
TL;DR: since 17.0.12182.0, skirmish AIs put almost every villager on food and almost none on wood, so they stall at the pop cap with no army. The cause is the AI production planner’s estimate of how many more villagers to train. In 17.0 that estimate comes out far too high, and its food cost (50 per villager) is counted as food demand, which swamps everything else in the gatherer split. Making the AI’s villagers cost 0 food fixes the AI completely (tests 4 and 5). Vikings are spared because their town center villagers already cost 0 food.
Symptoms (every civ I tested except Vikings; Mongols vary from game to game; others in this thread report it on every difficulty):
- 0 or 1 villager on wood from the first minute; nearly everyone else on food.
- Nothing that costs wood gets built: houses, mills, lumber camps, farms, barracks.
- The AI sits at its pop cap with 1 or 2 military units and 2000+ unspent food by 10:00. The Malian AI stayed at 10/10 the whole game.
What’s broken (for the dev team)
How the pieces fit, using the names from the AI state tree and scardocs. The two defects are from comparing the 16.3.11308 and 17.0 builds; the tests below confirm the villager food cost is the link.
- Gatherer split. The AI’s gatherer distribution gives each active resource one slot, then assigns each remaining villager to the resource with the best
demand / (gather rate x villagers already on it).
- Demand per resource is base demand from planned production, plus the strategy targets from
AIStrategyTrack_AddRequiredResources (Age 1: 550 food, 500 wood), minus the surplus stockpile.
- Base demand.
AIPlayerTask_GenerateProduction keeps it as a moving average of cost x count over the planned production items. The live gatherer re-solve then reads it.
- Villager count. For villagers, the count comes from a “how many more villagers are worth training” simulation. It runs a temporary gatherer solve, then adds one villager at a time (20 s and 50 food each) while that shortens the time to meet demand, up to 100.
- Two defects in that simulation in 17.0. The gatherer solver was restructured in 17.0 to group gatherers by unit blueprint and check which resources each one can gather. The planner’s temporary solve didn’t get the matching changes:
- The counter it returns is never initialised.
- In 16.3, “gatherers left to place” and “extra villagers” were separate counters, and the second one always started at 0.
- In 17.0 they were merged into one counter that the pre-allocation step decrements and the “train one more” loop increments, and nothing resets it.
- The solve is a short-lived temporary, so the counter starts from whatever was left in memory, and the result is leftover value plus up to 100.
- My guess is that this leftover differs between games and civs. That would explain why Mongols vary and why some AIs drift onto wood late in a game.
- It never places the AI’s existing villagers. Only the live gathering update fills the new per-blueprint groups. The planner’s temporary solve starts with about 1 gatherer per resource, so adding villagers always looks worthwhile. The gatherer count passed into it is never used.
- Result. In my reconstruction of the logic, the planner wants 100+ more villagers, and the number keeps climbing. At 50 food each, base food demand runs into the thousands, against about 500 for wood.
- The split puts nearly everyone on food and leaves wood with its single slot.
- Banked food doesn’t help, because the imagined demand is bigger than any stockpile.
- It matches test 1: nearly every villager on food and 0 to 1 on wood, with 2000+ food banked.
Suggested fix: in the planner’s villager estimate, initialise the counter to 0, and place the AI’s existing villagers (or use the gatherer count it is given) before adding new ones. The counter is the critical part; placing existing villagers is also needed to match 16.3.
Vikings: both Viking town centers have item_cost_adjustment food -100 on the villager spawn item, so Viking villagers cost 0 food. A broken count times 0 food adds no demand.
- When I removed the discount (test 4), the Viking AI showed the broken pattern in its opening, then recovered by 5:00. So something else protects them later.
- My guess is that villager production via
toggle_villager_production_vik keeps them out of the estimate. Unverified.
Tests
Setup: single player skirmish, Dry Arabia (seed 744b0fde), me idle vs 7 allied Hard AIs. A read-only logger in the dev SCAR console recorded every AI every 30 seconds.
Test 1, unmodified, at 10:00:
| Civ |
Pop / cap |
Villagers on food / wood / gold |
Lumber camps |
Food banked |
| Malians |
10 / 10 |
9 / 0 / 0 |
0 |
2160 |
| English |
25 / 30 |
20 / 1 / 2 |
0 |
2600 |
| Japanese |
26 / 30 |
22 / 0 / 2 |
0 |
2263 |
| Scots |
24 / 25 |
23 / 1 / 0 |
0 |
2131 |
| French |
26 / 30 |
24 / 0 / 1 |
0 |
2624 |
| Vikings |
45 / 85 |
16 / 6 / 9 |
1 |
572 |
| Mongols |
34 / 200 |
11 / 7 / 3 |
0 (gers) |
125 |
Test 2, 500 wood gifted at 3:00: the AIs spent it sensibly on houses, mills and military, then went back to zero on wood. AIs with a lumber camp still kept zero on wood. So the build logic and dropoffs are fine.
Test 3, gatherer override: AIPlayer_SetGathererDistributionOverride plus AIPlayer_UpdateGathering restored wood gathering within a minute. Re-applied every 45 s, it gave 39 to 42 pop and 15 to 19 military at 10:00, vs 10 to 26 pop and 1 to 2 military. So the gathering machinery works; the default split is wrong.
Test 4, villager food cost (tuning pack, no scripts): French villagers set to 0 food. The Viking TC villager discount removed, so Viking villagers cost 50.
|
Food / wood / gold villagers at 3:00 |
Pop / cap at 10:00 |
Military at 10:00 |
Food banked at 10:00 |
| French, unmodified |
10 / 0 / 1 |
26 / 30 |
1 |
2624 |
| French, free villagers |
0 / 8 / 0 |
42 / 50 |
17 |
331 |
| Vikings, unmodified |
0 / 8 / 1 |
45 / 85 |
13 |
572 |
| Vikings, paid villagers |
10 / 0 / 3 |
41 / 85 |
10 |
71 |
Test 5, AI-only fix (script): a player modifier (resource_entity_cost_food x0 on the villager) for four AIs only. The script charged the food back for every villager they made, about 1000 food per AI by 12:00, so they got no free economy. The Japanese AI in the same game was left untouched as a control.
| Civ |
Pop / cap, military at 10:00, unmodified |
With the fix |
| Malians |
10 / 10, 1 |
33 / 35, 12 |
| Scots |
24 / 25, 2 |
34 / 45, 12 |
| English |
25 / 30, 1 |
41 / 50, 17 |
| French |
26 / 30, 1 |
35 / 40, 11 |
| Japanese (control) |
26 / 30, 2 |
27 / 30, 2 (2482 food, 0 on wood) |
By 12:00 the four fixed AIs were at 41 to 45 pop with 14 to 20 military. The Japanese AI was capped at 30/30 with 3085 food.
Ruled out:
- AI attribute data and AI Lua scoring: no changes for existing civs.
- The new
allow_far_gather_on_deposit_types field: a tuning pack adding tree, gold and stone did nothing.
- The tree’s
SetOverrideResourceGathererDistribution node: it’s in the campaign root only.
- Strategy resource targets: unchanged apart from a new
ScotsStart entry.
- Vision and naval map detection.
Details:
- Build 17.0.12182.0 (rtm 4184287), Steam, Windows 11, offline skirmish, standard_mode.
- No Lua or SCAR errors during any test.
- Docs note: scardocs types the second argument of
AIPlayer_SetGathererDistributionOverride as Real, but it takes a table such as {food=0.4, wood=0.4, gold=0.15, stone=0.05}.
Happy to share the logs, scripts, test replays (they only play on this build) and a more detailed technical write-up with the team privately.