There are A LOT of staircases in Manifold Garden.
In fact, some levels consist entirely of staircases:
It took way too long for me to finally get around to writing a staircase generator, but I’m really glad I did.
Now, ProBuilder does have a staircase generator, but the stairs in Manifold Garden have to be built in a very specific way.
0.5 is the smallest unit for the geometry in Manifold Garden. All the floors, walls, etc, are at least 0.5 units thick.
Since you can change gravity and walk on any surface in the game, every staircase needs to work on both sides. The player can walk on the top surface of the stairs, as well as the bottom surface of the stairs.
If the floor is 0.5 units thick, the stairs must be built like this:
Here’s how I would build it:
The individual steps are ProBuilder cubes, which I have to manually put in place. Once there are few, you can speed up the process by duplicating multiple steps at a time. It’s still quite slow though.
Then I have to make the “ghost steps”. These are the small invisible steps that the player actually walks on. The visible steps are actually too tall for the player to climb, since the player doesn’t actually have legs and is a just a capsule.
The ghost steps are made with ProBuilder staircase tool. However, it still takes time to figure out the size of the ghost steps, the number of steps, and also to put it in the correct position.
Anyway, for a long time, due to the 0.5 thickness requirement, I actually thought that all floors had to be 0.5 units thick and no more.
Eventually, I realized that there was actually a way to build stairs to allow for thicker floors. Thicker floors are actually quite nice because this means that the player can walk on the sides of the staircase as well, instead of just the top and the bottom.
The key was to stack the steps horizontally instead of vertically, like so:
As you can see in the image above, this allows for the floor to be 2 units thick while still making the staircase work from both top and bottom surfaces.
The build process is pretty much the same as that for thin steps (here I copied the ghost steps from another staircase):
Anyway, finally decided to write a tool to automate this process:
The tool automatically decides whether to stack horizontally or vertically depending on the step height assigned, and places the ghost steps accordingly. It also puts everything inside a parent object and names it with the width, height, and number of steps. It also assigns the correct tags and layers to the objects.
Here it is in action:
The tool took about a weekend to make, and now a step that was rather tedious for me, and took minutes to do, is now done 3, 4 button clicks in the span of a few seconds.