# 【建造万圣节】探索 2020 年万圣节周背后的开发者秘密。

By [Decentraland 中文社区](https://paragraph.com/@decentraland-2) · 2022-03-31

---

![](https://storage.googleapis.com/papyrus_images/facb6b5d915193b5c26e15aaba850b823d5480216d3cd487a3da3c3aae0b0a9a.png)

_2020-11-30文章_

对于那些在 2020 年万圣节期间访问过 Decentraland 的人来说，你肯定会遇到由 Decentraland 开发团队打造的一些非常特别的东西。

我们创建了一个为期五天的盛会，其中包括游戏、谜题、奖品、滑稽角色和曲折情节。如果您想知道我们是如何做到的，并且想了解如何从体验中获取元素和机制并将它们用于您自己的创作中（例如在 Game Jam 中），那么这篇文章就是为您准备的。

### 以防你错过了它…

您仍然可以在以下位置找到万圣节的大部分内容：

• [墓地](https://play.decentraland.org/?position=-8,-16) • [寺庙](https://play.decentraland.org/?position=47,67) • [农场](https://play.decentraland.org/?position=89,14) • [宅邸](https://play.decentraland.org/?position=-23,76)

场景不再以线性方式连接，因此无需按顺序播放。

### 解谜机制

通常情况下，当您急于达到最后期限时，原始存储库中的代码并不是最整洁的，因此一次整理可能有点太多了。为了让事情变得更简单，我们整理了一些很好的示例场景，展示了特定的机制，以便您可以单独研究它。

从第 3 天起，您可以在此处找到寺庙场景中每个谜题的示例：

![](https://storage.googleapis.com/papyrus_images/58bc72a34fddebaa73f7568062344dfaf43ab9060b507c56f17ed4c60e14e5a2.gif)

[github.com/decentraland-scenes/mirror-puzzle](http://github.com/decentraland-scenes/mirror-puzzle)

![](https://storage.googleapis.com/papyrus_images/6fb00f7b15e648e616c681626c1db911e362ecf8a8e8a76bb7481182c4d3b3bb.gif)

[github.com/decentraland-scenes/push-box-puzzle](http://github.com/decentraland-scenes/push-box-puzzle)

![](https://storage.googleapis.com/papyrus_images/99ab15485698d4df0e5a7de6ba2d98b351bc42b98581cd4af467f7783c4b79c4.gif)

[github.com/decentraland-scenes/light-bounce-puzzle](http://github.com/decentraland-scenes/light-bounce-puzzle)

### 运用物理

在 2020 年万圣节周的第 4 天，我们邀请您参观一个农场，在那里您可以将南瓜扔进怪物的嘴里。在那里，我们使用 [cannon 库](https://en.wikipedia.org/wiki/Cannon.js)来实现南瓜的弹跳物理。

为了了解它是如何工作的，这里有一个简单的例子，它使用这个物理库来处理一些弹跳球：

[github.com/decentraland-scenes/cannon-example-scene](http://github.com/decentraland-scenes/cannon-example-scene)

这是另一个与投掷南瓜有点相似的例子，但使用的是篮球而不是南瓜：

[github.com/decentraland-scenes/websocket-basket](http://github.com/decentraland-scenes/websocket-basket)

> 注意：此示例是使用 [websockets 服务器](https://mirror.xyz/0x85A07dC63fF774b86eEdB62563d05D72bcbE8854/_UB9nqlP7ap3P4AM0kw7sNEZcIpMuFHXsj1R8JBs17o)构建的，用于为场景中的所有玩家同步球的位置——我们在万圣节场景中没有这样做，但您可能也会觉得有趣。

### NPC

万圣节的任务以与构成这次冒险的不同角色的大量交谈为特色。

构建这些角色的重要代码后来被压缩到 NPC Utils 库中，它提供了一个非常简单的界面来构建这些角色，并带有许多可配置的参数来根据您的需要调整它们。

我们鼓励您使用 NPC Utils 库，而不是绞尽脑汁试图从场景本身中找出答案，因为所有这些都是手动布置的，有时甚至相当骇人听闻。

查看[使用此库的视频教程](https://www.youtube.com/watch?v=b1mMgUl2ocU)！

这是一个简单的示例场景，我们使用这个库来处理一些字符：

[github.com/decentraland-scenes/npc-dialog-example-scene](http://github.com/decentraland-scenes/npc-dialog-example-scene)

并在此处查看该库的完整文档：

[github.com/decentraland/decentraland-npc-utils](http://github.com/decentraland/decentraland-npc-utils)

### 任务机制

你会发现一些原始万圣节场景的存储库有一个“HalloweenQuests”文件夹。该文件夹涵盖了清单 UI 的显示以及与服务器的通信，该服务器处理玩家从一个场景到另一个场景的进程。服务器还处理各种验证，以确保玩家不会在整个过程中作弊。

我们正在着手开发一个可以开箱即用地处理所有这些问题的功能，未来的任务将以此为基础，这将更加强大，实施起来也不会那么痛苦。

我们不想暴露我们使用的服务器的内部运作，因为这会让那些想要在短期内欺骗即将发生的事件的人变得太容易，因为这些事件可能仍然依赖于类似的机制。正因为如此——而且因为这最终会变得更容易实现——我们现在不会详细介绍场景的这方面。

下面共享的几个 repos 已删除该功能以便于阅读。在那些仍然实现此功能的设备上，您可以更改 _config.ts_ 文件中的值，以在运行预览时模拟不同的进度阶段。例如，您在创世纪广场与老太太的对话会根据 _progression_ 对象中的哪个标志设置为真而改变。

### 完整代码

**第 1 天**

[github.com/decentraland-scenes/Genesis-Plaza/tree/halloween-2020（确保检查“halloween-2020”分支）](http://github.com/decentraland-scenes/Genesis-Plaza/tree/halloween-2020%EF%BC%88%E7%A1%AE%E4%BF%9D%E6%A3%80%E6%9F%A5%E2%80%9Challoween-2020%E2%80%9D%E5%88%86%E6%94%AF%EF%BC%89)

[github.com/decentraland-scenes/cemetery2020/tree/day1（确保检查“day1”分支）](http://github.com/decentraland-scenes/cemetery2020/tree/day1%EF%BC%88%E7%A1%AE%E4%BF%9D%E6%A3%80%E6%9F%A5%E2%80%9Cday1%E2%80%9D%E5%88%86%E6%94%AF%EF%BC%89)

**第 2 天**

[github.com/decentraland-scenes/cemetery2020](http://github.com/decentraland-scenes/cemetery2020)

**第 3 天**

[github.com/decentraland-scenes/temple-trouble](http://github.com/decentraland-scenes/temple-trouble)

**第 4 天**

[github.com/decentraland-scenes/pumpkin-problem](http://github.com/decentraland-scenes/pumpkin-problem)

**第 5 天**

[github.com/decentraland-scenes/halloween-day5](http://github.com/decentraland-scenes/halloween-day5)

查看[很棒的存储库](https://github.com/decentraland-scenes/Awesome-Repository)，了解可以在自己的场景中使用的更酷的机制示例！

**选择您常用的频道加入与我们联系，关注Decentraland(MANA)的最新动态**

**DCL基金会全球社区： 【**[**Official Website**](https://decentraland.org)】 【[**Telegram**](https://t.me/decentralandTG)】 【[**Blog**](https://blog.decentraland.org)】 【[**Twitter**](https://twitter.com/decentraland)】 【[**Discord**](https://decentraland.org/discord/)】

**DCL中文社区： 【**[**电报群**](https://t.me/+BtB90_SKDeQ4OGQ1)**】 【**[**推特**](https://twitter.com/decentralandcn)】 【[**微博**](https://weibo.com/decentralandcn)】 【**微信群**】请加微信ID ChinWaan 【**微信公众号**】manalandcn

---

*Originally published on [Decentraland 中文社区](https://paragraph.com/@decentraland-2/2020-2)*
