Z-buffer problem in Unity on WebGL

While working on a new game I stuck in the rendering problem. There are not much information about this on the internet so I wanted to share the information that could help someone.

First, my setup: Unity 2021.1, URP, Windows. 

Everything looks fine in the Editor but when I built my project to WebGL 2.0, I found weird vertex/facing jittering:

It reminded me popular Z-Fighting problem, but not only with nearby surfaces but much worse. It turned out that this problem related to the Z-buffer. Unfortunately, WebGL don't have the same capability to write depth as OpenGL or DirectX (I expect because of no floating point depth buffer).

So I reduced Camera clipping planes distance from ~1000 units to 400 units and it fixed the problem for my in-game scales. Here the same build, but with new Camera settings, no jittering:

It hasn't solved the problem completely and I know there are more pain in the future, when new game design requirements will appear. But my target was to understand and solve the problem by using standard Unity tools without adding custom shader or other long-term support solutions.

By the way, the shown game is procedural role-playing rogue-lite adventure that I'm updating from time to time with new content and mechanics. And it's already playable on itch:



Summary 2020

While almost completely ignored jams this year (with the exception of QUBOR for Ludum Dare 46), from the very beginning of the year I set myself the goal of making a complete vertical slice of some new, but easy-to-develop project. Then it seemed that a shooter about a tank would be the simple idea.

The first prototypes did not show the amount of work
that awaited me in the future
And now the project, originally planned for 3-4 months of development, has to barely keep pace until the end of this year (and still leave something for later).

MARK-I: Mission Pilot

Inspired mainly by classic NES games (eg, Contra or Jackal), I wanted to make an arcade shoot 'em up. Since personally I am not a big fan of bullet hell games, I wanted to make a game with a fairly low entry threshold. But trying to find fun in a "not like everyone else" format without explicit borrowing or cloning turned out to be a daunting task. I am still not sure that I coped with it, despite the subjective satisfaction with the result.

The idea of a story in the world of the near future quickly came to my mind, where the player takes on the role of a pilot of a combat vehicle called MARK-I (much later I learned that the project with such existed in reality). A very banal evil bad corporation, a mission to destroy some kind of Core, and at the end the boss-helicopter must certainly awaits. Initially, I wanted to put more emphasis on narrative, but as a result, of course, it is difficult to fit in with the dynamics of the game.

The scene in the cabin of the MARK-I turned out
to be not very readable, but I still wanted to leave it
As a vertical slice demo I set myself the task of making about 15 minutes of intense gameplay. But there is reason why the genre of action games is one of the most expensive in the gaming industry: the player has a set of expectations that require the game to be worked out in very different areas and very densely filled with content. It turned out to be very difficult to deal with this alone.

Development difficulties

Level design and content filling took significantly longer than expected. Whithout great experience in this area, collecting levels even from ready-made objects was complex and time-consuming for me, required full immersion. And in general, the process of filling with content was not as fun as creating new systems in the game.

Due to the chosen scope of the game, I had to redo and fix all ~15 minutes of gameplay several times. Almost all game locations were rebuilt from scratch 3-4 times. In general, the constant alterations, the need for which notifies after the next playtest, is morally and physically exhausting the most. One of the hardest things to do is cope with your anxiety about repetitive development.

Perhaps many will understand the feeling of some disgust for own project,
when throughout the year you open it and see the exact same thing
Needless to say, many added features had to be thrown out. This often has a positive effect on the final result, but the time spent initially cannot be returned. So, for example, the collected data with knowledge about the world, or battle chips obtained from enemies, which initially serve as currency for upgrades, were cut. Many features had to be postponed as they only make sense in the context of a full-size game for a few hours.

At a certain stage, I decided to add a local coop for 2 players, which should become one of the main selling points. Despite the fact that from the very beginning I had in my head the ability to control from a gamepad (now the game can be played entirely with an Xbox controller), this control option turned out to be more difficult to play than a mouse with keyboard. But nevertheless, I'm glad that now the controls can be easily adapted even for two independent Joy-Cons from Nintendo Switch.

Experience gained

Despite the fact that it is difficult for me to give any subjective assessment of the final result, I am very happy with the process and the knowledge gained. One of the most important questions for me - could I work on one hobby project for a year, or maybe even more? - received a positive answer. I learned a lot in areas that I had to deal with a little less before: working with 3D in Unity, physics, rendering, navigation and ai, sound producing and much more.

