Unity ECS State Machine Sample Project Overview - Unity DOTS [ECS Ver. 0.50]

  Рет қаралды 5,441

Turbo Makes Games

Turbo Makes Games

Күн бұрын

❗❗ Caution: This video was made with an older version of ECS. See pinned comment for further Details ❗❗
🍓 ECS State Machine Sample Project: github.com/Unity-Technologies... 🍓
💬 Come chat with other DOTS/ECS devs: tmg.dev/Discord 💬
🚧 Resources Mentioned 🚧
Dynamic Buffers Video: • How to Use Dynamic Buf...
💻 My Game Development Setup: tmg.dev/GameDevPC 💻
📸 My Camera Gear: tmg.dev/CameraGear 📸
🎮 Let me know what other topics you want to learn about 🎮
⌚ Time stamps for key topics ⌚
- 0:00 - Tactical Espionage Game Dev
- 0:21 - Unity ECS State Machines
- 2:50 - Unity Project Overview
- 5:48 - Guard Authoring Overview
- 10:22 - Move Toward Target System
- 11:40 - Changing States
- 14:36 - Looking for the Player
- 16:11 - Final Demonstration and Wrap-up
🌐 Find Me Online! 🌐
📄 Blog: tmg.dev
👨‍💻 GitHub: github.com/JohnnyTurbo
🎮 Games: johnnyturbo.itch.io/
🦅 Twitter: / turbomakesgames
📺 Twitch: / turbomakesgames
🎵 Music by: Joakim Karud / joakimkarud
Hitman by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. creativecommons.org/licenses/...
Source: incompetech.com/music/royalty-...
Artist: incompetech.com/
#️⃣ #UnityDOTS #UnityECS #MadeWithUnity

