Search Instagram Twitter Facebook Spotify Grid Tag Date Folder Chat Pencil

Tools Programming – Staircase Generator

There are A LOT of staircases in Manifold Garden.

In fact, some levels consist entirely of staircases:

ManifoldGarden_Stairs

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.

Thin Stairs

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:

ManifoldGarden_StairsBuildingProBuilder

Here’s how I would build it:

stairsbuilding_oldmethod

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.

Thick Stairs

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:

manifoldgarden_thickstairs

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):

stairbuilding_thick_old_method

Staircase Generator

Anyway, finally decided to write a tool to automate this process:

manifoldgarden_staircasegenerator

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:

stairbuilding_new

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.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.