Gradient Color Leaves

Added some code so that the gradient can now be offset from world space origin, and also any axis (including diagonal) can be used to form the gradient.

The coolest part is that it’s all done using a dot product in the shader instead of conditionals.

Initially, I did the diagonal gradient just because I could, but then it turned out to make a lot more sense, and also looks way cool, so I think that’s the one I am going to go with.

Here are some screenshots:

1 2 3 4 5 6

Man… all these different mechanics are finally starting to come together. It’s really exciting, but also super overwhelming. Looking forward to playtesting new puzzles soon.

Also, because I’ve just been trying to get these mechanics working, all the code I’ve written these last 2 days have been a total mess. Magic numbers everywhere!

Transparent gradient shader

Spent all of last night trying to write a transparent gradient shader, and learned a lot about Unity 5′s Standard Surface Shader model in the process.

I wanted a tree that grew double gravity cubes.

This was my first go: 6r61GQ6

As you can see, it is absolutely hideous.

I thought a better style would be to have a gradient going from blue to red from bottom to top through the leaves.

I had a really hard time though trying to write a surface shader that did this.

You see, if I added the tag

RenderType" = "Transparent


RenderType" = "Transparent

which seems to be what you’re supposed to do if you want something transparent rendered, I get this:


Notice that there are no outlines in the red leaves (that’s the shader I’m writing).

However, in the blue leaves, which uses the “Transparent” rendering mode of the Unity 5 standard surface shader, there are outlines.

If I use “RenderType” = “Opaque”, I get this irregardless of what alpha value I set the output color to:


I was getting super confused and frustrated, because no matter what combination of RenderType or Queue tags with “Transparent” and “AlphaTest”, the leaves were being rendered after all the edges were drawn.

As it turns out, in the Shaders 5.0 upgrade guide:

By default all opaque surface shaders output 1.0 (“white”) into alpha channel now. If you want to stop that, use “keepalpha” option on the #pragma surface line.

I needed to add keelalpha on the #pragma surface line.

I also found I needed this line for the shader to work:

Blend SrcAlpha OneMinusSrcAlpha

I don’t fully understand why, but if I comment out the line the shader doesn’t work.

Eventually, I was able to get it to work, but instead of gradient, I just saw black:


I switched to setting the gradient on screenspace, and that seemed to be working:


And then it hit me – I was using world space position, and all my objects were located in y < 0 ! That’s why everything was black.

I zoomed out, and lo and behold: i23zyYQ

The point at which black changed to red is y = 0.

I just moved everything up to y = 0, and it was working:


This was around 3 AM, so I wasn’t really thinking straight, hence such a silly mistake.

Anyway, today I will add some code so that it can use the local position to set the gradient instead of relying on world space y = 0.


Color Change Beam Puzzles

Worked on a bunch of new puzzles involving beams that change the colors of the cubes.

Having spent the past 6 months or so tweaking details of existing puzzles, I had forgotten how hard it is to design a puzzle from scratch. Puzzle design definitely uses a very different muscle than level design. I’m feeling a bit rusty in that department.

These were based on a few rough drafts that I had built about a year and half ago, with some very basic ideas. There was some stuff to go from, but for the most part, it had been so long, and many of those were so poorly designed, that it was pretty much starting all over again.

Anyway, got 5 built! I’m excited to start testing these next week.

1thUx1n a2tHGn7 uSNp03a

Color Changing Cubes

Getting back into working on beams that change the color of cubes. Interestingly enough, this is the mechanic I was working on back when I first started this devlog. It was what I talked about during the very first update.


You can change the color of a cube multiple times. Notice that the inside of the cube maintains its original color.

Also working on these large tetramino (I think?) blocks:




Start Screen Improved

Got around to working on the design of the start screen.

Here’s a comparison of the first go at a new start screen compared to the old one:


The ‘Press Start’ text was too small (Unity has a font size limit), so I replaced it with a sprite:


Also tried it with a fade in fade out effect (it doesn’t loop as well in gif form):


More Gameplay Elements to World 1

Was planning to spend the day optimizing, but instead ended up taking the whole day to implement a final few gameplay elements and to make tweaks the the level.

It wasn’t all in vain though. I realized the realize why Animation component wasn’t working was because I hadn’t marked those animations as “legacy” (which can only be seen when the inspector is in debug mode).

Anyway, I saw that Animator was taking a huge hit on the CPU, so I switched all the animation back to Animation, and things are running much smoother now.

Also, finally all the gameplay elements for world 1 are now in. Even when it comes to making levels, the last 10% really do take 90% of the work.

5KiMeQ6 VhpxAsK YPqcwUq