游戏邦在:
杂志专栏:
sepmw.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

开发者谈《盗贼之海》的AI设计解析系列之一

发布时间:2019-09-27 08:58:08 Tags:,

开发者谈《盗贼之海》的AI设计解析系列之一

原作者:Tommy Thompson 译者:Willow Wu

如果你在网站或YouTube上关注过这个系列,你就知道我平常研究的是商业电子游戏中人工智能(AI)的构建,但我通常会在游戏发行后很久才开始。我之前从未有这样的机会,能够这么直接、坦诚地与开发工作室谈论他们的经历——从产品最初的概念到上架,并在现代游戏生态系统中生存。2018年年末,我受到Rare公司的邀请,去拜访海盗题材多人冒险游戏《盗贼之海》的开发工作室。这款游戏不仅为Xbox平台的玩家带来了独特体验,还促使人们对Rare有了新的认识。请跟我一起去幕后,认识《盗贼之海》的编程团队,你不仅能够学到关于游戏制作的第一手知识,而且还能了解他们在游戏不断更新和改进的过程中所付出的努力。

关于《盗贼之海》

Rare公司是英国游戏产业的元老之一,30年来他们通过不断革新、适应市场的变化得以生存下来。1990年代,为了和任天堂建立紧密的合作关系,他们为ZX Spectrum电脑开发产品。现在的他们是微软旗下的内部工作室之一,为Xbox提供支持。2015年,在发行了三款Kinect Sports产品以及Rare Replay周年纪念合集后,这家工作室将全部注意力转移到一个与之前大不相同的项目上,颠覆他们以往的游戏类型和开发方式。

Rare开发《盗贼之海》的初衷是想做一个独特的产品。实时服务游戏是他们之前从未尝试过的,但他们的设计意图是以玩家为中心。玩家可以从不同的人物那里领取任务,你可以优先玩自己喜欢的内容,按照自己的节奏进行,这样可以最大程度确保游戏的易上手性。作为回报,玩家不仅可以提高他们在不同帮派中的声望,还可以赚取货币来购买各种各样的新装扮:一顶很酷的新帽子或假腿、一张漂亮的船帆,或者一个镶金边的水桶。玩家可以通过完成任务、击败骷髅堡垒、克服极为糟糕的航行天气、跟陌生人一起演奏渔村民谣再喝上几杯而获得满足感。

随着时间的推移,《盗贼之海》已经形成了一个忠实的粉丝群体,他们持续在海上航行冒险,甚至可以挑战最狂热的传奇海盗。这主要是归功于Rare公司对游戏的不断拓展,游戏发行后的8个月内就有四次大更新。2019年4月,游戏周年庆的到来也揭开了今年的更新序幕:PvP模式、新的剧情以及新的游戏玩法的引入。Rare试图将这些新游戏特色结合不断优化的已有内容,从而增加核心游戏玩法复杂程度。

Sea of Thieves(from gamesindustry.biz)

Sea of Thieves(from gamesindustry.biz)

《盗贼之海》内置有灵活多变的AI系统,并且会随着每次更新而不断丰富。虽然游戏中所包含的还是较为传统的类人敌对角色(如骷髅),岛屿上也是蛇、猪这样较为普通的AI生物,但开发团队的重点关注是不断增加海洋环境中的威胁,它们可能会你和你的船造成严重伤害。他们不满足于发行初期的鲨鱼,2018年增加了海怪,巨齿鲨和幽灵船,它们的设定会随着每次更新而优化调整。所有的这些内容都需要搭配能够发挥平衡作用的系统,确保这个内置上百个AI角色的网络世界能够保持稳定、处于掌控范围之内,因为每台服务器上都有各种各样的恶作剧在发生。此外,由于它是一个实时服务游戏,项目需要保持能够快速迭代的状态,频繁地发布新内容,并确保游戏对玩家来说是稳定的。所有的这些都是在开发团队没有过度加班的情况下实现的——AI甚至也在其中发挥了作用。现在,我们来从头开始思考:在它们发展成可玩内容之前,《盗贼之海》是如何开端的。

建设AI系统

