Unity ECS (Entity Component System) - Object/Chunk/Shared/SystemState Components and Blob Assets

  Рет қаралды 10,228

Brian Will

Brian Will

Күн бұрын

Covers some of the more advanced features of Unity's ECS: Object Components, Chunk Components, Shared Components, SystemState Components, and Blob Assets.

Пікірлер: 29
@michaelbeee3801
@michaelbeee3801 4 жыл бұрын
Awesome mate, thanks a lot.
@danielecortesi77
@danielecortesi77 3 жыл бұрын
Very useful, thanks!
@RagdollRocket
@RagdollRocket 4 жыл бұрын
3 years ago you explained how object orientation is not ideal, to say the least. Now Unity has adopted data driven design (thanks to Mike Acton) to their engine. Well done proving doubters wrong =) keep up the good work and thanks for the video.
@anthonyortiz7924
@anthonyortiz7924 4 жыл бұрын
It's not ideal when performance is a requirement, but can be ideal in other scenarios. For example, OO maps very closely to how human visualize the world, and having the code structured in this fashion makes for easier learning, faster implementation times, and easier maintenance, all things being equal. The Data Oriented approach requires you to think in a way that is not second nature, therefore time is spent learning this approach, time is spent implementing it because we have to think in an unnatural way to achieve our goals, and maintenance becomes more expensive for the same reasons and also because if the developer leaves then there's the issue of finding someone with Data Oriented knowledge to replace them and most likely will have to hire and train someone, which costs time and money.
@RagdollRocket
@RagdollRocket 4 жыл бұрын
@@anthonyortiz7924 thanks for pointing that out
@anthonyortiz7924
@anthonyortiz7924 4 жыл бұрын
@@RagdollRocket No problemo! Not advocating any particular approach, just trying to add some color on why paradigms such as OO exists at all and how one might benefit from them even if they are not the most performant. Sometimes keeping human labor costs low is more important than achieving maximum computational efficiency, such as in most business organizations, while in other fields such as graphics and gaming the opposite is true. OO has its uses even in gaming where frames-per-second is not crucial, but if you're looking to squeeze every drop from your system then you need to practice Mechanical Sympathy in which knowing your system, knowing it well, and programming to it (of which DOTS is one aspect) is all important.
@RagdollRocket
@RagdollRocket 4 жыл бұрын
@@anthonyortiz7924 yeah, I think that's the right thing to do. Staying open minded for any aproach that could improve the development process is the way to go.
@michaelbeee3801
@michaelbeee3801 4 жыл бұрын
​@@anthonyortiz7924 Well you wrote: "OO maps very closely to how human visualize the world" I understand but this is something I am struggling with as it is not my the way I visualize the world. I have a tree, it has certain components and nature is executing jobs on these components, multi-threaded mind - hehe. I guess it is how we are all individually "wired". I guess as well in order to have the needed workforce to write code, we had to come up with something that more people would "get". I personally love the ECS model. This is the way Computers were designed to do things, which made me fell in love with code.
@zlinda3186
@zlinda3186 4 жыл бұрын
The usage of StateComponent is to guarentee entites are not moved to other chunk, and each of them has the same index as before during interation work, especially in ijobchunk case:)
@starburstdragon
@starburstdragon 4 жыл бұрын
Thx for great videos. It would be nice to have new series of videos - about multiplayer unity 3d (mmo) games if possible. How to : reduce lag as much as possible (which libraries to use, explaining tricks, patterns, how to do server/client predicts etc) , server structure, create server in C#,Rust(much easier - if possible) or C++, DOTS and networking etc
@sabriboughanmi2435
@sabriboughanmi2435 4 жыл бұрын
i like the way you explain things!! just a question about the ECS 0.2 and 0.3, were you able to build for android when using subscenes ?
@briantwill
@briantwill 4 жыл бұрын
Sorry, I know nothing about Android build issues.
@andywatts
@andywatts 4 жыл бұрын
Nice one
@cchance
@cchance 4 жыл бұрын
Really should have done some visuals to show the memory to give better vision into the differences
@briantwill
@briantwill 4 жыл бұрын
Did you find the last slide about blobs inadequate, or are you talking about the component types? I didn't think there's much to visualize assuming you already understand the chunk structure: For an object component, a chunk stores indexes (one per entity) into a managed array outside the chunk, where the actual objects are stored. For a chunk component, a chunk directly stores just one value for all its entities. For a shared component, a chunk stores a single index into a managed array outside the chunk, where the actual shared component value is stored. Through hashing and equality tests, it's ensured that chunks with the same shared component value have the same index into the array. How many chunks reference each value in the array is tracked with reference counting, and when no chunks reference a shared component value anymore, it is automatically disposed. SystemState components are stored just like regular components. When an entity with system state components is "destroyed", the entity is moved to a chunk with just its shared state components but none of its regular ones (all non-system state components effectively get removed).
@iamlibra3014159
@iamlibra3014159 4 жыл бұрын
@@briantwill Thank you so much for adding the detailed info as well as the video!, Simply loved it
@MidnightSt
@MidnightSt 2 жыл бұрын
chunk component for culling - BUT... how would you ensure that entities which are close to each other would be grouped into a chunk? or is my understanding of culling based on bounding areas incorrect in its assumption that if i include in my bounding area two entities which are on the opposite sides of the world, the area now contains the whole world and will never get culled? ...oh. I could ensure that via a sharedcomponent storing something like an index into a quadtree... but at that moment, i don't really need the bounding area anymore, since the quadtree index itself might be enough as info whether to cull or not...?
@adamz8314
@adamz8314 4 жыл бұрын
From where you got details from blob blob asset
@briantwill
@briantwill 4 жыл бұрын
Blobs are discussed in a video called "converting scene data to dots"
@digital42082
@digital42082 4 жыл бұрын
codeschool.org doesn’t work anymore When will it be fixed
@anthonyortiz7924
@anthonyortiz7924 4 жыл бұрын
He moved, no longer at that site.
@digital42082
@digital42082 4 жыл бұрын
@@anthonyortiz7924 is there a new website
@electricimpulsetoprogramming
@electricimpulsetoprogramming 2 жыл бұрын
@@anthonyortiz7924 to where
@dsmeckt2283
@dsmeckt2283 4 жыл бұрын
God I hate tutorials that call all variables: m, d, e, e2 etc. Just give it an appropriate name so it is easier to follow.
@milas6487
@milas6487 3 ай бұрын
Depends on the person
@Caldaron
@Caldaron 4 жыл бұрын
timestamps?
@lorenfulghum2393
@lorenfulghum2393 Жыл бұрын
So this is why you are constantly railing against OOP... You are a unity C# programmer that doesn't get to implement proper OOP because of unity's composition over inheritance principle. I had a feeling that was what was going on. A quick search of your channel confirms it. I would really suggest you take a look at Unreal Engine 5 (C++). You will quickly abandon these notions about OOP when you actually apply it in a game engine environment.
@ryano1808
@ryano1808 9 ай бұрын
Lol, you're clueless bud.
The Only Time You Should Use Polymorphism
13:55
Christopher Okhravi
Рет қаралды 83 М.
Getting Started with ECS in Unity 2019
22:44
Code Monkey
Рет қаралды 256 М.
WWE is real💔
00:16
IShowSpeed
Рет қаралды 83 МЛН
BRAWLER MUTATIONS WILL BREAK THE GAME! - Brawl Talk
09:34
Brawl Stars
Рет қаралды 25 МЛН
ТОМАТНЫЙ ДОЖДЬ #shorts
00:28
Паша Осадчий
Рет қаралды 9 МЛН
Điều cuối cùng mẹ có thể làm cho con || Sad Story  #shorts
01:00
Unity at GDC - ECS for Small Things
38:49
Unity
Рет қаралды 54 М.
Chunks! Where Unity ECS Data is Stored - Unity DOTS 2022
9:27
Turbo Makes Games
Рет қаралды 4,8 М.
Unity ECS For Beginners (DOTS)
18:52
Developers Hub
Рет қаралды 13 М.
How This Pen Changed The World
9:17
Primal Space
Рет қаралды 528 М.
Unity ECS: Pure vs Hybrid (walkthrough)
18:56
Infallible Code
Рет қаралды 74 М.
Unity ECS (Entity Component System) - 1 of 2
15:50
Brian Will
Рет қаралды 10 М.
Unity ECS 1.0 Full Project Tutorial | Step-by-Step 🧟‍♂️
2:27:31
Turbo Makes Games
Рет қаралды 125 М.
I re-coded Minecraft, purely for MAXIMUM FPS
11:26
Element X
Рет қаралды 82 М.
WWE is real💔
00:16
IShowSpeed
Рет қаралды 83 МЛН