Morta的孩子:使程序生成混乱

When Dead Mage created Children of Morta, a narrative-driven 2D dungeon crawler, they ran into some challenges balancing the roguelike elements with the story progression. We talked to Reza Hooshangi, Lead Programmer at Dead Mage, about how they combined the huge possibilities of procedural generation associated with roguelike games with a sense of meaning and progress needed in narrative-driven games.

当Dead Mage创建叙事驱动的2D地牢搜寻器的Children of Morta时 ,他们遇到了一些挑战,需要在将流氓元素与故事进展之间进行平衡。 我们与Dead Mage的首席程序员Reza Hooshangi进行了交谈,探讨了他们如何将与流氓类游戏相关的程序生成的巨大可能性与叙事驱动型游戏所需的意义和进步感结合在一起。

Making a procedural system requires that you define many rules and constraints that define the borders of what is possible in your game. In this blog post, we will look at defining a level structure, the challenges that arise when you introduce narrative elements, and the custom tool that Dead Mage built in Unity to balance the fresh feeling of random events with the narrative progression needed to support the story in their game.

制作程序系统需要定义许多规则和约束,这些规则和约束定义了游戏中可能出现的边界。 在此博客文章中,我们将研究定义级别结构,引入叙事元素时遇到的挑战,以及Dead Mage在Unity中构建的自定义工具,以平衡随机事件的新鲜感觉与支持叙事的叙事进程之间的平衡。他们游戏中的故事。

演示地址

等级结构 (Level Structure)

In Children of Morta, every level is made up of a number of rooms connected to each other by doorways. There are many kinds of rooms with various types of content; some might contain a breathtaking fight with hordes of enemies, a mysterious game of chance, an NPC waiting desperately for the player’s help, or just regular pathways filled with regular enemies.

在《 Morta的孩子》中,每个级别都由许多房间组成,这些房间通过门廊相互连接。 房间种类繁多,内容各异。 有些可能包含与成群的敌人进行的惊人战斗,神秘的机会游戏,迫切等待玩家帮助的NPC,或者仅仅是充满常规敌人的常规通道。

Hooshangi explains that in Children of Morta, they defined a group of parameters for each level, mapping out all of the rooms and how they should be connected to each other. He provided us with the following diagrams, which give you a sense of the great number of possibilities in the basic structure of one given level alone.

Hooshangi解释说,在Morta的Children中,他们为每个级别定义了一组参数,映射了所有房间以及它们如何相互连接。 他为我们提供了以下图表,这些图表使您仅凭一个给定级别的基本结构就能了解大量可能性。

First, you take the basic structure

首先,您采用基本结构

The first diagram shows an example of a simplified version of a level structure.

第一个图显示了级别结构的简化版本的示例。

Each level has a main path which consists of every room from the start room leading to the end room (rooms 0,1,2,3,4). It also can contain a number of branches (dead ends) connected to the main path (the side path with rooms 6 and 7).

每个级别都有一条主要路径,该路径包括从开始房间到结束房间(房间0、1、2、3、4)的每个房间。 它还可以包含连接到主路径(带有房间6和7的侧路径)的多个分支(死端)。

Then, you add rules for how to connect them at this particular  level

然后,添加有关如何在此特定级别连接它们的规则

Level structure parameters define the rooms and put a list of constraints on how they can be connected together. For instance, in this level, item room (the room with a reward item) is supposed to be connected to a room in the main branch but not to the first half of the path. The side path also has its own constraints, but for the sake of simplicity, let’s assume them to always be connected to room 1. So this specific level could also look something like what is shown in the diagrams below:

层级结构参数定义房间并列出如何将它们连接在一起的限制条件列表。 例如,在此级别中,项目房间(带有奖励项目的房间)应该连接到主分支中的房间,但不连接到路径的前半部分。 旁路径也有其自身的约束,但是为简单起见,我们假设它们始终连接到房间1。因此,该特定级别也可能类似于下图所示:

But what about orientation? So far, the structure doesn’t reveal anything about the orientation of the rooms. So in the end, it could look like any of the diagrams below:

但是方向呢? 到目前为止,该结构并未透露有关房间方向的任何信息。 所以最后,它看起来可能像下面的任何图:

Each room has a number of possible shapes and forms, so there’s a lot of different possibilities for making a level with these parameters, as you can see in the following diagrams.

每个房间都有许多可能的形状和形式,因此,使用这些参数制作关卡有很多不同的可能性,如下图所示。

So far, we’ve looked at how complex just the basic structure of a simple level can be, but it’s not over yet!