受到Rare工作室的邀请之后,我迫切地想要了解更多关于《盗贼之海》AI系统的信息:不仅仅其本身,还有它是如何成为游戏的最关键元素。游戏采用的是Epic的虚幻引擎4,它不仅是电子商业游戏最常用的引擎之一,而且在3A领域也享有盛名。

众所周知,虚幻引擎在多人联网玩法和跨平台开发方面非常可靠——尤其是考虑到开发商打算在Xbox One和PC两个平台上发行这款游戏并连接到Xbox Live,这一点至关重要。此外,虚幻4的AI工具合集可以说是所有可供开发人员使用的商业引擎中最强大的。它不仅提供了一套导航网格编辑工具——确保角色能够在移动的过程中识别地形的变化——它还有行为树系统,用于创建对游戏中事件反应的通用表现行为。当《盗贼之海》开始制作时,环境查询系统(EQS)还处于实验阶段——它用于检视角色是否能被近距离看到或听到,可以模拟感官输入,并将性能开销降至最低。然而,这一切对Rare的构想来说还是有所欠缺。只有骷髅和其它陆地上的AI角色(如猪、鸡)是完全由原有的AI框架操刀的,当然Rare还进行了一点特殊加工。

这其中的一个重要的原因是游戏的大部分场景都是在水里,无论是四处游泳还是在船上,导航网格都无法提供支持——我后续会细讲这点。幸运的是,人们可以接触到虚幻4引擎的源代码。这能让开发者根据自己的需求定制水上导航系统,然后再套入引擎现有的导航框架,这一点我会在系列的第二部分展开。除此之外,我会在文章的第三部分讲到海怪、幽灵船这样的敌人也需要定制工具,这将使AI能够以一种特别的方式运行——这在虚幻4默认条件下是不可能实现的。所以总结来说,Rare公司能创造出独特的系统并契合现有的虚幻引擎AI工作流,同时确保工具链不会变得太难以管理。

让AI适应任务设计

在我写这篇文章的时候,《盗贼之海》已经发行一周年了。在这一年期间,游戏中的主要活动有三个,它也们在游戏玩法、任务构建和AI行为方面都有不同的需求和侧重。NPC能够让玩家从三大贸易公司中获取任务:

1.淘金者:你出航到岛上挖宝箱,回来时要把宝箱交给淘金者,宝箱只有他们才能打开。
2.商人联盟:他们会要求玩家带回指定的物品——有可能是猪、鸡等动物,也有可能是朗姆酒、植物等货品。
3.灵魂秘社:你需要去一个或多个热带地区,找到不死骷髅战士,再次杀死他们,然后把他们头骨卖掉。

这些任务都需要游戏系统在运行时生成AI角色,以满足任务需求。举个例子,灵魂秘社任务需要骷髅出现在指定的岛屿中供玩家对战,同时还需要设定一些高价值的打击目标。淘金者和商人联盟任务,骷髅战士仍然会在特定的时间出现在岛屿上,成为你与战利品之间的阻碍。另外,商人联盟任务有的需要捕捉动物,游戏就必须确保某些特定岛屿会出现动物,供玩家捕捉。随着近期周年庆的更新,游戏引入了第四家贸易公司“猎人召唤”,增加了捕鱼机制以及伴随而来的鱼类AI。

在进行任务时,游戏不仅需要确保这些角色在指定区域大量出现,还要根据玩家团队的规模、任务地点、任务领取人的排名以及任务类型把握好目标数量和难度之间的平衡曲线。这就是程序生成发挥小作用的地方。

赏金猎人的数量——也就是有多少敌人和队长——被限制在一组参数之内。任务会在购买后生成。所以当你使用金币时,系统会决定你要去往游戏世界的哪个地方以及你需要完成多少目标。赏金多少是根据岛屿特定区域内的特定目标所决定的。 如果你有多个悬赏目标,它们会给你带来不同的战术作战经验。比如说,你可能要在海岸边打一场,而另一场是在洞穴深处,由此来达到一种平衡效果。

