Wednesday, December 4, 2019

Using Unity3D LWRP and shader graphs in real game

My previous Unity3D post was demonstrating my trials with scriptable render pipeline and shader graphs. Now I have gone one step further and combined these techniques with one of my previously released game. "Ball Twister" was originally released about an year ago. I did not advertise it too much because of boring outlook and bit simple gameplay. However, now I have found this game perfect for testing scriptable render pipeline and shader graphs in real 3D environment. Attached video shows how different new version of Ball Twister looks compared to the original one. Original version (on left) is using standard Unity render pipeline and shaders. Enhanced version (on right) is using LWRP (or URP) and shader graphs.

In enhanced version, rolling checker board texture, swirling sky and obstacle materials are all using shader graphs to create a sense of movement just by tweaking textures. Basically, only objects that are really moved are black obstacles and coins. Everything else stands still. The resulting game is still more or less playable demo, but you can download Ball Twister from Google Play Store:


Friday, November 29, 2019

New logo for WestSloth Games

The original logo of WestSloth Games was created by me for several years ago. Basically, it was a hanging sloth that was built using voxels. I guess MagicaVoxel was the tool used to create it.

In the beginning logo looked pretty ok. But over time it started to look confusing and not so good anymore. So there was a clear need to draw a new logo.

But what kind of a logo is good one? Some views can be found for example from this article concerning logo design:

"A good logo is distinctive, appropriate, practical, graphic and simple in form, and it conveys the owner’s intended message. "

So yes, logo must be at least appropriate, practical and simple. Those were the words I thought I understood. 

Additionally, there was also a short list of characteristics of good logo:
1. Simple
2. Memorable
3. Timeless
4. Versatile
5. Appropriate

So, I tried to follow these guidelines and started drawing with Inkscape. After 30 minutes of fiddling logo looked like this:

How does it look? Does it meet all the characteristics listed above? 

As I am not an artist it is bit difficult for me to judge if I really succeeded with this assignment. But in any case we are now using this logo in all WestSloth Games's marketing and social media. 


Wednesday, November 20, 2019

Unity3D LWRP Shader Graph demo (rolling checker board)

I started getting familiar with Unity render pipeline usage, because I had plans to utilize that in my upcoming game project. As a by-product I recorded a short video how to create a rolling material (or texture) using Unity3D shader graph.

Shader graph is a way to build shaders visually by creating and connecting different nodes. I would think it is simple enough even for beginners after you understand how to setup and use it.

My shader graph demo recording is available on WestSloth's Youtube channel. There is no speech included, but I hope it gives at least some idea how Unity3D shader graphs can be utilized.

I was using Unity 2019.2.13f1 and created a new project with LWRP template, that automatically brings in required packages needed in this demo.

Edit: I added another Unity3D shader graph video to Youtube.


Sunday, November 17, 2019

Unity3D events, delegates and Action

Delegates and events are very powerful features of C#. With them you can write clean and efficient code also in Unity.

However, I have found delegates bit confusing to understand. Most of the examples I have seen are not so easy to understand, especially if you are a self-taught coder like me. :)

Most of the examples I have found are using both delegate and event definitions. Something like this:
public delegate void PlayerHit(int damage); 
public event PlayerHit onPlayerHit; 

But personnally, I like using Action<> type instead. It allows you to replace two lines with one and it will make your C# code simpler. It also removes some confusing buzz around delegate definition. Here's an example:
public static event Action<int> PlayerHit;

So, at least for me this looks more understandable.

Please find below two very simple code snippets from my GitHub repository to see a real life example using Action in defining delegate. In this example event passes one integer, but you can have multiple parameters to an Action (just list your parameter types comma separated between <> characters).

TestPlayer class:

Manager class:

Sunday, September 8, 2019

Flamingo Tap Tap Run

Edit 9.9.2019: It seems that Flamingo Tap Tap Run is our most downloaded game after one week from publishing. However, I have to admit that few tens of downloads is enough for this "achievement". :) 

My game development journey continues with "Flamingo Tap Tap Run" Android game, with pretty simple visual outlook and simplified mechanics. Please download game for free from Google Play Store and have a try!

My emphasis with this project was on character animation because my previous games have been using animations for maximum of 4 frames per move. Therefore, this was first time I used Spriter tool for creating and extracting complex animation spritesheets for Flamingo movements. For example, I was using 64 frames for walk animation. After all messing and fumbling result looks pretty ok and at least character animations are lot smoother than in my previous projects.

Game logic was created with Unity3D and C#. New tricks (or structures) for me were delegates, that were used to handle status information between GameManager and Player. The overall quality of the code is again improved compared to my previous games, but I think there's still something to do better. :)

There were some challenges during the process, and the toughest one was migrating to latest Unity during the development phase. Some plugins were conflicting with each other and I had manually clean up data caches and temp directories under project folder. It just took some time to know what to do. More about this topic can be found from my previous blog article.

This game is also the first one where I was using Android App Bundle (AAB) instead of APK package. At least the download size is bit smaller and there is no need to deliver separate APKs for each target platform anymore (ARMv7, ARM64, x86). Also, scripting backend was changed to IL2CPP to get 64bit Android support working. Build time with this setup seems to be clearly longer than before, but it is tolerable when building small game like this.


Monday, August 12, 2019

Issue with Unity3D: "Found plugins with same names, and ."

Following contains my approach for fixing duplicated plugins error in Unity3D. I have no idea if it is a correct way to do this, but it worked in my case. 



So. let's start. 

I decided to try using Android App Bundle (AAP) instead of regular APK because I got an understanding that it might make game download and installation size smaller. However, I was using bit too old version of Unity3D so I downloaded latest version from their site and converted my exising game project for that.

Game conversion from Unity 2018.2.13f1 to 2019.2.0f1 was running smoothly with no errors. But when I tried to compile my little game for Android, I got bit strange error message: 
"Found plugins with same name,  and  . Delete the one of the duplicate plugins"
(please note the empty spaces around 'and' word). 

I have seen something like this earlier when struggling with different plugins, but duplicated plugins names have been reported clearly in the error message. This time was different and I did not have any idea what to look for. I tried search and destroy some plugins from caches but no success. I also tried to delete all files under "PlayerDataCache", "ShaderCache" and "FacebookSDK" directories, just to see what happens. But no success. 

I decided to return to the starting point by removing converted project and copying original project from backup to get a fresh start. After that I went under project "Library" directory and removed following subdirectories:
- PlayerDataCache
- ShaderCache
- FacebookSDK (I have no idea why it was there, since I had not used any FB stuff in project)
- il2cpp_android_* directories

After removing these directories I did 2018.2.13f1 to 2019.2.0f1 conversion again and started Android compilation with Android App Bundle build enabled. This time everything was working fine and I got AAB compiled successfully! So it seems that there were something really wrong in caches.

And yes, I have had similar issue with two projects I have converted from Unity 2018 to 2019: First one had old Data Privacy Plug-In from Asset Store so I suspected it somehow conflicted with the latest Analytics DataPrivacy API (comes with Unity 2019). But second project had no Data Privacy plugin installed, so I guess it can't be the root cause for duplicate plugin issue. 

And as stated in the beginning, I have no idea if my approach is acceptable in all cases. For me it worked, but I don't take any responsibility if you break your project with this approach. SO, MAKE BACKUP BEFORE DOING ANYTHING ELSE!