Entity Component System Overview in 7 Minutes

Поділитися
Вставка
  • Опубліковано 13 тра 2024
  • A discussion of the fundamentals and implementation of entity-component-system architecture, and how it might impact your game development as Unity rolls out ECS.
    I'm told that knowing is half the battle.
    Support Board to Bits on Patreon:
    / boardtobits
    Check out Board To Bits on Facebook: / boardtobits
  • Наука та технологія

КОМЕНТАРІ • 74

  • @rakibjahan
    @rakibjahan 5 років тому +73

    Need a full on tutorial series on ECS

  • @DrPol1
    @DrPol1 3 роки тому +11

    Excellent and concise explanation, just what I was looking for!

  • @1996Pinocchio
    @1996Pinocchio 5 років тому +14

    You've explained what ECS is very well, thank you so much! :)

  • @Golemofstone
    @Golemofstone 5 років тому +17

    Wow i actually understand most of this now, really good explanation of this concept for a noobie like myself, you gained a sub sir.

  • @lhorbrum1818
    @lhorbrum1818 5 років тому +2

    You just can't get anymore awesome! Thank you so much!

  • @rugososphotos3646
    @rugososphotos3646 7 місяців тому

    Really nicely explained, this video really helped me conceptualize what ECS is and what is not

  • @sh42913
    @sh42913 3 роки тому +29

    I want to notice that performance is not main ECS advantage, main advantage of ECS is flexibility and scalability, due everything is data and you can easily change how data flow is working.

    • @Microphunktv-jb3kj
      @Microphunktv-jb3kj 4 місяці тому

      i dont get it ...
      is entities like data/metadata
      components basicly like methods or actions
      and system is more like a la "MovementSystem" "SpriteSystem" "TileSystem" "AudioSystem" etc.. for example...
      im trying to learn this thing... and doing research, what i have to learn and know to build a browser game,...
      Basicly i want to build a webbased tick or ws game.. like planetarion and darkgalaxy years ago.... i kind of liked these "background games" u could play if u dont have much time.. or on the side when you have 10-15min time and nothing to do at work...
      also seems Vue is very interactive and 2way databinding is supercool in that frameworks, was thinking of that... but it somehow feels really weirtd to use a web freamework for a game... (eventho those type of games almost aare like basicly websites where u just push tables and data haha, they're not that complex you know... my goal is to make more complex and "lively" one.... an inspioration to me is that game -> www.landsoflords.com
      i love how the map is... and how there's some RP elements in the game, wich reminds me of CK2/3 .. characters, coat of arms, hierarchy/titles etc....

  • @DasAntiNaziBroetchen
    @DasAntiNaziBroetchen 3 роки тому +9

    Storing an entity's attributes all in the same place is *not* more efficient. It all depends on the access pattern. If you're not always going to access all attributes (highly likely), you waste cache lines for unused data and hinders vectorization.
    It is better to split up the data in a way that matches the access pattern. For example:
    You're doing a lot of checks on entity positions? Store all entity positions in a giant array.

    • @SelesteDev
      @SelesteDev 7 місяців тому +3

      That’s literally what ECS is. You can store all the components within their own arrays and then have them reference the entity with an ID

  • @kruth6663
    @kruth6663 4 роки тому +2

    Excellent explanation, makes good sense even to a beginner like myself. Thanks!

  • @lleytonmorris6305
    @lleytonmorris6305 5 років тому +7

    Thank you so much for explaining this concept. For a while now i have wanted to start creating my own game and every couple of steps I come across a hurdle that makes me want to redesign the entire system. The largest hurdle has been the fact that inheritance just doesn't always allow for things. as explained, a duck is both a mammal and a bird so it makes sense to inherit from both of them, but an interface doesn't allow for me to define any code so I would have to write the same code twice in two different classes if i was to implement an interface so this method seems super logical in a game development environment.

  • @sitter2207
    @sitter2207 Рік тому

    you really explained very well. I have been watching vids about ECS for 2 hours to completely get it. After this video I will stop. Thank you so much!

  • @uweeby69
    @uweeby69 5 років тому

    you have a great voice and mic setup. very easy to listen to.

  • @ARoMxUPPer
    @ARoMxUPPer 5 років тому

    Thank you for your videos!

  • @DukeJon1969
    @DukeJon1969 2 роки тому

    Great explanation

  • @gamereplayhq
    @gamereplayhq 7 місяців тому

    i've been trying to understand entity component system, so from what i understand
    1. entity [A]: an entity can refers to an game object in our scene, and this entity holds components ( attachComponent( entity=A, component=B) )
    2. component [B]: a component has no method, only provide set of data, think of a "struct" in c language
    3. system [C] : system acts on components, they provide methods that can alter entity's component in expected manner,
    ex: so a system "C" that may increase speed attribute defined in component B
    can be used as follow : applySystemOnEntity(entity = A, system = C)

  • @luckylove72
    @luckylove72 5 років тому +2

    So from programmers point of view who has read GOF Design Pattern book. It is Composition over Inheritance for object composition?

  • @llamasarus1
    @llamasarus1 2 роки тому

    I'm going to max out what I'm able to build with the OOP inheritance-based approach then I'll check back with this when I need it. Thanks!

  • @62mohsen62
    @62mohsen62 3 роки тому

    amazing info, thanks.

  • @KeiNovak
    @KeiNovak 5 років тому +1

    Good call on holding out. Now there is DOTS!

  • @MarcoFriz
    @MarcoFriz 5 років тому

    Como siempre, muchas gracias, me ha quedado mas claro como funciona el nuevo sistema de Unity

    • @RT-.
      @RT-. 3 роки тому

      Roses are red
      Violets are blue
      The video speaks English
      So why don't you too?

    • @MarcoFriz
      @MarcoFriz 3 роки тому

      @@RT-. solo yo tengo que traducir lo que dices para entenderte?

    • @RT-.
      @RT-. 3 роки тому

      @@MarcoFriz Si. El video se habla en inglés, por lo que debe comentar también en inglés si desea que otras personas lo entiendan.

  • @10843555
    @10843555 3 роки тому +1

    Regarding the example brought up at 3:25 (and revisited again at 4:36), I don't see how this is an inherent advantage of ECS, it seems like it is just a difference in how the components are modelled using each approach (GameObjects vs ECS). If the Transform "component" used on GameObjects is bloated with all these additional fields, couldn't it just be replaced with a lightweight one modelled like the one shown in the example for ECS?

  • @dranon0o
    @dranon0o Рік тому

    For the storage, it's good to create chunks of memory by archetypes (unique combination of components)

  • @Outfrost
    @Outfrost 3 роки тому

    This is kinda random, but your infographic has told me more about the 'flyweight' pattern than the Wikipedia page for it and any explanations I could find by googling.

  • @mantasvaiciulis3657
    @mantasvaiciulis3657 5 років тому +6

    Can you make a series on dialogue? I always wondered how developers make such advanced dialogue systems. For example night in the woods, Oxenfree or any visual novel game, how do you manage so much text, different choices and outcomes? I imagine you don't type everything out in the inspector. There are ZERO tutorials on this. Ty, and great content as always.

    • @BoardToBitsGames
      @BoardToBitsGames  5 років тому +9

      Short answer is using excel sheets & data files, lol. That is an interesting idea though. I’ll give it some thought.

    • @beardordie5308
      @beardordie5308 5 років тому +2

      As a hobby I've begun scripting such a system. I've been heavily using Scriptable Objects to do so, however a full on database or Excel sheet is more appropriate for large projects. I'm focusing on how player dialogue choices can affect gameplay and are only presented as dialogue choices based on previous gameplay. Difficult to architect in a way that is loosely coupled.

    • @goombario7411
      @goombario7411 5 років тому

      You should check out ua-cam.com/video/Qsiu-zzDYww/v-deo.html, it's the Night in the Woods devs talking about their dialogue system

  • @awwastor
    @awwastor 3 роки тому +4

    “Doesn’t unity already use ECS?”
    “Well it depends what “system” means in the shortcut”

  • @TheCrXe
    @TheCrXe 5 років тому

    great one!

  • @MikoGot
    @MikoGot 5 років тому

    Thank you, good video :)

  • @Jianju69
    @Jianju69 3 роки тому

    Great explanation of the concept! Thanks

  • @osogrande4999
    @osogrande4999 4 місяці тому

    Tagged with a unique ID hash? what is it a hash of exactly?

  • @SolacePavilion
    @SolacePavilion 4 роки тому

    I think that thing about memory is not about the storage of the entity but about the fact that you are doing all the logic in order. Like, first you do all your rotation transforms then you might do all your draws and so you get better performance because you are doing many similar operations in a row. I may be wrong though, I'm new to this as well

    • @clickrush
      @clickrush 4 роки тому +3

      The memory layout of your data has massive implications on CPU performance. It has nothing to do with the similarity of sequential operations, but with how those operations access your memory. The classic OO approach and even most ECS mostly concern themselves with readability and the organization of code rather than performance. If you care about performance then you want to think about data-structures and algorithms first, including memory layout.

    • @jerrickmarques8777
      @jerrickmarques8777 2 роки тому

      @@clickrush When we're talking about memory layout, I assume it's always best for the data to be laid out sequentially in the order it is accessed? Also, I don't know if I'm missing something, but it seems like caching is always done automatically by the CPU and we don't really control how that works right?

  • @awwastor
    @awwastor 3 роки тому

    Well my game doesn’t need any of the things you said on when to use ECS but I cannot deal with inheritance in C++...

  • @danieleccleston7928
    @danieleccleston7928 4 роки тому

    can u combine ECS and oop like have the game be oop like normal and were need the flexibility add the ECS?

    • @androyd16
      @androyd16 3 роки тому +1

      He explained that ECS still integrates OOP in some ways at the early part of the video. However, it seems like you have to choose one way or the other if you want the whole project to be consistent.

    • @danieleccleston7928
      @danieleccleston7928 3 роки тому

      @@androyd16 Alright

    • @ishdx9374
      @ishdx9374 3 роки тому

      OOP isn't compatible with ECS, literally. OOP uses vtables which contain references to instance structs, which means your memory still isn't centralized and you'll get cache misses.

  • @anwaraisling
    @anwaraisling 5 років тому +1

    Thank GOD! I’ve long been frustrated with the overhead of the GameObject-Component system that’s been the hallmark of Unity. I wish I had this ages ago.

  • @ian3084
    @ian3084 4 роки тому

    Can someone explain the tag thing? How can i dynamically know which components exist or are valid for each entity? Also i don't understand how that solves the issue of whether a component exists, given it is stored in a separate array.

    • @jerrickmarques8777
      @jerrickmarques8777 2 роки тому +1

      I assume by using a custom made hashing algorithm which takes into account the components an object has

    • @ian3084
      @ian3084 2 роки тому

      @@jerrickmarques8777 Good idea

  • @tomicooltomi
    @tomicooltomi 5 років тому

    Is there any literature on Unity's ECS yet?

    • @seditt5146
      @seditt5146 4 роки тому

      There is, quite a bit but I would not really call it complete. I was not happy with the stuff I seen.

  • @cyanuranus6456
    @cyanuranus6456 2 місяці тому

    Most Thing I Know About That are an Object Can Be Controlled By User and Objects That are Alive But Aren't Controllable. Like Players and NPC

  • @bagieta21
    @bagieta21 4 роки тому

    So now we are waiting to see how you would change your flocking algorithm to ECS;)

  • @MarcoFriz
    @MarcoFriz 5 років тому

    Esperando a que cargue :)

  • @SunnyApples
    @SunnyApples 5 років тому +1

    As an aspiring Unity developer who got into programming 2 years ago, I am ready to start learning ECS.
    If Unity devs insist that ECS is just flat out better than OOP, than let's use the better way to write code!
    It looks to me like no one has a ton of experience with ECS, not even seasoned developers. That means that people will be motivated to start making lot's of tutorials for it, it will be a hot new thing, everyone will be googling it, and every UA-camr will be covering it. Exciting time to be a beginner programmer. 😃

    • @Rakkoonn
      @Rakkoonn 5 років тому +6

      A lot of gamedevs already have experience with it. This is not some new thing Unity invented, ECS and job system are already common in game development. Even Unity already had an ECS library, Entitas, which some game studios have used.

  • @mr.sunflower3461
    @mr.sunflower3461 5 років тому

    ecs is great for ai research :) cant wait

    • @mattetis
      @mattetis 3 роки тому

      Why is that? 🤔

  • @MountainKing123
    @MountainKing123 2 роки тому

    It's not a data-driven dev process, it is data-oriented.

  • @CarlosDaniel-od7bx
    @CarlosDaniel-od7bx Рік тому

    That’s why there is a drop in fps when you choose high population density in your games.

  • @warwolt
    @warwolt 5 років тому

    It's worth noting that it's common practice with component based design in object oriented programming as well! Not all OO designs are great huge inheritance hierarchies.

    • @BoardToBitsGames
      @BoardToBitsGames  5 років тому +1

      Very true - it’s basically what the original GameObject/Component architecture does in an OO context. It’s just being taken to the extreme for optimization purposes now.

    • @warwolt
      @warwolt 5 років тому

      @@BoardToBitsGames And I think a certain distinction is that the Object owns it's data _and_ behaviour, whereas the encapsulation is opened up in ECS with behaviour in the system and data in the components, no?

  • @HiasHiasHias
    @HiasHiasHias Рік тому

    Very good intro, but consider talking more slowly or at least adding subtitles!

  • @Ne0mega
    @Ne0mega 5 років тому +4

    For ten years, I could not code. I always imagined how code must work, and in my mind, I always imagined an ECS system. OOP to me has never really made much sense. It always seemed so inefficient. I can code now, but still, I am always trying to make ECS like systems, (such as the AI I am working on). Part of that may be because I always imagined making strategy games. I never, have ever imagined making games with only a couple hundred entities calling the cpu/gpu at once.

    • @xwtek3505
      @xwtek3505 3 роки тому

      You should learn OOP. You won't use it much to make game, but it's still useful elsewhere

    • @Ne0mega
      @Ne0mega 3 роки тому +2

      @@xwtek3505 I already know OOP, and I don't care to code elsewhere.

  • @UrbanLetsPlay
    @UrbanLetsPlay 3 роки тому

    i swear all the videos on ecs are just the same content with a different voice. Nothing useful here