Weekly dev blog #3 Optimization / Particle Paint Tutorial
Nov 5, 2017
Blood Splatter Painting Optimization
I'm still chugging along with my experimental Scanners game. This week I optimized the blood splatter script while increasing the surface area by a factor of 4 (16 planes) and maintaining a pretty solid 90fps frame rate. In the video you can see the frame rate drop, and that does concern me but I am running in the unity editor and simultaneously capturing video which are both slowing down the refresh rate.To be specific about the optimization I mainly used 2 techniques. The first thing I did was to move the Texture2d.update() calls to a separate script that takes update requests from the blood splatter script and only updates one-at-a-time. The second thing I did was to use the OnParticleCollision() method as a coroutine. So now it pauses (yields) after drawing each blood spot that was detected. Actually, in last week's video I only drew one blood spot per OnParticleCollision() call and ignored the rest. This was my cheat to get a higher frame rate. Now with the coroutine I'm able to get all of the blood spots and get improved performance. That's a huge win!
Oh, there was one more optimization. I reduced the resolution of the blood spots and reduced the number of pixels each spot occupies. I think I can still make them smaller and reduce the resolution to get another speed increase.
I also stabilized the ragdolls so they don't flip out and stretch apart even though I thought that was really funny when it happened. This was mainly accomplished by using "enable projection" on each of the character joint components. Now I just have to figure out why they sometimes jump 40 feet into the air after switching from animated to ragdoll. But I also find that pretty funny...
Here's my latest progress video:
Painting with Particles in Unity Tutorial
For the past year I've been off-and-on tweaking a script that paints spots on a texture map when a particle hits the object that the texture map is attached to. Keeping things simple, I mainly focused on the ability to draw on a uniformly scaled plane. I also opted to draw only circular spots but maybe in the future I'll be able to project images for more variation. For the most part my intention is to get a lot of impact with very little cost or setup time. And of course I just wanted the learning experience of creating this effect from scratch.I've attempted to make my first youtube unity tutorial. It was really difficult but to be fair I was exhausted but I was even more tired of putting it off for such a long time.
So, here it is in all its glory. I made a bunch of mistakes but in a way I think it creates a more rich learning experience to see the process of fixing issues on the fly. I hope to get better at this youtube tutorial thing. I think it's the best way to share programming techniques.
What I've been watching:
3 Rules For Pricing Your Indie Game:After watching the video about pricing I had to read this book:
Predictably Irrational by Dan Ariely
What I'm playing:
I finished Monument Valley 2. It was sweet.And I'm still playing Limbo. Love this game!
Comments
Post a Comment