追忆那一刻 发表于 2010-6-25 20:30:07


(defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 45)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 50)
(chat-to-all "Town-size-attack: 50")
)
弄进AI里开始时提示错误2005attack-goal ?
要怎么样才能成立这个TSA?

老胡V1 发表于 2010-6-25 22:58:55

attack-goal是之前已经定义过的常数,整个句子意思是要攻击了,可以不要

陈勇全 发表于 2010-7-3 21:41:15

我只懂一点AI的性能...............................................

kingrwn 发表于 2010-7-6 17:35:28

看到一大堆代码就头晕,不如发个补丁

老不死的 发表于 2010-7-28 17:00:49

找了很久就是这个看了很久 代码加英文在加中文 看的我头晕 本来似懂非懂现在是云里雾里 拜求版主直接做成AI发给我好吗

老不死的 发表于 2010-7-28 19:33:21

我又看了很久 请版主看一下是不是这样的
   (defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 40)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 45)
(chat-to-all "Town-size-attack: 45")
)

(defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 45)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 50)
(chat-to-all "Town-size-attack: 50")
)

(defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 50)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 55)
(chat-to-all "Town-size-attack: 55")
)
(defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 55)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 60)
(chat-to-all "Town-size-attack: 60")
)

(defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 60)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 65)
(chat-to-all "Town-size-attack: 65")
)

(defrule
(goal attack-goal attacking-now)
(strategic-number sn-maximum-town-size == 65)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 70)
(chat-to-all "Town-size-attack: 70")
)

旧月 发表于 2010-7-28 23:27:21

恩恩。。
其实还有改进的地方的。。
正在翻译一篇教程。。
到时候一并发上来

bingbing 发表于 2010-7-29 11:22:59

我测试发现,TSA并非万能药。
测试方法是,死亡竞赛模式,我跟一家是用了TSA的人工智能(选的是咱们论坛的2012)对打,我不造兵,建筑只造城墙。
城墙的位置有三个,一是正常城镇范围,偏向敌人一侧,二是起始城镇中心附近,三是离敌人最远处
测试得到不同地图下,的2012AI攻击到这三处城墙所需的TSA尺寸(也就是sn-maximum-town-size的值)
tsa尺寸: 第一个数字是到最近的城墙,第二个是到初始城镇中心,第三个是到地图最远处
          巨型地图 145-155-250
          8人地图 140-170-245
          6人地图 135-145-?
          4人地图 90-105-170
          3人地图 85-100-130
          微型地图 50-65-120

需要说明的是:这些只是一个大概的值,因为地图是一个左右对角线长的菱形,当双方位于地图左右两端时,值会大一些;当双方位于上下两端时,值会小一些。

另外出现的问题是:
1 在某个size处卡住,虽然判断有敌军建筑,但是不进攻,估计是建筑过小,正好处在边界所致
2 有时会越过size,直到最大尺寸250,却没有出现攻击攻击动作,在6人和8人各遇到了一次。看来TSA还是应该跟attack-now配合使用,达到了某个最大值是应该使用attack-now

投石 发表于 2010-8-17 01:33:38

拜读
请问数值难道要+5 到256???!!!
(set-strategic-number sn-maximum-town-size xx)
不是很会的人问问

旧月 发表于 2010-8-18 11:22:01

其实可以粗略一点,跨步大一些。

htyhtyhty 发表于 2011-1-22 15:27:12

压根不懂AI~晕闷死了~想做个战役太难了~LZ我想做一个我守城,电脑攻城的战役~就像科雷西那样的,不过比那个简单多了~用游戏自带的编辑器能做出来?

jlusa 发表于 2011-4-18 12:32:33

攻击丝毫没有停顿。那可是相当厉害啊!

jayly15 发表于 2011-5-13 12:03:53

我想问下:这种攻击方式,能不能理解为:电脑单位不会停止不动,不断寻找目标攻击?

jayly15 发表于 2011-5-13 16:39:45

本帖最后由 jayly15 于 2011-10-22 22:09 编辑

如果我把以下内容当成TSA的AI, 是否正确?是否能达到士兵不断的寻找目标攻击的效果?
(defrule
(game-time > 600)
(strategic-number sn-maximum-town-size == 40)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 60)
(chat-to-all "Town-size-attack: 60")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 60)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 80)
(chat-to-all "Town-size-attack: 80")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 80)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 100)
(chat-to-all "Town-size-attack: 100")
(disable-self)
)
(defrule
(strategic-number sn-maximum-town-size == 100)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 120)
(chat-to-all "Town-size-attack: 120")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 120)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 140)
(chat-to-all "Town-size-attack: 140")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 140)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 160)
(chat-to-all "Town-size-attack: 160")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 160)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 180)
(chat-to-all "Town-size-attack: 180")
(disable-self)
)


(defrule
(strategic-number sn-maximum-town-size == 180)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 200)
(chat-to-all "Town-size-attack: 200")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 200)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 220)
(chat-to-all "Town-size-attack: 220")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 220)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 240)
(chat-to-all "Town-size-attack: 240")
(disable-self)
)

(defrule
(strategic-number sn-maximum-town-size == 240)
(not(enemy-buildings-in-town))
=>
(set-strategic-number sn-maximum-town-size 250)
(chat-to-all "Town-size-attack: 250")
)

小二哥 发表于 2011-6-12 23:40:22

没看明白,新手

粹纳帝国 发表于 2011-6-24 23:50:16

35楼第一句就写错。。

jayly15 发表于 2011-10-22 16:24:07

粹纳帝国 发表于 2011-6-24 23:50 static/image/common/back.gif
35楼第一句就写错。。

可以指出来吗,该怎么写才对?

粹纳帝国 发表于 2011-10-22 21:42:18

回复 jayly15 的帖子

(defrule
(game-time > 600)
(strategic-number sn-maximum-town-size == 40)
(not(enemy-buildings-in-town))(disable-self)这里错。。。汗,需要指出吗
=>
(set-strategic-number sn-maximum-town-size 60)
(chat-to-all "Town-size-attack: 60")(disable-self)
)

jayly15 发表于 2011-10-22 22:06:13

回复 粹纳帝国 的帖子

真没有注意,失礼失礼了
页: 1 [2]
查看完整版本: AI攻击的第二种方式——TSA!