The Stump Area in Lost in Firefly Forest – Implementation


–This post contains spoilers for Lost in Firefly Forest, consider playing the game first right here, it’s free!–

Many people have asked me how the stumps area near the end of the game was implemented. Well actually, only 2 or 3 people asked, and it was quite a while ago, but the implementation was surprisingly simple, so I thought I’d describe that in more detail.

Let’s first quickly recap the actual puzzle. To solve the room, the player has to walk a certain path along the three tree stumps on the ground. Note that the stumps are solid, impassable objects. After walking this seemingly specific path, the branches near the top of the screen disappear, opening the way to the finale.

This image has an empty alt attribute; its file name is stumpsingame.png


Now let’s take a look at what this area looks like under the hood, behind the scenes, however you want to call it, in the GameMaker Studio 2 project:

This image has an empty alt attribute; its file name is stumpsinproject.png


First of all, the pink tiles are walls. Since all the trees on the side are just sprites, these wall tiles handle the actual collision so that you cannot walk through them. Now for the puzzle in this room, there are 5 important objects present:

– The puzzle controller, i.e. the gray circle with the question mark near the top.
– Four triggers, i.e. the four blue areas.

Each trigger is tagged with a unique integer from 0 to 3. Whenever the player collides with a trigger it sends its integer tag to the controller which stores that trigger as the most recent. If we collide with the most recent trigger, nothing gets sent to the controller (so the controller doesn’t for example get non-stop 1s if we stand still on a trigger with tag 1). As long as you only touch one specific trigger while walking around, that integer will be sent once and then nothing.

The controller has an array of integers within the same range as the tags: this is the order in which the triggers must be touched. For example, if this array is [1,2,1], then this can be achieved by walking like this:


Such an array pattern is used for when the player is told to walk a circle around a stump via the clue. However, it would also be correct to walk like this:


So there is some leeway. In fact, you could walk like this, and [1,2,1] would still get done (remember, if we collide with the most recent integer, nothing happens):


Such a simple approach works firstly because the player cannot see where these triggers are, and would thus be inclined to carefully follow the path. Secondly, this leeway ensures small errors don’t get punished; there is ample room to walk between triggers, and you can even backtrack over the most recent one. While brute-forcing is still possible, it has been made very hard by making the actual in-game array to be solved long. This length should not be too unforgiving due to the aforementioned leeway.

So there’s that. When the player generates an array of numbers by walking around that is identical to the controller’s solution array, the controller removes the branches and we can be off to greet the sun.
Hopefully this post was even remotely interesting. Back to Cursed Travels: Sunken City (don’t forget to wishlist it on Steam, click here!).