随着时间的推移,每一种任务类型都在以自己独有的方式拓展,这不仅为玩家,也为设计师制造了越来越多的挑战。 这些任务链彼此独立,允许玩家优先选择他们喜欢的任务线,游戏也不会因为他们从其它贸易公司获取任务而给予惩罚或令他们犯难。因此,你可以在玩了几个小时的灵魂秘社任务后为商人联盟快速跑个腿,而且后续任务的规模和难度不会受到前几个小时游戏的影响。

但是从AI性能和多人联网方面考虑,有个关键问题需要思考:这个服务器上并不只有你一个团队。这与我之前在研究《全境封锁》AI时发现的挑战类似,即游戏必须平衡活动世界中的所有AI行为。在所有这些AI角色都在运行的情况下,你如何保持游戏世界的良好性能表现?我们就这个重要话题在工作室讨论了很久,尽管其中涉及的具体计算问题仍需保密,但我了解到了每个任务所需的AI角色仅在必要时大量产生,并且让它们出现在离当下最近玩家千里之外的岛上,或者让玩家去往几乎没人会注意到它们的海域,从而避免浪费CPU和内存资源。这样当一个船员正忙于猎捕巨齿鲨时,它不会影响到另一个在岛上进行灵魂秘社任务的船员。像猪和鸡等AI角色只会在船员足够靠近、大概能看到时才会出现。除此之外,与玩家同处一岛的猪、蛇和骷髅,在非战斗状态下或者人类玩家视线之外往往会进入休眠状态。这是一种安全的策略,可以最大程度减少服务器端不必要的计算(因为大概也没有人会去注意这些角色的情况),从而释放资源,留给其它更值得用的地方。

我们将在接下来的系列文章中看到,这种设计理念同样适用于骷髅船、巨齿鲨和海怪。然而,这些系统的规则都具有唯一性,且基于完全独立的服务和行为系统之上。

总结

将这种恃强凌弱的冒险带给玩家听起来像是一项艰巨的任务,但这仅仅是个开始,我仍有许多令人兴奋的话题要讨论。

·骷髅AI的行为树结构,以及它们是如何设计成与玩家一样的行动模式。
·鲨鱼的导航系统有哪些独特之处?
·海洋深处最致命的威胁:巨齿鲨、海怪和骷髅。
·好了,我们终于要开始分析自动化测试框架了——它能够让Rare在开发过程中对游戏进行广泛测试,将bug大幅减少,在游戏发行前后更快更流畅地部署游戏。

本文由游戏邦编译,转载请注明来源,或咨询微信zhengjintiao

If you’ve followed this series either here or on YouTube, you’ll know that I explore how AI is built in commercial video games but this occurs long after the projects completion. I’ve never had the opportunity to talk to a studio more candidly about their experiences and the path their work has taken from initial concept to being on store shelves and surviving in the modern gaming ecosystem. However in late 2018, I was invited to the offices of Rare: developers of online pirate adventure game ‘Sea of Thieves‘. It’s a game that not only brought a unique experience to the Xbox platform, but also helped redefine the studios identity. Join me as I go behind the scenes with some of the programming team responsible for Sea of Thieves and learn first-hand not only how the game was built, but the ongoing dedication and craft as it sees continued updates and improvements today.

About Sea of Thieves

Rare is one of the longest-serving companies in the British games industry and has survived for over 30 years by evolving and adapting to the changes in the market: first developing titles on the ZX Spectrum, to forging a strong partnership with Nintendo in the 1990’s and now as one of Microsoft’s internal studios supporting the Xbox brand。 In 2015 – following the release of three titles in the Kinect Sports series and the anniversary collection Rare Replay, the studio had focussed its efforts on something completely different – a project that would challenge not just the types of games they made at the studio, but how they were going to make them as well。

Sea of Thieves is derived from a desire to do something unique. Whilst Rare sought to move towards creating a live service game – something they had never done before – its design was intended to be player centric. Players can tackle missions from different quest-givers at their own pace, allowing you to prioritise the experiences you enjoy the most and keep the game as accessible as possible. In return, players not only increase their standing with different factions, but earn currency to acquire a variety of new cosmetics: a cool new hat or peg leg, a nice top sail for your ship, or a gold trimmed water bucket. Through this approach, players can derive their own satisfaction from achieving tasks in the game, from attacking skeleton forts to sailing through storms and playing sea shanties with strangers – along with a tankard of grogg or two.

