单村民建设AI
开局只有一个村民 一个斥候骑兵 资源只有100木头 想村民通过采集一定数量的资源建造城镇中心村民采集到一定数量木头(建造城镇中心需要木头量)再建造采矿场采集石头
问题村民开头会到处走。 然后再建造采木场 然后村民伐木伐木到一定木头量。
建造采矿场会站着不动 或者跑到外面探索。
代码如下
(defrule
(game-time > 0)
=>
(set-strategic-number sn-maximum-food-drop-distance -2)
(set-strategic-number sn-maximum-wood-drop-distance -2)
(set-strategic-number sn-maximum-gold-drop-distance -2)
(set-strategic-number sn-maximum-stone-drop-distance -2)
(set-strategic-number sn-maximum-hunt-drop-distance -2)
(set-strategic-number sn-cap-civilian-explorers 0)
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-percent-enemy-sighted-response 100)
(set-strategic-number sn-hits-before-alliance-change 25)
(set-strategic-number sn-number-explore-groups 1)
(set-strategic-number sn-percent-attack-soldiers 0)
(set-strategic-number sn-task-ungrouped-soldiers 0)
(set-strategic-number sn-number-attack-groups 0)
(set-strategic-number sn-enemy-sighted-response-distance 10)
(set-strategic-number sn-total-number-explorers 0)
(set-strategic-number sn-relic-return-distance 0)
(disable-self)
)
(defrule
(building-type-count-total town-center c:<= 0)
(building-type-count-total lumber-camp c:<= 0)
(wood-amount < 275)
(can-build lumber-camp)
=>
(set-strategic-number sn-food-gatherer-percentage 0)
(set-strategic-number sn-wood-gatherer-percentage 100)
(set-strategic-number sn-gold-gatherer-percentage 0)
(set-strategic-number sn-stone-gatherer-percentage 0)
(set-strategic-number sn-maximum-wood-drop-distance 8)
(build lumber-camp)
)
(defrule
(building-type-count-total town-center c:<= 0)
(building-type-count-total lumber-camp c:> 0)
(building-type-count-total mining-camp c:<= 0)
(wood-amount >= 375)
;(can-build mining-camp)
=>
(set-strategic-number sn-food-gatherer-percentage 0)
(set-strategic-number sn-wood-gatherer-percentage 0)
(set-strategic-number sn-gold-gatherer-percentage 0)
(set-strategic-number sn-stone-gatherer-percentage 100)
(up-modify-sn sn-maximum-stone-drop-distance c: 10)
(build mining-camp)
)
(defrule
(building-type-count-total town-center c:<= 0)
(can-build town-center)
=>
(build town-center)
) 本帖最后由 blazefires 于 2020-5-28 20:33 编辑
没人帮忙的确有点惨xd
无城镇中心对AI来说是最致命的
AI无法找到自己家的位置,直接变成游民{:5_432:} 此时,
最大城镇规模自动变成无限大
所有策略值将近一半都失效
你上面设定的那些 防守部队阿 攻击部队阿 采集距离这些都变成无效
AI再建造上会将建筑物建在全图范围,倘若选择的建造点无法建造(地形未探索),那AI就需要去探索,1村民会自动去探索,3村民就会全部发呆。
但你想要的功能也不是不能实现,只是要用暴力法
首先,你得用place-point或是up-build-line的方式让AI在某座标点盖建筑物
盖完後,你要用DUC疯狂让AI村民去砍树或采金石才行
不这样做你的AI可能采到一半又会跑去探索
循环直到你的AI盖出第一座城镇中心为止 blazefires 发表于 2020-5-28 20:24
没人帮忙的确有点惨xd
无城镇中心对AI来说是最致命的
谢谢解答
页:
[1]