It’s a simple Sokoban clone. Why did I create it? Well, first of all, I really liked Mini Mike’s Mini Metros – Core Collection asset pack and I wanted to use it. Also, I wanted to try to develop something for WebGL. Besides it’s been a while since I finished my last project (it still is but I got close with this one… Well, closer than usual).
Notice: It does not work on some Chrome versions.
Yes, I did not manage to finish this game but at least I have learned couple things.
Instructions for Editor
In order to edit a level press Z.
Change brush cube with shortcuts shown in the edit panel.
Change ID’s of doors and its keys with z-x. A door will only open if all keys with same IDs as the door are occupied.
To save created level, press Y and copy XML text file. To load a level paste XML text to the same input field and press U.
Unity3D + WebGL
Unity’s promise of building once and deploying anywhere holds true for the WebGL (for the most part). On my first trial I encountered with only two problems; one of which was the fact that all UI elements being “error pink” and the other one was the incorrect mapping of textures. After few hours of research, I found the answers for both. Here is what a Unity Technologies employee told about the texture problem in forums:
“So, what is going on here is that you are using an NPOT texture with mip maps enabled. This combination is not supported by WebGL 1.0 or OpenGL ES 2.0 (WebGL 2.0 and OpenGL ES 3.0 support it). Unity will try to work around this by either scaling the texture up (when the “Texture Type” in the texture importer is set to “Texture”) or to pad it (when the “Texture Type” in the texture importer is set to “Sprite”). Unity’s UI and Sprite rendering code will know about this and compensate for the padding, so you can still have pixel-precise UI rendering. But for a mesh with arbitrary UVs, we cannot automatically compensate, as we don’t know what kind of wrapping is expected. So, to fix this, you either need to:
-Import the texture as “Texture”, not as “Sprite”, as that is how you use it
-Change the texture to have power-of-two dimensions”
Changing textures’ sizes to the power of two did the trick for me. As for the pink UI, it turns out that you have to assign a material to every UI element even though everything works fine on PC build without materials.
I love editors… Usually, after I build a level or two I immediately begin to work on an editor for the game. My reasoning is that it will be easier for me to create levels in the future and in case people do like what I did, then they may create some content for this game. However, after I finished writing an editor I realized that I don’t like to create levels, especially for puzzle games (there are only two levels in Fabric created by me), and that I create editors only to be able to make other people create levels for me (Also, at that point I got bored and decided not to polish editor any further. That’s why the UI is crappy – almost non-existent).
As I began to develop this game, I wanted to create some kind of sharing platform or a database for the levels created by users. However, soon I realized that it will not be easy since I couldn’t read any files in runtime as I did with PC builds. I could have created a database on Server side etc. but since I hate web related programming, I decided to go with simplest (and probably the laziest) solution that came to my mind at that moment; reading levels from a text – input.
Web (AWS S3)
Realizing that Unity3D’s WebGL export is a simple static web page, I decided to use Amazon’s S3 service. I created a new bucket, uploaded exported files and Storage Master was working!
I guess that’s all, another project for my “Junk” category. If you like to develop it further, you are very welcome to do so! You can find the link to git at the top of this page.