Over time, Sea of Thieves has developed a dedicated fan base that continues to sail the seas for adventures that can challenge even the most ardent of Pirate Legends. Much of this is thanks to Rare’s continued development of the game, with four major updates within eight months after the games release. Meanwhile April’s anniversary update kickstarts the 2019 content drops as Rare supports the game for the foreseeable future, with the introduction of PvP mode The Arena, the new Tall Tales storyline as well as new gameplay mechanics. These new features, combined with continued refinement of existing ones, seeks to mix things up in new and interesting ways that adds new layers of complexity to the core gameplay.

The game has a variety of AI systems under the hood that continues to increase with each update. While the game launched with traditional humanoid enemies such as the skeletons as well as ambient AI on islands such as snakes and pigs the game has focussed on the expanding its roster of sea-based threats that can threaten you and your ship. Not content with sharks at launch, 2018 saw the addition of the kraken, the megalodon and haunted galleons with each continuing to change and evolve with each new expansion. All of this requires systems that balance that experience: ensuring this online world with hundreds of AI characters is stable and manageable as pirate crews sail the seas and get up to all sorts of shenanigans on each server. Plus by virtue of it being a live service game, the project needs to be maintained in a manner that it can be iterated upon quickly, allowing for new content to be released frequently and ensures the game continues to be stable for players. All the while achieving this without overworking the development team – and AI even has a part to play there too. But before any of that can come into play, let’s consider it’s earliest beginnings and how Sea of Thieves was built.

Building AI Systems

Having been invited to Rare’s offices I was keen to learn as much as I could not just about the AI behind the game, but how it all came to be in the first place. Sea of Thieves is built in Epic’s Unreal Engine 4, which is of course not just one of the most popular commercial video game engines, but one that has a strong reputation within the AAA industry.

Unreal is known for being a reliable engine both for networked gameplay and cross-platform development – which was critical given the intention to launch the game on both Xbox One and PC and connected into the Xbox Live ecosystem. In addition, UE4 arguably has the most robust set of AI tools available in a commercial engine for developers to work with. Not only does it provide a suite of navigation mesh tools – which ensures characters can move across surfaces and recognise changes in terrain – it also has the behaviour tree system for creating versatile behaviours that are responsive to in-game events. Plus whilst still in an experimental stage when Sea of Thieves started production, the environmental query system (or EQS) can simulate sensory inputs and minimise performance overheads for checking whether characters can be seen or heard in proximity. However, that still wasn’t enough for what Rare had in mind. Given, as we’ll see throughout these videos, only the skeletons and other land-based AI such as pigs and chickens are built entirely using the original AI frameworks – with a bit of Rare’s own special spices of course.

A big reason for this is that the game largely takes place in-water, either swimming around or in rowboats and ships, and navigation meshes don’t support that – a point I’ll come back to later. Fortunately, UE4 provides access to the engines source code. This enabled the developers to build their own custom water navigation system and then hook it into the existing navigation framework of the engine, a point I’ll return to in part 2 when we look at the shark AI. Plus as we’ll see in part 3, enemies such as the kraken and haunted ships required bespoke tools that would enable the AI to behave in a way that simply isn’t possible in UE4 by default. So once again Rare were able to create unique systems that fit into the existing Unreal Engine AI workflow, and ensure the toolchain doesn’t become too unwieldy to manage.

Fitting AI around Mission Design

As the time of writing, Sea of Thieves is now one year old – having been released on March 20th 2018 – and during this first year, the game carried three main activities for players to participate in。 Each of these activities have their own requirements and dependencies in terms of gameplay, mission construction and AI behaviours where necessary。 Non-player characters based at outputs allowed for you to collect missions from one of the tree main trading companies:

·The Gold Hoarders: Where you travel to specific islands and dig up buried treasure.
·The Merchant Alliance: that asks players to acquire specific items – be it animals such as pigs and chickens or cargo runs of rum and plants – and deliver them to islands across the open world.
·The Order of Souls: where you need to go one or more tropical locales, find undead skeleton warriors, kill them all over again and then sell their skulls for gold.

In each instance, these missions require gameplay systems to generate AI characters at runtime to facilitate the missions requirements. For example Order of Souls missions require skeletons to spawn onto specific islands for the player to fight against, but also the specific high-value targets you need to take out. Meanwhile in Gold Hoards and Merchant Alliance quests, skeleton warriors will still appear on islands at specific times in order to present a challenge and get in the way between and your loot. Plus in Merchant Alliance quests where animals need to be captured, the game needs to make sure animals are going to spawn in for you on certain regions of a given island for you to capture them. This has since been embellished with the recent anniversary update which introduced a fourth trading company – Hunter’s Call – that introduced fishing mechanics – and new fish AI to go along with it.

With a mission in play, the game not only needs to ensure these characters are spawning in, but they’re balanced in terms of number and difficulty based on the size of the players crew, the location the mission will take place in, the ranking of the player who acquired the mission from the Trading Company, as well as the mission type itself。 That’s where a little bit of procedural generation comes into play。

The bounties – how many enemies and captains there are – are constrained within a set of parameters. With each mission being generated at purchase time. So when you spend the in-game gold it will decide where in the game world you visit and how many targets you need to take out. Each individual bounty is based around specific targets within certain regions of each island. These are then balanced out such that if you have multiple bounty targets they will each provide a unique tactical combat experience. For example, you may have one fight you on the shoreline whilst the other is deep in a cave.

Over time, each of these mission types scale in their own unique ways, providing an ever increasing challenge not just for players but designers too! Each of these mission strands scale independently from one another, allowing players to prioritise quest lines they prefer and not to be punished or left confused when picking up missions from other Trading Companies. Hence you can decide after hours of playing through the Order of Souls to do a quick run for the Merchant Alliance but the scale and difficulty of that subsequent mission won’t be influenced by your preceding hours of play.

But this presents a much bigger problem for AI performance and networking: given your crew isn’t the only one on a given server. This is similar to the challenges raised when I looked at the AI of Tom Clancy’s The Division, where the game had to balance all the AI behaviours happening out in the active world. How do you maintain the performance of the game world with all these AI characters running around? It was a big topic that we discussed at length in the studio and while the exact maths involved is still a secret, what I did learn is that the AI characters for each mission are only spawning in when necessary and not wasting CPU and memory resource by running around on an island that is miles away from the nearest player, or sailing the seas where nobody is going to notice them.

This process helps ensure that while one crew might be busy hunting a Megalodon, it doesn’t impact another the crew on an island completing an Order of Souls mission. AI characters such as pigs and chickens don’t spawn on islands until crews are close enough that they might actually see them. But in addition, pigs, snakes and skeletons on the same island as players often go dormant when not in combat and beyond the line of sight of any human player. It’s a safe tactic to employ that minimises unnecessary computation on server-side, given nobody is going to notice what happens to these characters anyway, freeing up server resources that could be put to better use elsewhere.

As we’ll see in the upcoming episodes, this philosophy holds true for the likes of the skeleton galleons, the megalodon and the kraken。 However, the rules of these systems are unique in each instance and run on completely separate services and behaviour systems。

Closing

Bringing this swash-buckling adventure to players already sounds likes a daunting task, but this is just the beginning and I still have a lot of exciting topics to cover。 Here’s just a taste of what’s still to come…

·The behaviour tree architecture of the skeletons AI and how they’re built to use the same controls as humans.
·How sharks required a completely different navigation system at launch.
·The deadliest threats looming deep under the sea: Megan, Karen and… Skevin??
·And finally we’re going to look at the automated testing framework that enable Rare to extensively test the game during development, minimise errors and enable faster and more streamlined deployment of the game both before and after launch.

(source: )


下一篇:

众盈彩票APP 博乐彩票计划群 山东11选5开奖 万家彩票计划群 上海11选5计划 上海11选5 易中彩票开户 上海11选5 湖南快乐十分官网 极速3D彩票