sda*_*das 8 artificial-intelligence machine-learning
具体来说,我正在谈论本次比赛的编程:http://www.nodewar.com/about
比赛涉及到你在二维世界中与其他团队一起拥有一群宇宙飞船.船只受到边界的约束(如果它们退出它们死亡),它们必须不断地避开卫星(他们用重力拉动船只).目标是杀死对方女王.
我试图编写一些相对基本的技术,但我觉得我错过了一些基本的东西.
例如,我实现了一些boids行为(http://www.red3d.com/cwr/boids/),但它们似乎缺少...目标,可以这么说.
对于这种游戏,是否有任何常用技术(或者,最好是技术组合)?
编辑
我想以赏金再次打开这个,因为我觉得我仍然缺少重要的信息.以下是我的NodeWar代码:
boundary_field = (o, position) ->
distance = (o.game.moon_field - o.lib.vec.len(o.lib.vec.diff(position, o.game.center)))
return distance
moon_field = (o, position) ->
return o.lib.vec.len(o.lib.vec.diff(position, o.moons[0].pos))
ai.step = (o) ->
torque = 0;
thrust = 0;
label = null;
fields = [boundary_field, moon_field]
# Total the potential fields and determine a target.
target = [0, 0]
score = -1000000
step = 1
square = 1
for x in [(-square + o.me.pos[0])..(square + o.me.pos[0])] by step
for y in [(-square + o.me.pos[1])..(square + o.me.pos[1])] by step
position = [x, y]
continue if o.lib.vec.len(position) > o.game.moon_field
value = (fields.map (f) -> f(o, position)).reduce (t, s) -> t + s
target = position if value > score
score = value if value > score
label = target
{ torque, thrust } = o.lib.targeting.simpleTarget(o.me, target)
return { torque, thrust, label }
Run Code Online (Sandbox Code Playgroud)
然而,我可能错误地实现了潜在的字段,因为我能找到的所有示例都是关于离散运动(而NodeWar是连续的而不是精确的).
主要的问题是我的AI永远不会在游戏区域内停留超过10秒而不会飞离屏幕或坠入月球.
你可以通过向你的boids添加额外的转向行为和/或修改默认值来轻松地使boids算法玩Nodewar游戏.例如,您可以添加转向行为以避开月球,并为敌舰添加转向行为(排斥或吸引力,取决于您和敌舰之间的位置).然后应该调整吸引力/排斥力的权重(可能通过遗传算法,彼此进行不同的配置).
我相信这种方法会给你一个相对强大的基线玩家,你可以开始添加协作策略等.
| 归档时间: |
|
| 查看次数: |
373 次 |
| 最近记录: |