Hey Patrons, in this weekly I’m going to share some technical details on how exactly quest sub floors will work.
Firstly though, there’s a new Shattered Secrets post, where I share some new WIP music for the regions of the dungeon!
Also, next week’s weekly will have an audio Q&A segment! Feel free to ask questions either here or on the Patreon discord.
Lastly, we also have results from Patreon Poll #42!
Crystal Caves: 74%
Mushroom Forest: 61%
Collapsed Mine: 55%
Gnoll Enchamnent: 42%
Spinner’s Lair: 39%
I feel like this poll ended up being more about ‘new hazards’ vs ‘recycling existing hazards’, which is unfortunate as It’s not at all how I intended to present it. In retrospect I should have mentioned expected implementation time for each option. The Gnoll and Spinner choices in particular were ones I was expecting to be quick as they lean heavily on existing assets. New things are obviously more exciting/compelling, but also take a lot longer to implement. I don’t want v2.2 to take forever to make, so I can’t guarantee that the quest types that appear in-game will match these results. I will at least keep this result in mind when doing further concepting and planning though, especially the strong preference for the Crystal Cave.
The base implementation of level loading and management in Shattered is actually pretty simple. All of the logic relating to level order hinges on one integer variable that’s tied to the Dungeon itself: Depth. When the player starts a game, depth = 1 and so the game generates a sewers level with a few special ‘first floor’ conditions. Every time you descend/ascend depth gets a +1/-1, and the game uses that when determining which level to load or generate. Conceptually, you can think of this as all of the game’s levels existing in a 1-dimensional line, where ‘depth’ determines how far along the line we are.

Right away this creates a problem for sub-floors, we obviously can’t just increment or decrement depth or we’ll overlap with other levels. The solution to this is fairly simple in concept, add a second integer variable called ‘branch’ so that we now work in 2 dimensions. Branch is initially 0 and stays that way for the entirety of the regular game. When we want to make a sub-floor though, we can modify ‘branch’ instead of ‘depth’, to go up/down on the 2D grid instead of left/right. So, when you descend to the blacksmith’s quest area, depth won’t change, but branch will go up by 1. For now I’ll probably just stick to using branch 0 and 1, but more values can easily be used in the future too.

This also requires a little bit of new logic around the stairs that transition levels. Previously these were very simple: stairs that go up/down means changing depth by -1/+1 and connecting to another stair that goes down/up at the destination floor. However, now some transitions might change branch, and a level might have multiple independent sets of stairs. I addressed this by adding new ‘level transition’ objects to each floor, which contain information about where they are in the level, what variables are being changed, and what type of level transition the player should end up at on the destination floor.
A lot of the code to support this has actually been in the game since v1.4, but I’ve added some more code recently in v2.1 patches so that sub-floors can actually exist. I expect to make a sample sub-floor playable in a patch for v2.1 fairly soon, so that players can test this functionality out.