For those of you who visited Decentraland during the week of Halloween 2020, you will have surely run into something quite special put together by the Decentraland development team.

We created a five-day extravaganza featuring games, puzzles, prizes, zany characters and plot twists. If you’re wondering how we did it and you want to learn how to take elements and mechanics from the experience and use them in your own creations (in the Game Jam for example) then this post is for you.

In case you missed it…

You can still find most of the content from Halloween in the following locations:

The scenes are no longer connected in a linear fashion, so no need to play them in order.

Puzzle mechanics

As is usually the case when you rush to reach a deadline, the code in the original repos is not exactly the neatest, so it might be a bit too much to sort through all at once. To make things a little easier, we’ve put together a few nice example scenes that display a specific mechanic so you can study it in isolation.

Here you can find examples for each of the puzzles in the temple scene from day 3:

github.com/decentraland-scenes/mirror-puzzle

github.com/decentraland-scenes/push-box-puzzle

github.com/decentraland-scenes/light-bounce-puzzle

Using physics

On day 4 of Halloween Week 2020 we invited you to visit a farm where you could throw pumpkins into a monster’s mouth. There we used the cannon library for the bouncing physics of the pumpkin.

To see how that works, here’s a simple example that uses this physics library for some bouncing balls:

github.com/decentraland-scenes/cannon-example-scene

Here’s another example that’s a little more similar to the pumpkin throwing, but uses a basketball rather than a pumpkin:

github.com/decentraland-scenes/websocket-basket

Note: This example is built using a websockets server to sync the position of the ball for all players in the scene – something we didn’t do in our Halloween scene, but that you might also find interesting.

NPCs

The quests in Halloween featured a lot of talking to the different characters that made up the cast of this adventure.

The significant code that went into building these characters was later condensed into the NPC Utils library, which exposes a really simple interface for building these, with a lot of configurable parameters to tweak them to your needs.

Rather than busting your brains trying to figure it out from the scenes themselves, where it’s all laid out manually and sometimes rather hackishly, we encourage you to use the NPC Utils library.

Check out the video tutorial for using this library!

Here’s a simple example scene where we use this library for handling some characters:

github.com/decentraland-scenes/npc-dialog-example-scene

And check out the full docs for the library here:

github.com/decentraland/decentraland-npc-utils

Quest Mechanics

You’ll find that some of the repos of the original Halloween scenes have a “HalloweenQuests” folder. This folder covers the displaying of the checklist UI and communications with a server that handles the progression of the player as they go from scene to scene. The server also handles various validations that ensure players don’t cheat through the process.

We are starting work on a feature that should handle all of this out of the box and future quests will be built upon that, which will be a lot more robust and a lot less painful to implement.

We don’t want to expose the inner workings of the server we used as that would make it too easy for people who may want to cheat on upcoming events in the short term, as these events might still rely on similar mechanics. Because of that – and because this will eventually get a lot easier to implement – we won’t go into details about this aspect of the scenes for now.

Several of the repos shared below have that feature removed for easier reading. On those that still have this implemented, you can change the values on the config.ts file to simulate different progression stages when running preview. For example, the conversations you have with the old lady in Genesis Plaza change depending on which of the flags in the progression object are set to true.

Full code

Day 1

github.com/decentraland-scenes/Genesis-Plaza/tree/halloween-2020 (make sure you check the “halloween-2020” branch)

github.com/decentraland-scenes/cemetery2020/tree/day1 (make sure you check the “day1” branch)

Day 2

github.com/decentraland-scenes/cemetery2020

Day 3

github.com/decentraland-scenes/temple-trouble

Day 4

github.com/decentraland-scenes/pumpkin-problem

Day 5

github.com/decentraland-scenes/halloween-day5

Check the awesome repository for more cool examples of mechanics you can use in your own scenes!