Пікірлер: 34
@TurboMakesGames
@TurboMakesGames Жыл бұрын
❗❗ *Caution:* This video was made using an older version of Unity ECS. While the core concepts remain the same, some of the API and workflows have changed as of ECS version 1.0. I would recommend checking out my ECS 1.0 tutorial video for a good overview of the latest standards for Unity’s DOTS: kzbin.info/www/bejne/f4CZkGmPlL6Imqc Once again, the theory behind the concepts of this video are still relevant, however the API has changed. Stay tuned for further updated videos on this subject. Please let me know if you have any questions either here or in our Discord community: tmg.dev/Discord
@felixliao8314
@felixliao8314 Жыл бұрын
Dayummmm. I love the opening!!!
@TurboMakesGames
@TurboMakesGames Жыл бұрын
Hahaha glad you liked it, I certainly had (way too much) fun making it 😀
@mmc582
@mmc582 2 жыл бұрын
Thanks for the tutorials, I appreciate all the info especially on the new 0.5 version; I've watched a good dozen of your videos already and this one looks really helpful as well with all the state system stuff.
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
Awesome, glad to hear this! Yeah the state machine setup is pretty cool 👍
@yuraYura-md2od
@yuraYura-md2od 2 жыл бұрын
Thanks, great content. The lack of DSPGraph documentation in ECS is very disappointing. Do you have any plans to make Audio ECS videos?
@TurboMakesGames
@TurboMakesGames Жыл бұрын
Glad you enjoyed and good to know you are interested in that topic! It is something on my radar, but I should just mention that there is no native audio solution in ECS - all audio must be triggered through GameObjects.
@yuraYura-md2od
@yuraYura-md2od Жыл бұрын
@@TurboMakesGames Thanks for the answer. The foundation of the upcoming DOTS audio system is the DSPGraph (now in Preview). I managed to create a DSPGraph audio system (thanks to the official Unity DSPGraph thread). But there are many problems with implementation in ECS, the solutions look very ugly)))
@user-xi1ms8lb5f
@user-xi1ms8lb5f Жыл бұрын
@@yuraYura-md2od I'm also interested in dspGraph, can I get acquainted with your implementation?
@LukeClemens
@LukeClemens 2 жыл бұрын
lmao @ the intro!! I'm a bit biased, but I must say that I prefer Infinite Axis Utility AI over state machines for controlling agents. The initial setup for utility AI is a little more time consuming, but handling transitions between states and setting up rules is easier and the resulting agent behavior is more fluid and adaptive. However, I could see state machines being useful in other game mechanics like in elevators and traffic lights. Thanks for the great info!
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
I had way too much fun making this intro 😆😆 Yeah this seems to work well for more or less simple implementations. Interested to check out the Infinite Axis Utility AI a bit more - good to hear you've been having a positive experience with it!
@ArnaudJopart
@ArnaudJopart 2 жыл бұрын
Thanks a lot for video! Do you think we could improve the logic to decrease the number of structural changes? I mean, changing state requires a lot of add/remove component. Or do you think it's acceptable regarding performance?
@crazyfox55
@crazyfox55 2 жыл бұрын
I believe the structural change is intentional essentially you'd want different systems updating the guard based on the guard state. I would only hesitate using this if the guard is changing state quite often then it might be better to just have some enum defining the guard state.
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
Good observation, the Readme file of this project talks a bit more about why they made the decision to use structural games over other ways. To summarize - they are optimizing for the most likely case - the most likely case is the guard is either moving to a target position (player or waypoint) or idling; state changes happen relatively infrequently. Because of this, it makes more sense to have separate systems to query for guards in a particular state, rather then having a larger system that potentially wastes processing power by constantly checking the state
@ArnaudJopart
@ArnaudJopart 2 жыл бұрын
@@crazyfox55 Thanks for your advice. I was indeed thinking about using enums. But I like the idea having separated systems handling each state. More "Single Responsability Principle" friendly
@ArnaudJopart
@ArnaudJopart 2 жыл бұрын
@@TurboMakesGames That makes sense. Thanks a lot
@senit_senit
@senit_senit Жыл бұрын
Can I create a mixed game? My point is the game would only use ECS DOTS for a few mechanics, e.g. rendering and unit behavior. The rest of the mechanics would be done according to the old idea of creating games in Unity? Is it possible?/ Doesn't it make sense?
@TurboMakesGames
@TurboMakesGames Жыл бұрын
Yes definitely! In fact, because many features in regular Unity don't have a DOTS counterpart yet, you still need to use GameObjects to do things like animations and particle systems. But yeah it is definitely possible to make a game that is mostly traditional Unity, with select systems using ECS
@crazyfox55
@crazyfox55 2 жыл бұрын
Looks extremely useful. However I would immediately like to change the idle timer code. With 1000 entities there are 1000 float values all incrementing by the same amount and checking if enough idle time has passed. Instead I would use a priority queue with the priority being the game time of when enough idle time has passed. To enter the queue a guard would add itself to a priority queue with priority being (current game total time + idle duration). A priority queue is just a queue that is sorted. For each frame check the queue if the current game time is >= the queue priority then remove that guard from the idle state and check the queue again to see if the next guard is also ready. This implementation means that only one float is checked per frame regardless of the number of guards. Also this is totally separate from ECS besides removing the idle component. What do you think?
@UnofficialFoneE
@UnofficialFoneE 2 жыл бұрын
That is a smart implementation but there is a couple of problems: Firstly, using a priority queue means we can't parallelize the code -- at least not without doing some work. Secondly, the fact that there are 1000 entities all incrementation by the same amount and checking if there is enough idle time means that we can really use the power of vectorization to run that code extremely fast. So, with all this, in the end I wouldn't be surprised if for 1000 entities, using a priority queue would actually be slower, if not more of a headache that doing the really simple approach. There is one place that in the example which is really the slow part and that is when you have to call ECB's to remove/add tags. If you are making a simulation where high, high entity counts are priority, these calls are not great for the vectorization of your calculations. But take this with a grain of salt if the target entity count is only 1000 entities.
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
That priority queue is an interesting thought to save on all the comparisons. One idea I had that would be like a half step to this would be to have one master game timer ticking up each frame, then when the entity begins idling, the timer component is set to the game time at which the guard exits the idle state. Each frame all entities in the idle state would need to compare their target value with the master game time. But with any optimization solution, you just need to consider what is the most likely case and optimize for that
@crazyfox55
@crazyfox55 2 жыл бұрын
@@TurboMakesGames another optimization if the idle times are more than just a few seconds is to have two stages of idle. The first stage would add a component "long idle time" this component would be checked in a system that runs only once per second. Then once the remaining time is below 2 seconds then switch to the regular idle component. Obviously play around with the different stages and rate of their systems to find an optimal solution.
@philippb8894
@philippb8894 Жыл бұрын
how i can use visual interface for creating state machine?
@TurboMakesGames
@TurboMakesGames Жыл бұрын
Right now there isn't a good solution that is compatible with ECS right out of the box. If you wanted this you'd probably have to build something custom.
@datcong974
@datcong974 2 жыл бұрын
it pretty cool, but remove and add component in networking is bad idea
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
That's a fair point, I could definitely see how you could run into lots of sync issues. Is this something you've had experience with, or just generally try to avoid?
@datcong974
@datcong974 2 жыл бұрын
@@TurboMakesGames i tried doing that in my personal project, and it is not good in predicting player actions
@watercat1248
@watercat1248 2 жыл бұрын
UT 2004 music in the start lech hope this video i will not tern down by KZbin
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
It's royalty free music, thanks for looking out though!
@watercat1248
@watercat1248 2 жыл бұрын
@@TurboMakesGames royalty free thats mean you pay in the and you able to use this music wherever you wish you wise right ?
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
@@watercat1248 Royalty free simply means I don't need to pay royalty fees for using the song. In this particular case I didn't need to pay any money, just give credit in the description of the video. Different songs/artists have different restrictions on how you can use the music and what you need to do to use it
@watercat1248
@watercat1248 2 жыл бұрын
@@TurboMakesGames ok
@sinistermephisto65
@sinistermephisto65 Жыл бұрын
Unity deleted this
@TurboMakesGames
@TurboMakesGames Жыл бұрын
Yes, but they have some better sample projects up that I'd like to go over soon
Using Animation Curves in ECS - Unity DOTS Tutorial [ECS Ver. 0.50]
21:51
Turbo Makes Games
Рет қаралды 4,6 М.
The most impenetrable game in the world🐶?
00:13
LOL
Рет қаралды 33 МЛН
Glow Stick Secret 😱 #shorts
00:37
Mr DegrEE
Рет қаралды 145 МЛН
ELE QUEBROU A TAÇA DE FUTEBOL
00:45
Matheus Kriwat
Рет қаралды 16 МЛН
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 2,3 МЛН
Entities 0.51 - New Version Released! [2021 LTS] - Unity DOTS
10:38
Turbo Makes Games
Рет қаралды 5 М.
Unity ECS State Machine Discussion - Unity DOTS 2022
11:53
Turbo Makes Games
Рет қаралды 3,1 М.
How to Use Write Groups the Right Way! - Unity DOTS Tutorial [ECS Ver. 0.17]
19:44
Code Class - Build your own State Machines!
36:42
AdamCYounis
Рет қаралды 33 М.
Entity Component System Overview in 7 Minutes
7:21
Board To Bits Games
Рет қаралды 97 М.
System State Components in Unity ECS - Unity DOTS Tutorial [ECS Ver. 0.17]
14:25
Unity Performance Tips: Draw Calls
4:24
Lofi Dev
Рет қаралды 176 М.
Megacity Flythrough
1:27
Unity
Рет қаралды 92 М.
The most impenetrable game in the world🐶?
00:13
LOL
Рет қаралды 33 МЛН