Tuesday 14 January 2014

Performance test results with wheel colliders

I made some tests with my Unity project on my Nexus 7. I just made very simple "cars" (boxes with 4 wheel colliders) and at the end, I felt satisfaction!

Using the Unity Car Tutorial custom wheel collider sent me into a dead end. The physics were good, and easily adjustable, however, the performance was horrible even on a fast mobile device. Only with 5-6 cars, it started to slow down, and my program quickly reached 10-12 frames / second by adding even more. What a disappointment.

So, I decided to revert back to Unity's built in wheel collider. To be honest, I don't really like it. The good about the custom collider was the good physics and what was very important to me, it was easy to tweak. The bad was the previously mentioned performance issues.
However, I wasn't able to figure out, how to setup the built-in colliders in Unity. I mean, it's difficult to make it pretty realistic, at the same time arcade and make it easy to handle with touch control. Also, I need to animate the wheels correctly, which is an other difficulty, because I'm not happy with the other physics model of Unity Car Tutorial. So that's what I'll try to figure out. I made some performance tests and the results were better than expected!

I tested by adding 10, later 5 cars to the scene.
Unity wheel collider cars
Already 20 + 1 cars (1 was on the scene at the start), which mean 84 wheel colliders and 21 box colliders, basically I should almost stop here, as just 2-4 more cars will be needed for a full grid. However, I'll not restrict the players to race with full grid.
35! Still stable 60 FPS. Very promising, we are already far away from the needed number of cars. However, maybe the test cheats a little bit, as probably some of the cars are "sleeping".
Just a little bit further... 50 cars, 200 wheel colliders, stable 60 FPS.
 
This is the point, where we are nearing the limits. Still 60, little bit of fluctuation sometimes it went down to about 50 FPS.

41 FPS on the image, sometimes 60, 70 cars, even worse, more unstable performance. 

Yes, 70 wasn't enough, how about 95? Well, at this point, sometimes, I got 35 FPS, but hey, the custom made wheel collider made it run with 10-12 FPS with like 12(!) cars!

1 comment :