ai如何建立剪切蒙版一个完整的游戏ai

游戏AI系列内容 咋样才能做个有意思的AI呢
写在前面的话
怪物AI怎么才能做的比较有意思。其实这个命题有点大,我作为一个仅仅进入游戏行业两年接触怪物AI还不到一年的程序员来说,来谈这个话题,我想我是不够格的。不过,在这有限的时间里边,我也多多少少的写过几个怪物。最初,很多怪物写完之后,就感觉很傻。一点意思都没有到后来的,慢慢的觉得,像是一点一点的赋予这个怪物生命一样,成就感满满。然后让我一步一步的告诉你什么是有意思的AI。
啊 什么才是有意思的AI呢
从宏观上来说,大到一个人,小到一只青蛙,都是存在AI的。落实到游戏项目里呢,能跟你打一会的,都叫做AI。我们这个地方很显然是指的后边这种。仿照现实世界AI的游戏AI。让我举个例子来说明一下,我们比较常见的AI。
LOL的人机模式,有一定的智能感觉,不过做的有点太极端了。技能的释放,简直爆表,恐怕跟机器人硬肛正面一般情况下会比较惨,因为他们对于技能释放的控制恐怕是人类远远跟不上的。不过他们的行为模式非常单一,比如说他们明明在中路占有非常大的优势,但是一旦他们发现你在推他们的塔了,他们就会放弃自己的优势去防守自己的防御塔。比如说你是血皮他也是血皮的情况下,他的反应是逃跑而不是算算伤害跟你肛正面。所以这个感觉是比较尴尬的,硬打打不过,但是套路就能套路赢。顺便一提LOL的末日模式里边中的机器人,其实单纯的AI也是比较简单的,但是他们的技能非常变态,所以很难打,这也是提高AI有意思程度的一种方式,笑。
守望先锋中的机器人对战模式中,跟LOL中的机器人也是类似的模式。记得一次,我想从背后偷袭76,结果被76反手A死,我去看死亡回放的时候,发现上一秒的时候,他还是面向前方的,下一秒直接镜头一切,冲背后的我开了几枪,等我死了,就头也不回的跑了,当时就感觉整个人都不好了。
哈哈,举了几个例子,发现,我好像是没有见过好的AI的例子。这么说吧,一个AI应该像是你朋友跟你玩游戏一样,初级的AI就像是刚开始玩;中级的就像是玩了一段时间;高级的像是比你NB的玩家一样。或许他的操作并不好,或许他在某些事情上会失误,但是他在努力的玩下去这种感觉。
好吧,先让我来回顾一下我做的怪物吧
那些曾经被我编写出来的怪物
1. 如果看到玩家就靠近玩家,造成碰触伤害
2. 没事瞎溜达或者在原地歇会
我们的小魔人
这应该是我编写的第一个怪物。很简单,也很傻。这个基本上应该算是最白痴的AI了。这种一般情况下是数量比较多,让玩家来割草的。不得不承认,这个怪物的AI白痴到爆炸,但是游戏中还是需要存在这种AI来缓解一下紧张的气氛。
1. 看到玩家之后会最初几种随机攻击模式(发射距离较远的双排子弹弹幕、发射范围非常近的的扇形弹幕、跳跃到玩家周围去、召唤救济仓)
2. 没事的时候瞎溜达一下或者在原地休息休息
大魔人召唤救济仓
大魔人的扇形散射弹幕
大魔人的双排弹幕
大魔人的蹦蹦跳跳
这是我编写的第一个Boss怪物。这个的攻击方式可能就会变的复杂一些了。面对他的时候,你可能需要考虑一下怎么应对他的技能。比如说。如果他释放双排弹幕的话,就不要呆在原地。如果他释放了扇形弹幕那么就需要远离他。如果他跳起来了,那么就得时刻留意,他的阴影是不是出现在了自己的周围,远离那个地点。如果他选择召唤救济仓就需要打掉救济仓,免得他搞出来一些幺蛾子。或许,这个怪物已经可以让你跟他周旋一段时间了。但是他距离我心目中那种真正的Boss还差的很远。
大魔人的狗
略,实在是没啥好写的
激光眼机器人
1. 醒了,距离你比较远了就靠近你
2. 像是之前的大魔人类似,一堆技能(背后光柱扫射、横向光柱驱散、双手弹幕散射、激光眼、多重激光狙击、召唤狙击怪、弹幕光球)随机放
3. 如果敌人(玩家)在他的头上的时候释放合适的技能()
4. 如果在下面的时候释放合适的技能()
5. 没事睡觉
我们的激光眼机器人
机器人召唤狙击怪
机器人双手发射弹幕
机器人背后激光扫射
机器人激光狙击
机器人激光逼退敌人
机器人发射球形弹幕
我在写这个怪物的时候觉得这个怪物碉堡了,自己拥有7、8个技能在手里边,肯定会把玩家吓尿的,结果自己在尝试的时候,就遇到了类似于LOL的AI尴尬。如果吧技能调整的伤害很强,会觉得这个怪物没法打,自己动不动就死了。但是技能伤害太弱的时候就会发现这个怪物真是太弱B了。随便打打就死了,最后为了增加他的寿命,所以增加了他的血量。我觉得这个结果是我不想看到的但是有没什么办法,这已经是最好的方式了。
1. 进入战斗的时候冲着玩家吐个弹幕
2. 距离玩家很近的时候会逃跑
3. 距离玩家太原的时候会尝试靠近
4. 玩家不见了会跑到最近一次玩家出现过的地方尝试找找玩家
5. 没事瞎溜达
我们的小精灵
Piu 精灵弹幕
太近了我要逃跑
太远了,让我来追击一下吧
根据印象追击敌人
其实这个怪物也很简单,跟前面提到的小魔人是同一个属性的,都是属于没啥攻击性,被人割草类型的,不过,这个怪物却比小魔人给人的感觉更好。因为小魔人太容易被套路了,你距离他远一点,就可以随便搞他。但是这个怪物,他可以跟你周旋一段时间,虽然他没有啥攻击性。偶尔只是冲你发一个弹幕。但是他却可以保持跟在你周围,并且距离你相对来说距离适中。避免了近战伤害,同时他的攻击能够攻击到你。所以就可玩性来说这个逼小魔人好太多了
1. 距离在攻击范围内的时候,会直接发动伤害非常大的伤害
2. 如果没有被人发现的时候伪装成一颗洋葱
3. 距离玩家比较远并且在玩家正面的时候尝试Z字走法靠近玩家
4. 距离玩家比较远并且在玩家背面的是后快速突进到玩家背面
5. 没事瞎溜达
我们的刺客像洋葱
平时的刺客
刺客的Z字强突
刺客的十字斩
这个怪物应该算是比较厉害的怪物了,也是我比较满意的怪物之一。他的血量非常少,最低级的枪也能两枪打死。他的伤害非常高,一次攻击就能让玩家血量损失过半。通常这个怪物出现的时候,我都会觉得,要死了要死了要死了,搞死他的时候会获得莫大的挤压情绪释放的赶脚。或许他没有非常高的血量,没有花样繁多的技能。不过他能够靠着自己仅有的一个技能让你感觉精神紧张。
一个好的AI,应该能在合适的时候做出合适的选择。比如,怪物本身并不能进行近战攻击,那么他冲到人的周围这就是傻的行为。如果他能保持一定的距离,这个距离保证他能够打到玩家,但是玩家的某些攻击打不到他。那么他的行为就是合适的。如果一只怪物他只有近战攻击,那么他就应该努力的尝试去靠近你,然后从背后给你一刀,这也是合适的。如果你的攻击手段攻击距离比较近,但是玩家距离你比较远的话,这个时候你做出这个攻击就并不合适。一个好的AI其实就是作者在操作的一个角色,跟玩家对战。其实这就是一种感觉,要想想成这是你与玩家的对决。或许你可以操作的怪物能力非常有限。血量不高、伤害不高、行动不快,但是每一个怪物都有他存在的意义,都能够为你跟玩家对战的时候贡献自己的力量。这样一个AI才能算是做的比较有意思。
恐怕我我写的出来的部分只能是一小部分。就像是这样
但是呢实际上这个课题可能真正的内容量确实这样
阅读(...) 评论()游戏AI_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!2010年9月 专题开发/技术/项目大版内专家分月排行榜第三2010年7月 专题开发/技术/项目大版内专家分月排行榜第三
2010年9月 专题开发/技术/项目大版内专家分月排行榜第三2010年7月 专题开发/技术/项目大版内专家分月排行榜第三
2010年9月 专题开发/技术/项目大版内专家分月排行榜第三2010年7月 专题开发/技术/项目大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。如何创造出真正有趣的游戏AI - 推酷
如何创造出真正有趣的游戏AI
作者:Darran Jamieson
为计算机对手创造优秀的人工智能是非常困难的。为一款国际象棋般的游戏编写程序是极具挑战性的;而添加具有说服力的AI甚至需要花费比创造游戏本身更长的时间。当我们在创造这样的AI时我们该怎么做?我们是否应该检查面板上每个可能的移动,或者我们是否只需要让它随机移动?AI需要做什么,或者最重要的是,我们该如何确保AI足够有趣?
优秀的AI与有趣的AI
AI这一词真的具有非常广泛的概念,并且AI类型也是取决于游戏。像《太空入侵者》,《马里奥》或《炮塔防御》等非对称游戏都允许玩家能够轻松地穿越大量敌人。因为“团队”(玩家vs其余的一切)是不平衡的,所以这些游戏总是倾向于使用较为愚蠢的AI。而像《星际争霸》,《街头霸王》或《文明》等对称游戏则期待玩家能够公平地击败对手,所以这类型游戏需要更复杂的AI。
然而对游戏来说最重要的还是乐趣。玩家喜欢挑战,也不希望一直输。实际上,像西洋棋等游戏已经得到“解决”,即意味着我们能在这类型游戏中创造一个所向无敌的AI。
当我和团队致力于我们的计算机/桌面游戏《Infected》时,我们必须确保第一个关卡的AI不会太吓人,从而避免吓跑玩家。一开始游戏AI较简单,计算机主要将展开进攻,即它会完全专注于高分游戏而未考虑防御。
尽管这时候的AI较弱,我们还是发现一些新玩家很容易被打压或对此失去兴趣。我们多次修改了AI,但是对于某些玩家来说它仍然具有很大的挑战。最终我们还是决定删除AI从而确保游戏每次都能够随机发展。尽管有些玩家还是会遭遇失败,但这一做法有效提高了玩家留存,并让我们能在之后关卡中再次加入复杂的AI。
我们可以在各种不同的游戏中看到“太优秀的”AI的问题:就像带有bot的第一人称射击游戏拥有360度视角,或者在打斗游戏中玩家将对抗带有完美反应能力的bot。与这些AI对抗并不能真正教授玩家如何有效玩游戏:这只能教授他们如何面对bot,并尝试着找出一些能够轻松消灭它们的方法。
然而这并不是说所有的AI都应该很弱,优秀的AI也具有多面性。比起一个每次都能完美完成游戏的AI,赋予AI适应能力(游戏邦注:从而增添游戏玩法的多样性)能够提供给玩家更多娱乐性。
赋予它们人性
在完成《Infected》后,我们简单规划了游戏续集《Infected 2》。游戏仍是使用同样的前提,但却是基于提供更大的规模,即与经典的桌面游戏《Risk》相似。因为游戏变得更大,所以我们必须大规模地完善AI:确保玩家能够在更长的游戏中仍然拥有乐趣,并且在这里也能够让多个AI相互抗衡。
我们尝试了之前的AI并发现了一些问题。这一AI是可预测的,但我们仍可以去完善它。但是还有一个更大的问题是关于AI的态度以及它的游戏方式。
这里主要存在三大问题:
首先:与AI对抗并不是特别有趣。
其次:打败AI并不能带来特别奖励。
再次:玩家很容易作弊。
在游戏中与其他玩家对抗是有趣的,但是与AI对抗却不是这样。尽管游戏中的挑战级别还是不变,游戏玩法也不变,那为什么玩家对抗AI与玩家对抗玩家之间存在如此巨大的差别?
要知道人类有一样东西是计算机并不具有的:情感。
而获得情感便是我们玩游戏的部分内容;我们喜欢刺激的胜利感,我们也讨厌痛苦的挫败感。我们喜欢在朋友面前炫耀自己的胜利,而当朋友背叛自己时我们也会想要向他们复仇。游戏总是与我们的情感紧密联系在一起,这也是AI不曾体验到的,而这也是作为开发者的我们想要效仿的内容。
为什么与AI游戏并不有趣?
因为人工智能太过人工化。所有的bot都是基于同样的方式游戏,并且他们的移动模式都是可预测的。
我们需要让它们能够脱颖而出。于是我们便添加了一些个性:鲁莽的,自卫的,具有探索精神的。AI将赋予特定策略一些人为感,然后将转向那些攻击模式。
甚至在基本形式中,这也取得了一个巨大的进步:每一次游戏都不再相同,并且敌人的移动变得难以预测,玩家很难再制定一份单一的“游戏获胜”策略。当游戏开始时如果AI是随机的,那么玩家便不能预测之后的游戏会如何展开。
AI的特性并非一个全新理念。《文明》便已经赋予了主角特性(Gandhi非常喜欢攻击别人),《神话时代》的AI也能决定自己是否能够使用像龟缩或冲刺等策略,还有《虚幻竞技场》的bot能够选择自己喜欢的武器。
gandhi-civ(from tutsplus)
为什么打败AI不具有奖励性?
这里存在的主要问题是,每一轮游戏中AI都是以“最佳移动”的方式在游戏。它只是在评估游戏面板而不存在对于外交的奖励。如果它需要攻击你的话它就会这么做。如果你回击它的话,它也毫不在意。它只是将游戏作为一个待解决的数学题,而不是与复杂的人类玩家对抗的游戏。所以与人工智能的对抗便只会让人觉得这是一款人工游戏。
对此我们的解决方法是源自1989年一款名为《核战争》的Amiga游戏。在《核战争》中,你能对抗各个世界的领导者并尝试着对他们的国家发动核进攻。不管谁只要能够成功生存下来便能赢得游戏。尽管游戏很简单,但是看到敌人被仇恨蒙蔽了双眼并深陷战斗中还是非常有趣的。
这一“朋友和敌人”系统使用了一个非常简单的参数:幸福。每个世界的领导者都拥有各种面部表情,从而让玩家能够轻松地判断他对自己的态度。显然,攻击别人总是很快让他们不悦。此外你的敌人不只是会对你生气,他们也会彼此生气。这意味着一颗导弹有可能逐步升级为一场致命的战斗。
再一次地,这一系统也出现在许多游戏中,其中也包括了《文明》。一个拥有高度“幸福感”的帝国更有可能与你结盟并赠与你礼物,而一个讨厌你的敌人可能会引进大量资源去摧毁你的城市。
通过添加基本的幸福指标到游戏中,我们便能够创造出友谊与竞争。当你在游戏中添加惩罚机制,或者当游戏中出现团队和联盟时,游戏会变得更刺激。瞬间游戏变得更有个性,且游戏行动也变得更有分量。我们同样也发现可行的幸福指标非常重要,如果缺少了它玩家便不能理解到底发生了什么。就像单纯的笑脸图标能够直接传达出敌人不悦的情况,并且基于特定行动去观察脸部表情的变化能够让玩家更清楚地了解这些行动的结果。
囚徒困境悖论是非常有名的游戏理论概念,许多程序员也花了很多时间尝试着去创造反复囚徒困境中可抗衡的终极bot。但是让人奇怪的是多年以来获胜策略仍然非常简单:即我们所谓的争锋相对,这只是在复制对手的行动。
AI是如何作弊的?
《Infected 2》中有一个问题是,AI通常没什么远见。AI的目标是在每一轮游戏中获得最多分数:如果这意味着做出最糟糕的移动,它们也会这么做。
我们可以在如下情节中看到这点:
Alice,Bob和Carol正在玩战争游戏。
Alice拥有100个士兵。Bob拥有75个士兵。Carol拥有150个士兵。
不管是Alice还是Bob都不能打败Carol。
然而如果Alice和Bob联合在一起便能打败Carol。
这里的问题在于AI将做任何能够帮助自己获得最多分数的事。在上述情节中,这便意味着Alice将攻击Bob:从短期角度看来,这是最出色的行动,但从长期角度看来,这却糟糕透顶。如果Alice选择这么做,那么她不仅会摧毁自己,她也是在处罚Bob。而Bob对此将非常难过。
这种情况是很难避免的,因为从宏观层面看待事情是最简单的AI不可能做到的。我们尝试着通过避免玩家在失败时或刚遭遇攻击时不再被攻击而保证其中的“公平性”。尽管并不是所有游戏都适用同一个简单的解决方法,但我们都需要意识到玩家讨厌因为莫名其妙的原因遭遇攻击这一事实。
尽管《Infected 2》并未通过测试阶段,但它却教会了我们一些宝贵的经验教训。最重要的是,只是与敌人bot对抗是远远不够的:玩家都希望能够参与到游戏中,创造竞争并消灭所有与自己对抗的人。
有效设置AI
发行于几年前的《虚幻竞技场》似乎超越了竞争范围。尽管它的设计是基于多人游戏,但是bot却优秀到能够得到单人玩家的认可。也许按照今天的标准它的AI还很糟糕,但是《虚幻竞技场》却拥有超越其它游戏的AI。
我们可以从游戏的一张截图看看这款游戏的一个bot是如何诞生的:
screenshot(from tutsplus)
技能是决定bot行为的主要元素:新手bot速度较慢,并且需要站稳了才能射击,转弯速度也很慢,而较高级别的bot速度较快,能够灵活地躲闪,且拥有更广的视野,还能够使用高级的武器组合技能。
之后bot可以在精确度,敏捷性和射击水平等方面得到进一步提升。而它们的“特性”则是取决于战斗类型和武器,并且将决定bot是否能够近距离接触或尝试着从远距离狙击对手。在32个bot中每个bot都是经过特别定制的,即意味着你将面对32种不同的个性。
而所有的这些元素都能够创造出更具人性的bot。尽管没有这些复杂的内容游戏也可能非常出色,但这些元素却能够为游戏添加额外的乐趣层面。
最后你需要问自己:你想从AI中获得什么?敌人将义无反顾地冲向玩家并径直走向维修区,还是你想要创造一些能够呈现出与玩家之间更有个性的互动的内容?不管你最终做出怎样的选择,你都必须牢记三大要点:
如果bot能够犯错,它们便会更具有人性,而不再只是“一张纸牌”。
如果bot是基于独特的个性(游戏邦注:或情感,如仇恨)在游戏,那么游戏便更有可能呈现出不可预测且刺激的游戏玩法。
如果bot尝试放宽视野去玩游戏,不再目光短浅,玩家便更能够感受到游戏的公平性。
( 本文为游戏邦/编译,拒绝任何不保留版权的转发,如需转载请联系:游戏邦 )
Making AI Fun: When Good Enough is Good Enough
by Darran Jamieson
Making good artificial intelligence for computer opponents is difficult. Programming a game like draughts isn’t
adding convincing AI, however, might take longer than making the game itself. But what are we doing when we make this AI? Is it important for it to examine every possible move on the board, or can we cheat and just make it move randomly? What does an AI need to do, and (most importantly) how can we ensure that the game is fun?
Good AI vs Fun AI
The term “AI” is a really broad concept, and the type of AI depends on the game. Asymmetric games, such as Space Invaders, Mario, or Tower Defence, allow the player to cut through swathes of enemies effortlessly. Since the “teams” (player vs everything else) are unbalanced, these games tend to use dumb AI. Symmetric games, such as Starcraft, Street Fighter or Civilisation, expect the player to beat opponents on equal footing, and so require more complex AI.
However, games have to be fun, first and foremost. Players enjoy a challenge, not losing repeatedly. In fact, some games such as Checkers have been “solved”, meaning it is possible to build an AI which plays an unbeatable game.
When my team and I were working on our computer/board game Infected, we had to make the first level’s AI intentionally awful so as not to scare players off. The game AI was initially rather simplistic, and the computer would play hyper aggressively, focusing entirely on high scoring plays with no thought of defence or board presence.
Even though the AI was poor, we found that new players would get crushed and lose interest. We revised the AI several times, although it still proved too much of a challenge for players. Eventually, we simply removed the AI, so the game would just make a random move every time. Although some players still managed to lose, this massively improved player retention, allowing us to reintroduce the “serious” AI at higher levels.
The problem of “too good” AI can be seen in a variety of games: FPS games with bots that have 360 degree vision, or beat-’em-ups against bots with perfect reflexes. Playing against these AIs doesn’t actually teach the player to play the game well: it teaches them to “game” the bots, to try to find a flaw in the algorithm which allows easy kills.
This isn’t to say that all AI should be poor, but rather that good AI is multi-faceted. It makes mistakes, but tries to avoid falling into the same predictable patterns. Giving the AI the ability to adapt—and, therefore, to provide variance in gameplay—will likely provide much more entertainment for the player than an AI that plays the same perfect game every time.
Making Them Human
After making Infected, we briefly toyed around with a sequel, Infected 2. It was the same premise, but on a larger scale, similar to the classic board game Risk. Because the game was larger, it was important to have drastically improved AI: something which could keep the player entertained over the course of a much longer game, and where multiple AIs could compete against each other.
We plugged in the old AI, and there were several issues with it. The AI was predictable, but that was something that could be improved with a little work. The larger issue was regarding the general attitude of the AI, and how it played.
There were three main problems:
Firstly, playing against the AIs wasn’t particularly fun.
Secondly, beating the AI wasn’t particularly rewarding.
Thirdly, the AI would “cheat” by deliberately throwing the game.
The game was fun against other players, but not against the AI. Although there was still the same level of challenge, why was there such a massive disparity between player against the AI and playing against another person, if the gameplay was the same?
We then remembered that humans have one thing computers don’t: emotions.
Part of playing a game
we love a thrilling victory, we hate a crushing defeat. We love to rub our victories in our friends’ faces, and we become petty and vengeful when they betray us. Games are intrinsically linked to our emotions, and it’s something that an AI can never experience… but it is something that we developers can emulate.
The Vital Spark
Why wasn’t playing the AI fun?
Because the artificial intelligence was so obviously artificial. All the bots they all had the same ap they were all equally predictable in their movement patterns.
We needed something to make them stand out from each other. So we introduced personalities: reckless, defensive, explorer. The AI would give an artificial weight to certain strategies, and then move in those attack patterns.
Even in a basic form, this was a massive improvement: no longer was every game the same, but it added unpredictability to enemy moves and made it harder to formulate a single “game winning” strategy. If the AIs were randomised when the game started, then the player wouldn’t be able to predict how the game would unfold.
Personalities on AI is not a new idea. Civilisation gives personalities to its leaders (Gandhi famously loves to nuke people), Age of Mythology AIs determine how likely they are to use strategies such as turtling or rushing, and Unreal Tournament bots have favourite weapons.
Why Wasn’t Beating the AI Rewarding?
The main issue was that the AI played what it viewed as a “best move” every round. It simply assessed the game board, with no regard to diplomacy. If it needed to attack you it would. If you attacked it back, it simply didn’t care. It viewed the game as a mathematical puzzle to be solved, rather than a game against complex human players. Playing against our artificial intelligence resulted in an artificial game.
Our solution came from an Amiga game from 1989 called Nuclear War. In Nuclear War, you fought against various world leaders and tried to nuke their country from existence. Whoever managed to survive would win. Although simplistic, it was surprisingly fun watching your enemies get caught in personal vendettas and throw warheads at each other.
This “friends and enemies” system used a very simple metric: happiness. Each world leader had a variety of facial expressions which made it easy to judge their attitude towards you. Unsurprisingly, nuking people tended to make them unhappy very quickly. In addition, your enemies wouldn’t just get upset with you, but with each other. This meant that a single wayward missile could escalate into a sustained fight to the death.
Once again, this system has been used in many games, including Civilisation. An enemy nation with a high level of “happiness” is more likely to ally with you and send you gifts, whereas an enemy that hates you might invest a lot of resources into crushing your cities.
By adding a rudimentary happiness meter into our game, we allowed friendships and rivalries to brew. A game is more exciting when you develop a nemesis, or when teams and alliances form. Suddenly, the game became personal, and actions felt like they had weight. We also found that a visible happiness meter was important, otherwise the player wouldn’t understand what was happening. A simple happy face icon immediately conveys the idea that enemies can get “upset”, and watching the face change upon taking certain actions made it clear what consequences these actions were having.
The prisoner’s dilemma is a well known game theory concept, and many programmers have spent time trying to build the ultimate bot to compete in the iterated prisoner’s dilemma. Curiously, the winning strategy for many years was also the simplest: known as tit-for-tat, it simply copied the opponent’s move.
How Would the AI Cheat?
The problem in Infected 2 was often that the AI was simply looking at the short term perspective. The AI aims to maximise its score every turn: if this meant making an overall poor move, then it would do it anyway.
The easiest way to imagine it is this scenario:
Alice, Bob and Carol are playing war.
Alice has 100 soldiers. Bob has 75 soldiers. Carol has 150.
Neither Alice nor Bob can beat Carol.
However, Alice and Bob combined can beat Carol.
The problem was that the AI would do whatever would score it the most points. In the above scenario, that meant Alice would attack Bob: in the short term, an excellent move, but in the long term, disastrous. Not only is Alice making a move which dooms herself, she is condemning Bob to certain defeat as well. Bob is understandably upset.
This sort of situation is difficult to avoid, as seeing the bigger picture requires a complex reasoning beyond most simple AI. We tried to ensure “fairness” by making players less likely to be attacked if they were losing, or if they had been attacked recently. While not every game can apply a simple solution, its important to realise that players hate being attacked for no apparent reason.
While Infected 2 never made it past the alpha stage, it taught us some valuable lessons. Most importantly, that it’s not enough to just play against enemy bots: you want to be involved in the game, develop rivalries, and crush all those who stand against you.
AI Done Right
Many years ago, a game was published that seemed leaps and bounds ahead of the competition. Although a multiplayer game by design, the bots were good enough that it could be enjoyed single player. And, although by today’s standards it is poor, this game—Unreal Tournament—had AI which blew other games out the water.
We can look at an in-game screenshot to see some of what went into making a bot:
Skill was the main factor in determing bot behaviour: novice bots were slow, had to stand still to shoot, and were slow to turn around, while the higher level bots were faster, could dodge, had a bigger field of view and could use advanced weapon combo techniques.
Bots could then be futher modified with accuracy, alertness, camping, and strafing levels. “Personality” would be determined by combat style and favourite weapon, determining whether the bot liked to get up close and personal, or try and snipe from a distance. Bots would also taunt the player and seek revenge. Each of the 32 bots could be individually customised, meaning you could have 32 distinct personalities. Certain bots, such as Loque, became notorious amongst players.
All of these factors helped create bots which felt more human. While the game would still be good without this sophistication, it adds an extra, almost imperceptible layer of fun.
Conclusion
At the end of the day, you need to ask: what do you want from your AI? Are the enemies going to mindlessly rush the player and walk head-first into pits, or are you trying to develop something more, something that provides a more personal level of interaction with the player? Whatever you decide, remember three key points:
If bots make mistakes, then they feel more human, and less like a “pack of cards”.
If they deliberately make plays based on individual personality (or emotion, like revenge), then unpredictable and exciting gameplay is more likely to emerge.
If bots try to play cleverly, rather than short-sightedly, they are more likely to make the game fair to our eyes.(
QQ空间 新浪微博 开心网 人人网
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致}

我要回帖

更多关于 ai如何建立图层组 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信