到目前为止,我们已经研究了简单关卡的基本结构可以有多复杂,但是还没有结束!

程序生成满足叙述设计 (Procedural generation meets narrative design)

Sometimes, a procedural narrative encounter occurs that modifies the level temporarily. For example, in the diagram below, you can see a procedural event requiring the addition of two extra rooms.

有时会发生程序性叙述冲突,从而临时修改该级别。 例如,在下图中,您可以看到一个程序事件,需要添加两个额外的房间。

The R1 room contains an NPC that asks the player to find and bring something to him in exchange for a reward. Further on the main path, the player finds another room (R2) with the requested object in it. He has to fight his way to the object, pick it up, return it to the NPC and get his reward.

R1房间包含一个NPC,NPC要求玩家找到并带些东西给他以换取奖励。 进一步在主路径上,玩家找到另一个房间(R2),其中有所请求的对象。 他必须奋力拼搏,将其捡起,归还给NPC并获得奖励。

This is a simple example of a procedural event that resolves itself in one level, but there are other types of procedural events you might encounter, which have more complex objectives.

这是一个过程事件的简单示例,它可以在一个层次上解决自身问题,但是您可能会遇到其他类型的过程事件,它们具有更复杂的目标。

Sometimes it takes a couple of playthroughs until the player catches up with the rest of a side storyline. In the meantime, he will find traces of other procedural events. However, because they are ordered randomly, different players might encounter them in completely different situations.

有时,要经过几个通关才能让玩家赶上侧面故事情节的其余部分。 同时,他将发现其他程序事件的痕迹。 但是,由于它们是随机订购的,因此不同的玩家可能会在完全不同的情况下遇到它们。

程序内容 (Procedural content)

Once the rooms are in their places, it’s time to fill them with procedural content. Children of Morta has a number of subsystems for generating and managing different types of content. You might not be surprised that Hooshangi, a big fan of the Matrix films, gave these subsystems in Children of Morta the following names:

将房间放到适当位置后,就可以为它们填充程序内容了。 Morta的子级具有许多子系统,用于生成和管理不同类型的内容。 您可能不会对Matrix电影的忠实拥护者Hooshangi赋予《 Morta的孩子》中的这些子系统以下名称感到惊讶:

  • Key Maker: Handles all the doors and connections between rooms

    钥匙制造商 :处理房间之间的所有门和连接

  • Oracle and Persephone: Put environmental assets, narrative objects, cutscenes and many other things in a given level

    Oracle和Persephone :将环境资产,叙述对象,过场动画和许多其他东西放在给定级别

  • Tank: Generates and manages pathfinding graphs (character in The Matrix who operated the hovercraft)

    Tank :生成和管理寻路图(操作气垫船的黑客帝国中的角色)

  • Smith: Spawns enemies (obviously!)

    史密斯 :产生敌人(显然!)

  • Merovingian: Spreads the loot in the level (Even though he didn’t exactly spread his money around the world in the Matrix films)

    Merovingian :在整个关卡中传播战利品(即使他没有在Matrix电影中准确地将钱散布到世界各地)

Each one of these subsystems has its own set of parameters defining the precise behavior for a specific level. So each level has a structural parameter about its form and layout, plus a set of parameters for each one of its content-generation subsystems.

这些子系统中的每个子系统都有自己的一组参数,这些参数定义特定级别的精确行为。 因此,每个级别都有一个有关其形式和布局的结构性参数,以及每个内容生成子系统的一组参数。

死亡法师如何平衡叙事进程中的随机事件 (How Dead Mage balanced random events with narrative progression)

The collection of all the parameters mentioned above includes everything the procedural algorithms need to generate a level and everything inside it. Each level of the game has a predesigned set of these parameters with its own features and characteristics. But Children of Morta has a linear story between all runs, which by nature, works in opposition to a predesigned set of constraints.

上面提到的所有参数的集合包括过程算法生成级别所需的所有内容以及其中的所有内容。 游戏的每个关卡都有一组预先设计好的参数,具有自己的特征和特性。 但是《 Morta的孩子们》在所有运行之间都有一个线性的故事,从本质上讲,它与预先设计的约束条件相反。

On the one hand, a small number of constraints would cause totally different (random) levels with no sense of progress or meaning. On the other hand, if the levels were predesigned, each playthrough would be exactly the same with no narrative progression whatsoever!

一方面,少量的约束将导致完全不同的(随机)级别,而没有进步感或意义。 另一方面,如果级别是预先设计的,则每个播放过程都将完全相同,而不会产生任何叙事性进展!

一个自定义工具来创建有意义的事件链 (A custom tool to create meaningful chains of events)

