Tools Programming – Tree Generator

Trees are a pretty important part of the core gameplay system of Manifold Garden. After all, trees are the source of the cubes, which are used to solve puzzles, bend water, and grow more trees.

Tree Generator

Here are some of the tree designs:

ManifoldGarden_Tree01 ManifoldGarden_Tree02 ManifoldGarden_Tree03 ManifoldGarden_Tree04

All of the trees above were made by hand. You can see that the same tree repeats many times. I was originally planning to make 100 trees by hand. I made about 4, before I realized that process was not fun and also super tedious.

Here is how I used to build trees:

tree building old method

Like the old ways of building stairs and windows, it involved using ProBuilder and building each separate component, manually sizing and placing every segment.

Some people have asked “why not just create a set of 10 trees or so and randomize their placement?”.

The reason is because the volume of the tree matters a lot in a level. If there are only a set number of trees, I would actually have to design the level based around their volume, and the specific needs of trees vary widely from location to location.

A much more typical process for me is I’ll design a level, and then go: “this area needs a tree, but it needs to be 20x40x20 in volume, because of the setup of the level”. If I just have a fixed set of trees to choose from, it’s highly unlikely I’ll find a tree that’s exactly of that size.

Also, using a fixed set of trees can get pretty obvious to the player.

Anyway, the trees do follow a very specific ruleset in their look, so there’s really no reason that the process can’t be automated.

David and I decided to make a tree generator for this.

tree generator

As you can see, it takes a lot of input. You can choose the probability for growing upwards, the probability of a trunk or branch splitting into two, the range for each segment (vertical or horizontal), etc.

The red outline box is the tree boundary, and the green outline box is the trunk boundary. The idea is that the trunk would never grow outside of the green box, and the tree would never grow outside of the red box. They’re kind of soft boundaries (especially the red box as the leaves can go past the boundary). However, it’s pretty easy to tweak, which is part of the tool design.

You hit “Generate Tree” to create a tree, and then if you actually want to make it a tree in the game, you hit “Actually Create Tree”. This allows me to go through a bunch of variations to pick out the one I need, which is really great.

Once the tree is generated, it’s actually all in separate parts, with each branch parented to the one it grew out from, so it’s quite easy to edit (or should I say… prune?) the tree and tweak it till I get exactly what I want.

It also saves the seed value, so you can always go back to the base design.

Here’s the tool in action:

tree building new method

The key with the tree generation algorithm is that each segment uses world coordinates to determine the direction. So the y positive is always up. This was thanks to David.

I’ve done some procedural generation with fractals before, and always used local coordinate systems, with each object passing on its rotation and position with relation to its parent to the next object. In this case, none of the objects had a sense of the objective up, only in relation to its previous object. This would actually have been pretty complicated, involving passing on rotation with matrices and all that.

Using the world coordinate system worked out quite well in this case and made the algorithm a lot easier to manage and piece together. It works in this case because the trees do have a sense of “up” when growing.

Anyway, what I love about the tool is that in the time it used to take me to make one tree, I can go through hundreds of design in the same time.

Once the tree is built, there still needs to be some processing done to make it work in the game. Of course, I made a tool for this as well Smiley. That will be in the next update.

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.

 

 

Explanation of new name ‘Manifold Garden’

manifold garden

If you’ve been following the game, you’ll see that I’ve changed the name of the game from Relativity to Manifold Garden.

This wasn’t an easy decision to make by any means. The game had been known as Relativity for almost 3 years now, and had gotten press coverage and been shown at various expos with the name.

However, it was a decision that I ultimately felt very strongly about.

Name change for games in development actually isn’t that uncommon. There are plenty of examples for games which have done this: Nuclear Throne, Antichamber, Donut County, GNOG.

Reading about why and how these games changed their names was really helpful when I was going through the process, so I thought I’d share my own thought process that led me to this decision.

What started it

The game was named Relativity at the beginning because of the M.C. Escher print of the same name.

escher relativity

My idea for the very first prototype was literally to turn the print into a game, so the name made sense.

I remember searching online to see if there was another game called ‘Relativity’ already, and I couldn’t find any results, so that was good enough for me. This was in November 2012.

Fast forward to March 2014. I was in San Francisco for GDC. On Tuesday morning, a friend sent me a link to a kickstarter for a game titled ‘Relativity’.

I decided to reach out to the devs and to ask them to change the name of their game. I explained that my game had been in development for about 2.5 years at that point, and was already slated to be released on PS4, and had been profiled by major game press. I even offered to help them come up with alternative names. They were pretty adamant on the name and refused to change it though.

Here’s the full transcript of the conversation: http://imgur.com/a/GrUaw

