Merry Christmas everyone! We hope you are having a great time with your loved ones. We are still working hard on Antrum so let’s talk about what has been going on this week.
The week started with a long list of new items to implement, most of them with buffs that affect the Player. José started refactoring the code taking care of that, as everything was crammed into the main player’s script. We made it like that at first just to make sure that we liked it, and now it was time to do it properly. We ended up with an Inventory controller, a Power Up controller and a Buff controller, all neatly managed. Also the Merchant code was refactored to fit better with the new systems and get rid of duplicate code.
In the meantime, Joshua started creating all the sprites needed for the items. That got us occupied for most of the week.
The magic of Shaders
We wanted to improve the visuals of the game so José started making some shaders. As you might have seen on our social media we uploaded a short clip of one of the main characters walking behind a waterfall and you could see the character’s sprite deforming behind it. As we said in a comment, we are going to explain how we made it. It’s actually a very simple shader. We started with the default sprite shader (You can get the built-in shaders here: https://github.com/TwoTailsGames/Unity-Built-in-Shaders). Then we added a GrabPass to get the image behind the sprite (More info about GrabPass here: https://docs.unity3d.com/Manual/SL-GrabPass.html), then we added another Pass between the GrabPass and the Sprite Drawing where we displace the GrabPass’ UVs based on the brightness of the Main Texture (The Sprite), in this case we only used the blue channel to displace the V part of the UVs, so if the pixel is 100% blue then we move the background image up and if it’s 0% we move it down. We added a some more values to make it more interesting but the basic shader just does that. Here is the shader if you want to check it out:
Based on the same idea, José made another shader for some crystal rocks, in this case we wanted a more precise control of the distorsion so instead of using a channel from the Sprite we made a custom texture where the red and green channel represented the X and Y displacement. We added a Sample2D and a float to the shader properties and modified the GrabPass UVs based on the texture. The shader ended up looking like this.
We are currently testing lighting, trying to find out what we like and what we don’t. As this is currently not a priority and it’s on a very early stage of development we are not going to be working full time on this, so it will be some weeks before we show anything.