It has been a few weeks since our last post. We’ve been busy. We have reworked the damage system, creating an alternative for softbody physics for mid to low-end machines and mobile devices. The problem with softbody physics in Unity (or any game engine for that matter) is very CPU intensive, limiting what you can do with gameplay mechanics. For example, creating a racing game with 24 softbody cars will have a decent frame rate on high-end machines, while mid to low-level devices would crash, or the frame rate would be so low it would be unplayable.
Our new Damage system has soft mesh deformation physics, which has many of the same benefits as softbody physics by removing the bouncy, jelly-like effect. Since we are trying to emulate metal and plastic-type deformations, the bounce effect is unnecessary. Now we can have more vehicles than we ever imagined on-screen with soft mesh deformation.
This technique has allowed us to focus only on updating the forces applied to mesh vertices and not calculate velocity for each vertex. In the video above, the deformations are still crude but can easily be tweaked to provide better results. At first, it was almost as CPU intensive as softbody physics, but once we integrated Unity’s Job System and the Burst Compiler, we got massive performance gains. Before Burst, the framerate averaged 10-15 frames per second with the same stress test, sometimes dropping to 2 frames per second. You can see the new framerate with Burst added in the top right-hand corner of the video above.
Next, we updated the suspension system based on play-testing and user feedback. The vehicles now lean more and have improved weight shifting of the chassis during turns, acceleration, and stopping. Updating the suspension system also required us to update our custom convex-collider system, which helps with vehicle handling and control. (I will post more about the custom convex collider next week)
Now that we have a much better understanding of Unity’s Job system, we will integrate it more and replace CPU-intensive methods in our framework. Note, we added other optimizations, but we’ll save that post for a later day. That’s all for now. To get more frequent updates, follow us on our social media accounts.
Thanks for visiting.