Ultimately, after consulting with several people and my lawyer, I decided to ignore the situation. The kickstarter didn’t look like it was going anywhere – they had a few rough drawings up of the main character and were asking for $10K to buy things from the Unity asset store.

(In writing this post, I searched for the campaign, and found that they did eventually change the name to something else. The kickstarter was unsuccessful, raising only $500 out of $10000 with 1 backer)

So, this kickstarter wasn’t really a problem, but it did get me thinking – what if another studio decided to call their game ‘Relativity’ as well? What if it was a bigger studio like Ubisoft? What recourse do I have then?

Trademark

I started looking into trademarking ‘Relativity’ in the game space.

As it turns out that, Relativity Media, a Hollywood film company, actually has a trademark on the word ‘Relativity’ in the game space.

relativity full trademark

This was quite frustrating, as I couldn’t find any involvement they had with video games. However, they seemed to be incredibly aggressive with trademarking the term. If you search for ‘Relativity’ on the USPTO datatbase, it seems like they’ve trademarked ‘relativity’ for every category under the sun, from fashion to university.

I’m not really sure how they got the trademark of ‘Relativity’ in games without having made any, but that’s a topic for another day.

After talking to a few other game devs and speaking with lawyers, it seemed like these were the options I had if I wanted to keep ‘Relativity’ as my game name:

1. File for a trademark for ‘Relativity’ in games. Considering Relativity Media already had this, I didn’t have a really good chance of success here. A lawyer said I had 1 in 4 chance of being successful.

2. Contact Relativity Media and ask if I could use the name. I didn’t do this, but I highly doubt they would have said yes.

3. Don’t do anything, and wait for Relativity Media to send me a cease and desist. Maybe they won’t even care, or the game is not really a big enough issue for them to be concerned.

After two months of looking into the legal aspect of the situation, I actually decided to go with option 3) and stick with ‘Relativity’. I did add “Willy Chyr’s” to the beginning of the name, to differentiate it further, just to be safe.

(Relativity Media eventually went bankrupt, so I supposed that problem sort of resolved itself).

Actual Reason for Change

While legal reasons were what got me thinking about the name change at first, it wasn’t what made me decide to go with the change in the end.

I started to really think about whether ‘Relativity’ was the right name, and I realized the name is the only aspect of the game which hasn’t gone through a process of iteration and refinement. Everything else about the game, from the mechanics to the aesthetics, have been discarded and rewritten multiple times. The game has evolved so much since the beginning. And yet, the name (arguably a very important aspect of a game), is the same as when I started the prototype.

I also realized I never thought through carefully about the title. It was chosen as a matter of convenience because of the Escher print, but is that what my game really was about now? It made sense when gravity switching was the only mechanic, but what about the other systems and the world wrapping stuff?

Besides, there were several issues with the name ‘Relativity’:

1) It was not very searchable. Between the Einstein’s theory and Relativity Media, searching for ‘Relativity’ was alone was very unlikely to lead to the game. On google, ‘Relativity Game’ did return my game as the first result, but it was difficult to follow conversations about it on reddit or twitter. Try searching for #relativity on twitter and see what you get.

2) Everyone associates the word ‘Relativity’ with the Theory of Relativity, and while my game did deal with the idea of things being relative to one another, it did not have anything to do with Einstein’s theory. I was pretty much constantly having to explain this to people when telling someone about the game for the first time.

3) I really disliked having to add the word ‘game’ to the url or social media handle. I mean, yes, it is a game, and I know this pretty standard practice, but it just kind of felt like unnecessary pigeon holing.

Starseed Pilgrim vs Platform Planter

starseed pilgrim

Eventually, I read this Gamasutra interview with Droqen, in which he talks about how the name for Starseed Pilgrim came about.

“To this day Starseed Pilgrim builds out to PlantingPlatforms.swf”.

When I read this, I realized Droqen could have also called the game “Platform Planter”. This wouldn’t have made a difference to the gameplay or mechanics, and some people might even say it’s a better name because it actually describes the mechanic.

However, ‘Starseed Pilgrim’ is so much more beautiful. It is poetic, evocative, and mysterious. I actually think it’s one of the most beautiful game names ever. In fact, I wish I could call my game ‘Starseed Pilgrim’!

‘Starseed Pilgrim’ isn’t merely a description of the game’s mechanic. Instead, it is about the sense of wonder and the journey of discovery that the player takes, which is arguably much more true to what the game is about. Sure, on the surface it’s a game about planting platforms, but really, it’s a game about diving into the abyss of the unknown.

When I read the interview, I realized ‘Relativity’ was my version of “Platform Planter”. It was a term that described the mechanic. In a way, ‘Relativity’ was just a slightly fancier way of saying “Wall Walker”. Sure, there are different gravities that are relative to one another in direction, and that makes up the core mechanic, but it’s not what the game is about now. It doesn’t incorporate how the game brings together architecture and geometry, and it doesn’t talk about the ecosystem of the mechanics.