Regularly posting screenshots to Twitter allows you to periodically look from the outside at the visual component of the game. Only a few subscribers were not enough to overcome the milestone of 100 followers by the end of the year :D Maybe by the 10th anniversary of the account next year it will be possible to do this.

The scene that started it all, but in pre-final form
Regular playtests are one of the most effective tools. In order not to blur the eyes of the players, since every time the feedback is very useful, I tried not to build demos frequintly, making breaks between internal releases of 1-2 months. Once I even managed to make a public playtest within of one local meetup, where I managed to look at very different players trying the game for the first time. Yes, you can't please absolutely everyone, very often the feedback turns out to be very cruel, but this is what makes you reflect on the project.

I was convinced once again how planning works in the industry. Especially now that this issue of overworking and crunches has resurfaced in publicity. The deadlines that business management lays down in the project almost never coincides with the internal reality, especially at the seemingly final stages of development. Planning is great for short iterations between playtests, but it's very hard to rely on in the long run. Quality assurance of the project takes more time, relative to the first stages of development. The devil is in the details.

* * *

About plans: at the beginning of the year to release the received vertical slice as an independent game in Steam. And finally, let go of the project and not return to it (unless, of course, I can find a publisher before release).

I really want to take another look at my indie approach, reduce the amount of stress and the semblance of "work", leaving the indie gamedev hobby in a freer and more fun style. It’s hard to watch after iteration “2021”. I wish you all creative success and strength to create!


My Jam Entries 2019

My indie releases of last year were made as entries to 3 short game jams.

In the April, I got trip to Berlin to visit A MAZE. As a part of this amazing indie video game festival, there was Berlin Mini Jam for a short (something like 8 hours) game jam as part of last festival's day. The theme was `The sky is really the limit` and made a game with same name. The sky really is the limit is a little philosophical sketch with a bit of nihilism, about people of different time and different places which asked themself metaphysic questions just by looking to the deepness of space above they heads, and how these questions changes throughout life.

In the August, was GMTK Game Jam from popular game analysis Youtube channel. It was one of the biggest global jams of last year and I was in. Theme was `only one`, 2 days and jam felt exactly as Ludum Dare. Finished with theonism – political satire game inspired by the events that was going in Russia same time when the jam was.

In the end of November happened Eco Jam Hackathon. I was hyped by the fact that jam took place in the GARAGE museum of modern art. So I visited Moscow for a weekend to participate in this jam. It was really inspiring experience, and at the end I has Waste Problem, city-building/clicker game that is touching the theme of garbage and it's utilization that really edge question in Russia right now.


Personal thoughts

Hello my lovely diary...

Writing posts regularly does not work (as usual), and there is no need for it yet. In order not to completely disappear from the radar, I decided to write at the beginning of the year about my state of the mind.

Recent events

Successfully moved to Unity. Fate of my previous Flash projects is pretty foggy. It is important  for me because "My Pocket Hobo" and "My Pocket Pony" are only games that produces any money – like about 30$ per month. Not much, I know, but it still better than nothing.

Made hyper casual game Hit Balls. May be I'll write the whole post (no) about what for I've made it and what results after all.

Got a new office job in a startup, making hyper casual games for mobile, trying to pay off investments. I think it almost the best option for me in the job market to do what I like.


Developing one new game prototype. I have ambitions to do a really original product, but it's still to early to judge about it. But who knows, sometimes I'm drop out my ideas...

From time to time I experience personal conflicts about my goals into game development. Most often it comes down to the classic issue of money versus art. But many other questions too often come up in my head – what products to invest own time, how much it is worth investing, how to find a balance with employment, and so on.

All also for a long time I experience long periods of decline and the rise of the motivation. I don’t even fighting with it, but I try to simply adapt to this inconstancy: when I rise, I try to keep it as long as possible; when the decline, I try to minimize losses and quick as possible return to a productive track.

my free time

But most important personally for me is that gamedev still warms my heart. My love to it changes over time, but it so natural process. I wish everyone to continue to do their favorite things and that the new 2019th year was better than the previous one. Бороться трудно и удачу!


Feelings about Unity after Flash

