Data-Oriented Damage System - The Hot Path Show Ep. 4
Continuing the series of sharing my notes from The Hot Path Show for everyone who uses DOTS and/or wants to learn more about it. Here are the notes for the video on implementing the damage system in ECS. Of course, it is not the one and only way to design and implement such a system, but it is a good starting point to learn how experienced developers use ECS.
- How to use the dynamic buffer buffer with the example of DamageElementBuffer to store multiple damage sources in one frame.
- 01:00:00 - You should create the entity and pass needed components instead of adding them in a separate method, because it leads to the entity being placed in one archetype and immediately moved to another.
- 01:01:00 - Since v1.2 you can use:
state.EntityManager.CreateEntity(stackalloc ComponentType[] { ComponentType.ReadOnly<T>(), ... })
This code is burstable. The old approach with using typeof(T) in CreateEntity was not burstable.
- 01:16:00 - Use [WriteGroup] to override groups with other systems.
- 01:18:00 - If you create your own ECB, use state.WorldUpdateAllocator instead of Temp or any other because this one is rewindable—it’s preallocated and clears every two frames.
- 01:38:00 - Example of ECB usage when you need to add a component not every frame and only in small quantities. ECB has a cost when doing a lot of operations.
Watch the episode: https://www.youtube.com/watch?v=SWXYpWtJZ5k
The sample project: https://github.com/TheHotPathShow/Episode-4
#ecs #dots
Post #2470
1.01K
Everyday Unity UI Toolkit with Unity ECS - The Hot Path Show Ep. 3 In a free time I develop a pet project using Entities and I've already mentioned The Hot Path Show here a few times promising to share my notes with insights from it. Even thought the videos are pretty long…YouTube Data-Oriented Damage System - The Hot Path Show Ep. 4 The Hot Path Show is a weekly livestream focused on showcasing different ways to solve problems in game development through data-oriented design. Support The Hot Path Show and get extra bonuses: https://patreon.com/TurboMakesGames Episode Sample Project…
- 🔥 7