‘Manifold Garden’, however, felt like it hit all those marks.

Manifold Garden

So where does ‘Manifold Garden’ come from?

Manifold

A manifold is a space that when zoomed in, each part of it is Euclidean (i.e. flat), but when you zoom out, globally, it might not be.

One example of a manifold is the surface of a sphere. Let’s look at Earth. Standing on the ground, the world around us appears to be flat. The shortest distance between two points is a line, and two parallel lines do not look like they will cross. If you look at the Earth as a whole though, these properties are no longer true. If you draw two parallel lines perpendicular to the equator, they will intersect at either the north or south pole.

In Manifold Garden, one of the global geometries is having the world wrap around on itself in each of three axes. Traveling in any one direction brings you back to where you started. Going down actually leads you back up. Mathematically, this space is known as a 3-torus (which is a 3D compact manifold with no boundary)

world_025_PillarGrid_web

If you drop a cube off the edge, it comes back down from above, and you can see it falling above and below you simultaneously:Box_Looping_World_Wrap_Good_Lo-Res

You’re probably familiar with the 2D version of this from games like Asteroids. When you fly off one side of the screen, you simply come back from the other side.

ScreenWrapFlat_Lo-Res

As you can see from the gif below, the world of the spaceship exists on the surface of a donut aka a torus.

ScreenWrapTorus_Lo-Res

The 3-Torus is like this, except one dimension higher. I can’t possibly show this, as it’s only possible to see the whole thing in 4D. Basically, inManifold Garden, you’re a 3D being on the surface of a 4D donut.

This is just the start. From here, we can start to offset the repeated instances, or even twist the faces to create a solid klein bottle or a half-turn manifold (if you travel one iteration away, the world is reversed).

Finally, besides the mathematical definition, manifold also has these definitions:

1. of many kinds; numerous and varied:

2. having numerous different parts, elements, features, forms, etc.

There are going to be a lot of levels, and they’re all embedded within one another in really bizarre ways, so manifold is also incredibly fitting in this sense.

Garden

What about the gardening aspect?

I’ve shown before how cubes in the game can be used to solve puzzles – triggering switches to open doors, holding up other blocks, etc.

cube solving puzzle

The cubes are actually part of a larger ecosystem – they are fruit that grow on trees, and can in turn be “planted” to grow into trees. This is where water, comes in. You can rotate the cubes to redirect streams of water, and by directing water into a cube that’s placed on a special patch of “soil”, that cube grows into a tree. As you progress throughout the game, you’re cultivating a garden and harvesting cubes.

water_bending_looping_lo-res

In the above gif, water also reacts to the global geometry of the world. A lot of games have waterfalls, but what happens in a world in which geometry wraps around? The water falls back on itself, and you actually get a waterloop!

Conclusion

So that’s my summary of the thought process that led to changing the name of the game to “Manifold Garden”.

It was legal reasons that initially gave me the idea, but ultimately, when I started to really think about what the game has become and what it is I’m trying to do with it, ‘Relativity’ just didn’t make any sense.

The entire process took 6 months, and involved many sleepless nights, but I kept coming back to ‘Manifold Garden’, and it felt more and more right over time.

The reception with the announcement last week was quite positive.

For the first time, I was actually able to follow conversations about the game on twitter!

 

 

Interlockable Design

Trying to work out designs for the interlockables:

1

I think a gradient base works really well.

It needs some work though.

I like the outline, but not sure about the diamonds:

2

Diamonds need to be there to show direction.

Maybe having this background pattern?

3

Making the end of the white lines arrows?

4

Inactive state (also needs arrows somewhere):

5

Filling In Details

Continuing to work on this giant tower level. Filling in the details, and finally got the (almost) right exterior silhouette.

Everything is always in a state of flow, so I never say anything has been finalized.

I fixed the protruding stairs. Removed the piece of floor that was jutting out so that it doesn’t look so fragile.

0gjy7A5

Really love the staircase that wraps around the outside of the tower. It still needs a lot of tweaking. It needs to be a combination of messy and structured. It can’t look too clean or predictable, because otherwise it just isn’t very interesting:

2

I love this corner with the columns:

relativity_03

Some more outside shots:

relativity_05 relativity_06 relativity_07

Some interior shots:

relativity_08 relativity_09

Lots of great editor tools being made, and a lot done on the backend to make designing levels easier. There will be a big post about all that soon, I promise.

Stream Archive 

And last night’s level design stream in now up:

Part 1: https://youtu.be/P5EvQy-uP2g

Part 2: https://youtu.be/k7EzUwj4sZQ

Last night’s stream had the most number of viewers so far! It got up to 37 at one point. Really cool to see the community there growing!