In order to reach a level of coherency and meaningful relations between gameplay elements and thus give players a meaningful experience, Hooshangi and his team built a custom tool in Unity, which they call Train Man.

为了达到游戏元素之间的连贯性和有意义的关系,从而为玩家提供有意义的体验,Hooshangi和他的团队在Unity中构建了一个自定义工具,称为“训练人”。

This system is notified about everything that happens in the game and is able to change the parameters of how what will occur. Each time the procedural system is going to generate a new level, it gathers all the default parameters and sends them to the Train Man. The parameters are then modified in a way that reflects the current state of the story.

该系统会收到有关游戏中发生的一切的通知,并能够更改发生情况的参数。 每次程序系统要生成一个新级别时,它都会收集所有默认参数并将其发送给列车员。 然后以反映故事当前状态的方式修改参数。

In one of the first runs of the game, the tool manipulates the generation parameters of the level and adds a special room to it containing a wolf cub fighting over her mother’s corpse. Saving the cub will start a new quest that affects the procedural generation through time. For example, later in the game, you might find a room in a corner of a level with medicine for the cub in it.

在游戏的第一个运行中,该工具操纵关卡的生成参数,并在其中添加一个特殊的空间,其中包含一只狼妈妈在争夺母亲尸体的战斗。 保存幼崽将启动一个新任务,该任务会随着时间的推移影响程序生成。 例如,在游戏的稍后部分,您可能会在关卡角落里找到一个房间,里面放着小熊的药。

The narrative line of the wolf cub, however, is just one of many procedural events. Dead Mage’s custom tool stores and manages a number of active procedural events in the player profile. As the diagrams below illustrate, everything that happens in the lifetime of each procedural event is tracked and when the time comes, the procedural parameters are modified based on the progress.

但是,幼崽的叙述线只是许多程序性事件之一。 Dead Mage的自定义工具可存储和管理玩家资料中的许多活动程序事件。 如下图所示,将跟踪每个过程事件的生存期内发生的一切,并在时间到来时根据进度修改过程参数。

微观,宏观意义 (Micro, macro meaning)

This enabled Dead Mage to work independently on each procedural event matching the generated level to the current state of all active procedural events. This resulted in many possibilities for varied levels, which convey a sense of randomness, and freshness, to the player every time they’re active in a given level. At the same time, though, it enabled specific and temporary modifications that give the player a sense of something meaningful going on in the big picture of the underlying story.

这使Dead Mage能够在每个过程事件上独立工作,从而将生成的级别与所有活动过程事件的当前状态相匹配。 这就带来了各种级别的可能性,每次在给定级别上进行活动时,这些级别都会向玩家传达一种随机感和新鲜感。 但是,与此同时,它可以进行特定和临时的修改,从而使玩家感觉到潜在故事的大背景下发生了有意义的事情。

其他应用 (Other applications)

Dead Mage’s custom Train Man tool keeps track of the player’s level progress managing side quests and narratives in order to maintain the feeling of progress in the story. They also use it, however for a number of other applications, which help ensure a positive player experience:

Dead Mage的自定义“火车人”工具可跟踪玩家的水平进度,管理侧边任务和叙述,以保持故事进度的感觉。 他们还使用它,但是将其用于许多其他应用程序,这有助于确保良好的玩家体验:

    结论 (Conclusion)

    As part of their procedural generation in Children of Morta, Dead Mage created rules and constraints, which are virtually endless in terms of the possibilities in each level. This solved the problem of giving the player a fresh experience each time they played a given level in the roguelike dungeon game. They then extended Unity with their custom Train Man tool to enable temporary modifications within those constraints, which preserves the narrative-driven framework of the game by giving the player a sense of something meaningful going on in the Children of Morta world. To learn more about how Dead Mage used Unity, read the Children of Morta case story.

    作为《摩塔之子》中程序生成的一部分,《死魔师》创造了规则和约束,就每个级别的可能性而言,它们实际上是无止境的。 这解决了在每次玩家玩roguelike地牢游戏中给定关卡时为玩家提供新鲜体验的问题。 然后,他们使用自定义的Train Man工具扩展了Unity,以在这些约束条件下进行临时修改,从而通过使玩家感觉到《变态之子》世界中发生的有意义的事情,保留了游戏的叙事驱动框架。 要了解有关Dead Mage如何使用Unity的更多信息,请阅读Morta孩子案例故事

    翻译自: https://blogs.unity3d.com/2018/11/30/children-of-morta-bringing-order-to-the-chaos-of-procedural-generation/

    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值