Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Up to date DOTS example project?

Discussion in 'Entity Component System' started by MadeFromPolygons, Nov 17, 2022.

  1. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,875
    Back in the day the "survival shooter" project was a fantastic way to learn unity in general, as well as many unity 5 features back when Unity 5 was considered the "new kid on the block".

    It was useful as it was a relatively complete (albeit very small in scope) game.

    In comparison the DOTS 1.0 github archive with docs is good, but doesnt really explain DOTS in the context of a completed minigame or something similar. Its very basic stuff in there. As a result its hard to see how many things fit together and get ideas on how to start in many areas

    Is there currently a completed "game" in DOTS 1.0, either official or unofficial that is on github/something similar?

    I would love to pick apart the source code and learn, to speed up my consumption and adoption of DOTS practises and the DOTS mindset
     
    Egad_McDad and Gametyme like this.
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,574
    DOTS 1.0 is not even yet released. Or I should say, it is still in preview.
    So it is clear, there is no functional demo for 1.0.
    Just use ECS samples
    https://github.com/Unity-Technologies/EntityComponentSystemSamples.
    It has also examples for 0.5x and some 1.0.
    Also see these training materials
    https://github.com/Unity-Technologies/DOTS-training-samples/tree/dots-training-2022-09-na-group2

    Based on these principles, you can build whatever you may need.
    I found older game samples like older DOTS shooter so convoluted, that I felt it was unreliable as learning source. At least back in a days.

    You could also look into our fellow developers DOTS framework.

    What is that you specifically looking for, in terms of DOTS application, that is missed in for example samples?
     
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,983
    This is definitely not "vanilla" and right now doesn't run nearly as well on 1.0 as it did on 0.50 (I haven't tried if it runs at all on beta 15 but beta 13 was really broken). But it is 1.0 now and you are always welcome to ask me about it.
    https://github.com/Dreaming381/lsss-wip
     
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,875
    Hey mate, first up thanks for replying!

    Well for example, how is camera control done? Whats the best way to interact with something like UI Toolkit right now, is it only possible via hybrid approach or what? What does a "complete" game even look like in terms of systems that they use and why, it would be nice to see examples of actual "well designed" DOTS architecture rather than having barebones samples.

    Also yes I know that 1.0 is not released but they specifically said in Unite and in their 1.0 threads that docs and samples are complete. So that makes me worried this is all we will get, which seems very barebones for a completely new paradigm that is supposed to be "the next big thing"

    So yeah I know I can use the ECS samples (they are what I was reffering to in my original post) - but they are extremely lacking and a proper sample would be great

    I am basically looking for a small twin stick shooter or similar project to learn from. The actual type of game doesnt matter, I just want to see a "well designed " and "complete" small project, as otherwise even if I can make stuff "work" I have no idea if what I am doing is a correct or scalable approach

    Naturally I will use the DOTS section of the forum more and more in the coming months as I learn, but it would be nice to not have to rely on the forums to answer questions that a well-rounded sample would answer

    This is great! However, is this using regular DOTS, or some additional framework? Either way though its a great learning resource and I certainly will reach out to you if I have any questions :) Thanks a lot for supplying this!
     
  5. PolarTron

    PolarTron

    Joined:
    Jun 21, 2013
    Posts:
    87
    I got a lot out of this part of the ECS samples project including the 3 videos they have in the intro folder and the ECS tutorial:

    https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/DOTS_Guide

    What got me to fully realize the potential of DOTS was when I discovered that the projects scale outwards, not upwards. You only need an example of a few systems working together properly, a vertical slice, and then there is not much else than APIs to use. Instead of a hierarchy of dependencies you now have a conveyor belt of machines. A linear data transformation workflow going from left to right, start to finish. Adding new functionality is simply just making a new system and installing it before and after other systems using the [UpdateBefore] and [UpdateAfter] attributes.

    I think a massive DOTS project will only serve to confuse you because the systems are meant to be modular. You might learn some tricks how to solve certain problems but they are case specific, like for example boids or pathfinding. Once you know how a single machine on the conveyor belt is made then every machine is kind of similar with maybe some minor differences.

    However, more samples are always good so let's have more of them!
     
    MadeFromPolygons and toomasio like this.
  6. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,875
    I guess I should have explained better - I can build systems pretty well right now and have some functional prototypes using DOTS, but I am struggling to understand how to break down typical OOP problems to fit the data oritiented paradigm, and seeing some complete game or demo would really help me work out how to do that problem solving


    Actually using and interacting with DOTS is a dream, but the ability to think about what "machines" I need is a new skill for a new paradigm thats difficult to get to without some sort of reference.

    Naturally if its just a case of continueing to discover for myself ,then I will keep on doing that - but I was hoping for something to kickstart this process a bit easier :)
     
    PolarTron likes this.
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,574
    The main challenge is to switch a mind, from OOP to DOP/DOD.
    Once you got that, it will be easier for you to work on component based systems.

    Regarding rendering, Hybrid is default proposed solution. But not limited to.
    In our Sanctuary project we actually use UnityEngine API for rendering, which is DrawMeshInstanced and DrawMeshInstancedIndirect
    https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstanced.html
    https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedIndirect.html

    We are using particle systems. And unity audio. Is it right way? That works for us.

    You are completely fine, using monobehaviours and DOTS in conjunction.
    I.e. inputs or UI. You simply pass data to / from DOTS systems.

    I don't think there is specific "right way".
    Each project has own use case and application.
    You still can achieve same things in a many ways.

    But as of example with machines and conveyer belts, you need first to pick right machines for the design, before considering building whole factory. Some machines still may have multiple replacements. Some may be more suitable than others.

    Another of challenges is, how you want to organize systems and jobs.
    DOTS 1.0 supposedly have better performant way of handling these.
    As of up to 0.51, too many scheduled jobs, contributes to overhead.
    That may be significant or not, depending on number of entities that you iterate inside them.

    Jobs dependencies is another important aspect, for larger designs.
    I don't think this was well presented in any past game samples.
    Plus they can be overcomplicated for learner, if not understanding certain aspect, why something was designed in a specific way. I.e. systems orders, dependencies etc. This is not obvious at a first glance, if not being aware what to look for.

    Other principles like single responsibility etc. still apply, regardless of the paradigm.


    Generally I think samples are quite enough, to present learning materials, without overwhelming and overcomplicating learning process. And learning curve is already quite a stip.
    Trying to learn whole game design, can be time consuming.
    Building from smaller blocks upward, can be faster, though.
     
    WAYNGames and MadeFromPolygons like this.
  8. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,983
    It uses my custom framework built on top of DOTS. The framework does not abstract ECS, so most of the gameplay code is standard ECS code. I do slightly different things though for command buffers and singletons, and I have my own physics and audio modules. I set up ComponentSystemGroups a bit differently too. But nearly everything else should be pretty standard ECS.
     
    bb8_1 and MadeFromPolygons like this.
  9. IsaacsUnity

    IsaacsUnity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    96
    Thanks for the discussion here! We are working on some very exciting samples for our users, including a refreshed Megacity sample, and a Racing sample that highlights multiplayer implementation using ECS for Unity. Check out our latest update at 37:15 of the following video. Stay tuned!
     
  10. unity-freestyle

    unity-freestyle

    Joined:
    Aug 26, 2015
    Posts:
    45
    Looks good!

    One question.... is this cross-play determinism like, fixed point math? Something like Photon Quantum does?
    If that's the case and Unity does deliver that some day it will be a true watershed.
     

    Attached Files:

  11. nerzoff

    nerzoff

    Joined:
    Jun 9, 2019
    Posts:
    9
    hello, is it worth waiting for a stable version of DOTS in the near future? or can I start to understand DOTS right now without being afraid of major changes?
     
  12. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,068
    I've been using DOTS since 2018, the concept has never changed, it still works the same way.
    The API has changed several times but it's very easy to learn the new syntaxes when you already understand how it works.
    From my personal experience, learning the ECS concept and gaining some experience with it is always worthwhile, regardless of version.
    AFAIK, at this point the syntaxes are not going to get big changes any time soon.

    A crazy note here !
    Learning DOTS has had an incredible impact on my performance and career in IT, even in areas that have nothing to do with unity, I went from a GO backend developer to CTO within a few years.
    BTW, thanks Unity!
     
    nerzoff and Antypodish like this.
  13. nerzoff

    nerzoff

    Joined:
    Jun 9, 2019
    Posts:
    9
    Thank you very much for your answer
     
    Opeth001 likes this.