AI scripting: Herders are not included in the `villager-food` set

:play_button: GAME INFORMATION

:backhand_index_pointing_down: These details are CRITICAL; DO NOT skip them or your issue may not be reviewed.

  • GAME BUILD #: 18848918
  • GAME PLATFORM: Steam
  • OPERATING SYSTEM: Windows 11

:play_button: ISSUE EXPERIENCED

villager-food is a handy set to use for roughly counting or selecting all food villagers. It should obviously include the new herders that work on animals on pastures, but it does not! Note, however, that the villager counts in the resource bar are correct.

:play_button: FREQUENCY OF ISSUE

:backhand_index_pointing_down: How often does the issue occur?

  • 100% of the time / matches I play (ALWAYS)

:play_button: REPRODUCTION STEPS

To verify the issue, simply add the following snippet to a working Khitans AI, making sure to first define gl-1 to a vacant goal ID and define the missing herder constants (1891 and 1892) and KHITANS-CIV:

#load-if-defined KHITANS-CIV
	(defrule
		(true)
	=>
		(up-get-fact unit-type-count villager-food gl-1)
		(up-modify-goal gl-1 c:max 0)
		(up-chat-data-to-self "villager-food: %d" g: gl-1)
		(up-get-fact unit-type-count female-herder gl-1)
		(up-modify-goal gl-1 c:max 0)
		(up-get-fact unit-type-count male-herder gl-2)
		(up-modify-goal gl-1 c:max 0)
		(up-modify-goal gl-1 g:+ gl-2)
		(up-chat-data-to-self "herders: %d" g: gl-1)
		(set-goal gl-1 -1)
		(set-goal gl-2 -1)
	)
#end-if

Once food economy has made the transition over to pastures, villager-food will go to (or near) zero, while the number of herders keeps growing.

:play_button: EXPECTED RESULT

:backhand_index_pointing_down: What was SUPPOSED to happen if the bug you encountered were not present?

The expected outcome would be convergence of the numbers, since herders should be included in villager-food and should over time dominate the food villager population.

:play_button: IMAGE

:backhand_index_pointing_down: ALWAYS attach a PICTURE (.jpg, .png, .gif) or VIDEO (.mp4, YouTube link) that highlights the problem.


image

:play_button: GAME FILES (SAVE / RECORDING)

:backhand_index_pointing_down: Attach a SAVE GAME (.aoe2spgame) or GAME RECORDING (.aoe2record) of the match where you encountered the issue. Link it below if using an external file service.
SP Replay v101.103.16877.0 @2025.06.28 150709.aoe2record (1.5 MB)
The problem appears clearly towards the end of the recording.

(I am sorry about the not very optimized build order, although I know the rough idea has potential, especially with Goths on maps with deer that can be pushed in en masse, justifying the early barracks and late mill.)
*

A bonus to the fix would be if you could also add a villager-herder set that combines the two herder IDs. (While we’re at it, I wouldn’t exactly hate a wild-chicken set either, since they typically need separate treatment from pushable huntables in the deer class.)

The latest patch notes claim that this issue has been fixed. I assume that this is the case.

What remains is the feature request for villager-herder.