I'm Flash developer almost whole conscious life. Started with Macromedia Flash MX 6 around 15 years ago, I wanted to make cartoons and then I found potential for games. I tried to program with frames and `goto` but learned programming only years later. All my jobs was related to Flash and I'm working as mobile AIR developer now.

But epoch is gone. Everyone heard about Flash death (that slightly exaggerated on my opinion). When everyone already moved to other technologies such as JS and Unity, I'm only started this way. And today I want to share my feelings about moving to Unity 3D after years of developing with Flash and ActionScript.


First at all I can recommend to start from official manual which is structured really well and written easily and informative. Who knows may be it will abolish the need for further reading. Here my understandings of basics Unity concepts.

Project (that almost always are games) consist of Scenes. Each Scene represents independent 3d-space. Let think about Scenes like about separate stages (Flash IDE also have scenes concept but I never used it for development). Even 2d-games are exists in 3 dimensions – I hope you know how z-index works.

This 3d-space is container for GameObjects. Something like DisplayObjects in Flash. And each GameObject (GO) has Transform component/property – information about it position, rotation and scale.

Prefabs are something like stored GOs, presets. You can reuse prefabs with different ways. It one of basic tools of Unity and it better to learn about it in a chapter of manual.

Each GO can (and should) have components. Components are code that describes behaviour of GOs. Working in Unity, you will use many built-in components, as well as write your own. Working with components are main part of business in Unity.

Few more notices

Measure system. Don't forget that Unity (unlike Flash) uses units measure system. It could be a problem at first, but soon becomes natural.

CSharp. Despite the fact that Unity allows you to choose the programming language of a few, of course you need to use C# as only one language. Especially if you programmed on ActionScript 3.0 before. Mostly all projects (I will assume >99%) made in Unity are written on C#.

Rider. I like JetBrains IDEs. So highly recommend Rider instead of MonoDevelop as main code editor. It easy to integrate to Unity and much more comfortable to work with.


I'm using Unity hardly more than month but it hard to describe how it changed my approach of development strategy. I'm writing much less code than in Flash for same functionality. Working with components is much more conveniently for game development. I'm excited from possibilities that Unity gave me and ready for new experience.


The Return

Reasons for return

More that three years have passed since the last publications in this blog. Now I'm filled with new ideas, desires and power to revive blog and create new content.

In general, I want to do a blog for myself: it's a good opportunity to write some ideas, as well as a good way to practice English. And this post is something like formality, explaining the further destiny of this blog.

What kind of posts are expected in the future?

Of course about game development. I want to pay attention on the analysis of prototypes, new releases and updates – key ideas and hypotheses, devlog notes, current statuses and post-mortems.

Also, I plan to expand the subject of the posts. Lately a number of thoughts have appeared that I want to share with others; in common about self-organization. And I always wanted to review some products (games, movies, software, etc.), now I hope to find time for it.

About tech side of the blog

Old blog used WordPress on custom hosting but it was lost in time. I decided to use Blogger for new version. It's not the best platform for blogging but I like Google services and hope that blogger could be better in future.

I revived old posts using Web Archive but some pictures, links or formatting could be missed. These posts labeled as `oldpost`, don't have great importance, but I want to save them by some reason.

This time I don't promise any regularity of publishing posts, but I'll be glad if you check here sometimes (it's strange that I can't find any subscription tool on the blogger).


Little release, new announcement and Twitch

As I said in previous post, PATRIOT project is frozen for indefinite term. But it’s not mean that closed. PATRIOT is almost complete and I will return to it in near future. But I have some news.
Few time ago I released small game called TwoNumbers. It was made in only one night. Game has little confusing rules, but it is very simple and minimalistic. I got some feedback (even from Tom Fulp at PM on Newgrounds) and hope I’ll make mobile port soon. Don’t be strict, just keep in mind that it was made by one man in few hours.
I noticed, that my last games was really simple and small. So I started make new game called Holiday in DPRK. It’s something like jRPG about team of cool soldiers in North Korea which must kill Kim Jong-un. Game is a satiric and trash a little. I started to draw for this game. I hope I will develop it till the end and it will get positive feedback. I planned make game about North Korea already few months, but only short time ago I got nice idea.
And last little news is about my Twitch channel. Sometimes I stream game development there. Not really interesting but who knows. Just follow it. Thanks.