Search Unity

Feedback Simple ECS Project Optimization Help

Discussion in 'Entity Component System' started by Akansh, Dec 23, 2020.

  1. Akansh

    Akansh

    Joined:
    Feb 24, 2013
    Posts:
    27
    I have a simple DOTS project using Entities, Hybrid Renderer, and Physics that I've been working on as DOTS progresses. However, I'm wondering if there's anything I'm doing wrong or what I can do to optimize this project overall. I'm not sure what areas I could change in my code to increase performance.

    In addition, I have a question about deleting entities. Is there any general benefit to deleting entities directly when needed compared to adding a "Delete" component to them and handling the deletion in a separate system?

    https://github.com/AkanshDivker/Simple-ECS

    Greatly appreciate any help and feedback, thanks :)
     
  2. vectorized-runner

    vectorized-runner

    Joined:
    Jan 22, 2018
    Posts:
    398
    I think destroying is fine. If you were to add Delete component and then destroy the entities you'd cause two sync points for no gain. The code is good, everything is bursted and uses recent entities API. I don't know why you want to improve performance when you have only 3 systems running with barely any logic though
     
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    Scale up the project until performance becomes unsatisfactory. Then take a look at the Profiler Timeline view and identify a piece you want to improve. Then post back here with what you identified.
     
  4. Akansh

    Akansh

    Joined:
    Feb 24, 2013
    Posts:
    27
    Thanks for the feedback. It's still small right now but I just wanted to make sure I was doing things the right way.

    Thanks for the feedback. I noticed a few things so far. Before I switched my project to use the new Physics package, I could stack up thousands of entities without any issues. I used to be able to run 50,000 seamlessly but now it seems to have been halved without encountering a serious performance drop.

    In addition, I noticed that my ball graphics (MovementSystem) stutter when moving, now that it's Physics based. I'm not sure how to go about fixing the stutter that occurs when trying to move the player.
     
  5. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    I'm the wrong person to ask about physics. If you have two branches before and after the changes that isolate the problems, share that on the physics forum.
     
    Akansh likes this.