Project

General

Profile

Actions

Bug #2457

open

ai: buys barracks before defenders

Added by Sweet Tea Dorminy 3 days ago. Updated 3 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
AI
Target version:
-
Start date:
11/08/2026
Due date:
% Done:

0%

Estimated time:

Description

adjust_ai_unit_choice() in daimilitary.c turns any non-veteran military unit choice into the building that grants veterancy, if it can. It never looks at the city to see if there's an actual defender...

The walls path a few lines down refuses to build walls before the first defender ("Walls will help nothing if there's nobody behind them"); but the same is true for barracks.

Patch keeps the unit when no defender of ours stands in the city.


Files

Actions #1

Updated by Marko Lindqvist 3 days ago

The difference between "building Unit + Barracks" vs "building Barracks + Unit" is that in the latter case the unit gained veterancy from the Barracks when built.
City Walls OTOH provides nothing without a unit in the city.

Actions #2

Updated by Sweet Tea Dorminy 3 days ago

It is true, and it is a reasonable argument. I've never played with building barracks first, but it's plausible that it's a playstyle that is superior. Fine to close this as invalid / not obviously a correct change of behavior. Thanks!

Actions

Also available in: Atom PDF