Search Unity

Question Optimizing Dots Physics

Discussion in 'Physics for ECS' started by miraycalskn, Nov 26, 2022.

  1. miraycalskn

    miraycalskn

    Joined:
    Jun 28, 2020
    Posts:
    10
    Hi everyone!
    What im trying to do is creating a huge physics simulation on mobile (only ios for now) i'm using entities 0.51exp. It's actually performing really good but i need something better and i've been searching online for a while now, here are the results i'm getting rn;
    Solver Iteration Count = 1 (Unity Physics)
    33 ms 30 fps
    12.200 Entity

    Solver Iteration Count = 4 (Unity Physics)
    33ms 30 fps
    12.430 Entity

    Solver Iteration Count = 4 (Havok Physics)
    34 ms 30 fps
    12.350 Entity

    Solver Iteration Count = 1 (Havok Physics)
    34 ms 30 fps
    12.380 Entity

    I need it to be a little more better and im out of ideas, does anyone knows how can i optimize this system more?
     
  2. inSight01

    inSight01

    Joined:
    Apr 18, 2017
    Posts:
    90
    What is it you are trying to accomplish?

    12k entities with full physics interaction and getting 30fps on mobile seems pretty impressive to me. You could try increasing the timestep. It will reduce the accuracy of the physics but will increase performance quite a bit.
     
  3. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,980
    you are getting 30fps on mobile with that many entities, thats already impressive.
    In order to get better improvements you will need to be on latest entities 1.0 and latest physics packages - a lot has changed since 0.51.

    Do everything you can in iSystems , try to avoid systembase as much as possible. This way all the functions can be made burstable. I have seen improvements of 20-30x when swapping to Isystem from systembase in some cases
     
    JMPM-UNITY likes this.
  4. miraycalskn

    miraycalskn

    Joined:
    Jun 28, 2020
    Posts:
    10
    Thanks for the answers. Entities1.0 did not change result as well i believe this the limit for now(it gets a bit better with physics adjustments but accuracy is a huge deal breaker for me). I guess havok lightweight rigidbodies will change a lot so we need to wait that release for now :) I manged to get 60 fps stable on mobile with 4k gameobjects so i switched back to old systems for this simulation. I hope i will make a better one when the time comes with fully releases :)