April 2019 - Crunch time, new features & burnout!



Back in February I decided it was time to go into crunch mode and try to make something that I can release in a few months.  Unfortunately my blogging has dropped off quite a bit because of it.  I even had started writing up this blog post (2 months ago!) but all I did was list some of the latest updates listed here:

1) hot floor texture
2) left/right handedness switching
3) destructible feature (recursive cuts)
4) support A/X buttons on rift (much more difficult than it should have been)
5) support for a stabbing motion that integrates with the destructible feature

performance updates:
1) meshcut job system now supports the burst compiler
2) dynamic hot floor material is multithreaded + Burst
3) blade trail update is also multithreaded + burst

... but that was 2 months ago, and since then I've removed the "destructible" feature and replaced it with something else, which we'll get to later... but let's start over and talk about the ...

Hot Floor Texture

I proceeded to spend several weeks iterating on the dynamic "hot floor" texture which was a real cpu hog.  There was one massive optimization which involved figuring out how to use GetRawTextureData in order to basically edit the pixel data directly rather than having to copy it back and forth. And if you're using GetRawTextureData you can remove all calls to SetPixel() which is super slow in comparison. The other expensive part is when you update the texture on the GPU using Texture2D.Apply(). That's unavoidable (I think) and you should do that as little as possible.

By the way, I avoided updating the Unity version I was in for about a year but I had to update in order to 2018.3.1f1 to take advantage of GetRawTextureData().

Here's an example of the latest and greatest floor texture update:


Hot "cuttable" Surfaces:

At this point I thought I had already done too much. Having a dynamically updating texture was going too far and is hogging up too much cpu time.  But it looks damn cool .  Then I had an idea, since I'm already using the uv2 signal to hide "heat" data in the mesh definitions (this is why the cut chunks all have a glowing hot face), I thought I can simply update that signal when the saber stabs into an object.  That looked good so I also added the same treatment to the vertices adjacent to the cuts for a much more realistic feeling in the cuts.  So I tried it, and it looked promising... I also flew to San Francisco for one weekend so I used the flight time to optimize the heck out of the code.


Burning, melting, displacement!

And now I was really happy with the way things were going... and at this point I was sure I was done adding features and I better get started on level building or something so I can try to release something soon... but I was inspired by my recent successes so I decided to add the scariest feature of all... DISPLACEMENT! But Displacement on its own isn't so bad except that I wanted to add some adaptive tessellation to make the displacement work on relatively low-res areas of the mesh.  Now that, was and still is a scary concept.  But... I cranked out a working version in about a week...



Wireframe view for the geeks:


Enter Reddit!

I was pretty damn excited about displacement, and I was posting it on every social media outlet I was subscribed to, but I had never posted on reddit before, and it was time to give it a try... I thought subreddit r/unity3d was the place to start so I wrote this post and I was blow away by the positive response I got!

Burnout

Following the social media high that I was riding on was a real sense of physical and mental burnout. I was exhausted, anxious for no reason, kind of paranoid, and having trouble focusing on coding. Behind the scenes I've been making plans to start releasing VR experiences online, something I've been putting off for a long time.  I had to register as a business and get an EIN and to be totally honest, all that stuff is unpleasant to me, and the source of a lot of stress and anxiety for me.  Maybe that's the real problem. But I also had a lot of new bugs that I needed to fix, so that wasn't very fun.  But I basically muscled through the major bugs, and now I think I'm ready to get back into another optimization phase, then more artwork and some level design and wrapping it all up into a playable package.

Latest Update

I've been slowly going through the code to squash bugs that are hiding deep. One issue is that I have two systems that work independent of each other that are modifying the mesh so they have to talk to each other to make sure they don't cross the streams.  And the capping algorithm is a big mess that I'd like to rewrite from scratch but that will take some time... And there are a couple other additions I might add, nothing super technical, but kind of the icing on the cake... Oh, and I'm also on the current latest release of Unity which is 2019.1 which fixes an out-of-bounds joballoc bug and also includes the official release of the burst compiler.


What I learned?

To take breaks I guess. The thing is, I take lots of breaks, but maybe I put too much pressure on myself, and the breaks I was taking weren't effective enough.  I don't think I regret it, because it resulted in some massive advances in the experience I'm trying to create.  But I really need to take it easy. And hopefully I'll write more blog posts ;)

What I'm watching

Love Death And Robots on Netflix (for mature audiences)


What I'm listening to

The Atlas Underground
- if you're a fan of Tom Morello, Audioslave or Rage Against the Machine, you must check this out!


What I'm reading

Valley Of Genius:









Comments

Post a Comment

Popular Posts