Search Unity

Can DOTS be used for everything?

Discussion in 'General Discussion' started by SacredSticks, Dec 2, 2022.

  1. SacredSticks

    SacredSticks

    Joined:
    Dec 15, 2020
    Posts:
    3
    My question might not seem immediately clear on its meaning. Basically, I plan on learning DOTS next year, but can (or rather should) it be used to replace everything in a game or only things that there are many of. In other words, I'm sure things like enemies could be pushed to DOTS and that would be a good idea, but what about things that there is only one of, like the player scripts for input and movement? Could I learn DOTS and use it to make a full project without any monobehaviour based scripts? This isn't really a question of performance boost, I'm sure that using DOTS for things like enemies would be far more performance improving than using DOTS for the player stuff would be, since there is only one player.
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,778
    You can mix OOP and DOD paradigms no problem.
    Meaning, you can mix mono behaviour and DOTS in the project. Use whateverr make the job done for you.
    DOTS is more than one thing. Is made of various components, for which you can use some of them. I.e. jobs with burst, just burst, just jobs, just ECS, or all together. But there ks more to it. Depending what you need.

    DOTS is not for everything. You can achieve a lot with it but you can gain a lot of flexibility, if mixing things in a smart way.
     
    lmbarns, SacredSticks and DragonCoder like this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    angrypenguin likes this.
  4. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,698
    DOTS is "just" another toolset in Unity. The devs have decided for a hybrid aproach in the end where you can still use monobehaviors and that is indeed still a reasonably good idea in many cases. You already got it right with DOTS having the biggest advantage on things of which there are "many of".

    So don't focus too narrowly on DOTS. You still need a large part of the rest of Unity if you develop a game in its entirety. Specializing only makes sense if you work in a team and you are e.g. responsible for implementing large hordes of enemies.
     
    SacredSticks likes this.
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,975
    To answer the thread title's question: no. ;)

    You still need to use MonoBehaviour for sure and this is neither inherently bad or good, it's just part of the workflow. You can write a lot of game code with DOTS - with or without Entities. But you will not be able to write GUI code with Entities for example. But usually this part of the code isn't performance critical.
     
  6. kaiyum

    kaiyum

    Joined:
    Nov 25, 2012
    Posts:
    686
    No.
    DOTS is a collection of tools and "Tools for the job" applies here. Doing DOTS where it does not make sense will hurt the project's performance. A quick example for one of my project involving mimicking the story of "pied piper of hamelin" would play nice in this thread:

    Imagine "A lot of rats in the scene". Well normally folks would revel in entering DOTS, specially into the job system. So did I! But the excitement soon faded and turned into a nightmare. It took over 1.5 months just to complete the somewhat stable stage of prototype when I generally do prototyping within two weeks. Even then it was harder to maintain the project since requirement from game design department used to change frequently. The correct method should have been using monobehaviours with coroutine to get 100 rats working at first. At the end of project's lifecycle, then it could later be converted into jobs when there will be lesser chance of further modifications.

    TLDR: Use whatever make sense to do the job. Do not just use because it is fancy, new and/or somebody else said revolutionary. Use it because you need it, do not use it because you do not need it.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    I think the more important question is “should DOTS be used for anything currently?” and the answer to that is a resounding maybe, but you should probably wait until more of its parts are not experimental.