Here's one way to mix Game Objects with super fast DOTS code! How would you mix them in your games? These complex DOTS videos take a long time to make so if you find them helpful consider supporting on Patreon or picking up the Game Bundle 📍 www.patreon.com/unitycodemonkey 📦 unitycodemonkey.com/gamebundle.php
@b1ngb0ng25 жыл бұрын
please do 2d post prossecing
@MasterofFire-sc3yn5 жыл бұрын
Hi Code Monkey, How do you use separate sprites in a sprite sheet and still do the animation (in the files of the marine sprites)
@CodeMonkeyUnity5 жыл бұрын
@@MasterofFire-sc3yn Check out this video where I cover how my animation system works kzbin.info/www/bejne/Z2LGaqWNh9SngJo
@themadmadsen5 жыл бұрын
You are freaking brilliant, this was EXACTLY what I was wanting to do with our current game and here you are swooping in and saving me hours and hours of research time and troubleshooting. New Patreon supporter incoming!
@CodeMonkeyUnity5 жыл бұрын
Awesome! Glad you found it helpful!
@blobfish57135 жыл бұрын
I recently found your content and it helped me improve a lot! Thanks a lot of sharing and making us videos for free, we highly apperciate that
@varnonzero4 жыл бұрын
Excellent video. This should have way more likes. Mixing ECS with monobehavior seems incredibly useful.
@RiderontheStorm19922 жыл бұрын
This is the exact topic I needed. Thanks Code Monkey!
@jorouss335 жыл бұрын
Yep, there we go
@mythik96365 жыл бұрын
I love how clean your code is and is so easy to read. What ICE do you use?
@CodeMonkeyUnity5 жыл бұрын
IDE? Im using Visual Studio Community
@mythik96365 жыл бұрын
@@CodeMonkeyUnity ok
@taylors15455 жыл бұрын
Your pathfinding system builds a new grid for each request. It would be nice to see how to batch requests so the grid is built once. Or, use a second system for updating a persistent grid.
@CodeMonkeyUnity5 жыл бұрын
Yes a batching system is definitely something that Id like to cover, its the way to go in order to use it in a proper game
@SkrekkLich5 жыл бұрын
I recently discovered your channel. I really like it so far. Especially since it's not the typical "beginner" stuff. One question though: What is your intention of the sections where you speed up your coding (especially the part where you add more units and don't explain what you did)? Just curious since parts like this could be left out if we don't get to see what exactly you did there (At least for me it doesn't matter what you did there since for me it's more about the concept and techniques etc Blabla :D)
@CodeMonkeyUnity5 жыл бұрын
My intention with speeding up is simply so the videos don't end up super long. People don't watch 30+ or even 20+ minute videos so in order for the KZbin algorithm to not bury my videos I speed up the parts where all I do is write code. I do normally stop and explain what I did unless its something super basic or something that isn't relevant to the video topic. At 14:10 I speed up making more units which is simply duplicating them and writing the Pathfinding roaming code that I wrote in the previous video.
@SkrekkLich5 жыл бұрын
@@CodeMonkeyUnity Thank you for your reply. I like the speeding up as is. But the part with the units could have been skipped completely imo, since you did not explain anything special afterwards, thats my MINOR critic. As of now I think you are delivering the most useful and polished Unity videos with interesting topics and a good pace. Good to follow along and if I want to try it myself, I can pause the video, since you tend to keep the relevant Code blocks visible :) Keep up the awesome work!
@JaredBrandjes4 жыл бұрын
Great set of tutorials! Very informative. Thanks! I've been following along with a few tweaks here and there to work with my game. I'm seeing spikes in the profiler when calculating particularly lengthy paths and I was wondering if cutting the paths into sets with a max node count would allow a single path to be calculated more efficiently. Basically in 2 parts: 1. Calculate the 'path intention' by limiting the initial path calculation to, say, 20 nodes. Calculated in a single frame. 2. Use the end position of the 'path intention' as the start to then calculate the rest of the path over multiple frames if needed. The rest of the path should be able to calculate without holding up a frame and before the unit gets to node 20. I'm interested to hear your thoughts and how you'd do it. Also, I'm quite unsure how to get a job to complete over multiple frames in this context.
@CodeMonkeyUnity4 жыл бұрын
Yup that is exactly how its done for massive maps, you split it into multiple maps and stitch the final path together. It's a pretty complex topic but that is definitely the way to go. I remember reading a bunch of interesting articles on how they solved that problem for Factorio which has massive maps. I don't think there's a pre-built way of running a job over multiple frames, you need to split it and handle it yourself.
@JaredBrandjes4 жыл бұрын
Code Monkey thanks man. I guess I’ll attempt it. Need to do more research on ECS and particularly dynamic buffers as I think that’s probably the way to go with glueing the parts together. It does take a bit longer to wrap my head around these concepts, coming from an OOP background.
@caxopog5 жыл бұрын
And what is better to chose for making game from scratch - full DOTS or this "combined" method?
@CodeMonkeyUnity5 жыл бұрын
DOTS is still very much in development so the combined approach is best right now. If you go full DOTS you have to make your own systems like Animations, UI, etc
@MGConstantin5 жыл бұрын
Nice video. Keep up the good work. Opinion : older intro was better :D
@Liqvidniy5 жыл бұрын
Hello, thank you for pouring light on dots. 1. Is there a way to use dots collisions with game objects collisions. If not, for performant physics one should choose dots physics on all game objects(via entity companion)? 2. How to handle events in dots? Say entity has an event OnDamageTaken and some other components or entities should subscribe to it and trigger code at the moment than damage was taken? Could it also be done with multithreaded jobs?
@CodeMonkeyUnity5 жыл бұрын
The physics worlds cant mix, so either go full dots physics or full gameobject physics Events are tricky, best approach is probably to just add a.component when the event happens and then handle it. Still need to research the best way if handling events
@johnanthony445 жыл бұрын
What are the Frames/Sec stats for each of the methods? Pure DOTS vs the hybrid approach.
@CodeMonkeyUnity5 жыл бұрын
Rendering is a lot faster in pure DOTS. At most I can get maybe 3,000 of these animated units whereas with DOTS I can get it up to 100,000
@rafalwilczek23013 жыл бұрын
First Thanks u So Much for Sharing this with us. Second u got new patron :) Thinking, how to set Grid is already Occupied when unit stay now here, every step checking if path is still valid & next grid is not occupied by somebody. Thinking how to implement, "Collisions Like", 2 units can't stay/walk on same grid in same time :) somebody must be first
@elyr1um Жыл бұрын
How do I make it so that the job can also check if the node is overlappoing with a tilemap collider? I've tried OverlapPoint but it only works in the main thread, and I don't know how I should access it outside of the 2 for loops
@neozoid70093 жыл бұрын
Hello CM, I am still a beginner in unity I have a Question to ask which is bothering me , Is this type of mix DOTS and GameObjects a Best way to Apply in a Project or Should one go full on DOTS or GameObejct?
@CodeMonkeyUnity2 жыл бұрын
DOTS is still in development so there are no "best" practices yet, this is one approach which may or may not end up being best in the long run
@DanyloSyrotynskyy5 жыл бұрын
Do You have idea how to implement collision detection?
@CodeMonkeyUnity5 жыл бұрын
Sure, DOTS Physics is already pretty advanced kzbin.info/www/bejne/eGS2d4qjbsyegpo
@DanyloSyrotynskyy5 жыл бұрын
i mean to make useful for 10000 units) as navmesh obstacle avoidance works not sure if physics is enough performant (as it is more accurate)
@tfmate-ij5em2 жыл бұрын
asked that already but still, any way to avoid graph initialization for every unit (every job)? Like if its 200x200 +, stored in OOP way, converting every time to NativeArray graph May be use some kind of FindPaths job with n nativelist fields for paths and call it with n sized packs? So at it will at least create one graph for n path calculations
@__Rizzler__ Жыл бұрын
how did you learn all ecs functions and stufff? i find this a bit hard for me to understand
@CodeMonkeyUnity Жыл бұрын
By reading the documentation, it has tons of info docs.unity3d.com/Packages/com.unity.entities@1.0/manual/index.html
@__Rizzler__ Жыл бұрын
@@CodeMonkeyUnity thanks code monkey
@badrballish93284 жыл бұрын
👍👍👍👍👍👍👍
@Truth-Voyager4 жыл бұрын
When I try to build a game using this to my iPhone I get null entities errors. I don’t get these errors in the editor. Any idea why this is happening?
@christopherk45045 жыл бұрын
Can I use Dots in a webgl build? I read that Threading is not supported but how is it with Dots? Do you know anything
@CodeMonkeyUnity5 жыл бұрын
I haven't been following the WebGL features for a while now but I believe the Job System works fine and the only issue right now is with the Burst Compiler. But not sure so make your build for WebGL and test it out.
@Truth-Voyager4 жыл бұрын
When I try to make the grid bigger than 125X125 it wraps on itself. It basically reaches the specified number of rows, I want it to be 250X250, but when it reaches 125 columns the grid wraps back and puts the next column over top of the first column and the next column over the second column and so on. Any idea why this is happening and how to fix it? Update: The wrapping seems to happen any time the number of nodes is greater than 16385.
@ElementalCode5 жыл бұрын
I have noticed that even when you use gameobjects without dots you never use the "Sprite renderer" but you go for a mesh renderer with a 2d image (a quad?) Why is that?
@CodeMonkeyUnity5 жыл бұрын
Just because that's how my animation system works, it works by dynamically modifying a mesh in run time. Everything would work the same with a animation system that is based on the SpriteRenderer
@danieldahl45854 жыл бұрын
Would it be possible to make DOTS do the rendering of a gameobject?
@CodeMonkeyUnity4 жыл бұрын
Sure, DOTS is super useful for rendering tons of objects kzbin.info/www/bejne/qmLJaY2omqioq7M
@puppetlord19085 жыл бұрын
How can one manually update the physics systems like BuildPhysicsWorld, StepPhysicsWorld, and ExportPhysicsWorld? This is needed for some multiplayer architectures (including mine :))
@CodeMonkeyUnity5 жыл бұрын
Hmm you can do it with custom system but not sure with the built-in ones. Maybe you can manually remove it from the world and add it again.
@puppetlord19085 жыл бұрын
@@CodeMonkeyUnity Here is what i did :) This is in monobehaviour sysGroup = world.GetExistingSystem(); public void Simulate(int frames) { sysGroup.Enabled = true; for (int i = 0; i < frames; i++) { sysGroup.Update(); } sysGroup.Enabled = false; } What i did with .Enabled was necessary
@puppetlord19084 жыл бұрын
I found that Convert isn't called instantly when i instantiate the prefab this way. I instantiate the gameobject prefab It's entity is spawned the next frame. How can make the "Convert" work instantly?
@puppetlord19084 жыл бұрын
I think a system calls the Convert() from outside. If so what system is that? I need a name. So i can call it's Update()
@puppetlord19084 жыл бұрын
That was just not necessary and optimal, i ended up instantiating my "companion entities" trough EntityManager
@florinpricopie91125 жыл бұрын
I'm trying to figure out , how to acces wheel collider from ECS , any solution ?
@CodeMonkeyUnity5 жыл бұрын
I don't think DOTS Physics has such a specific collider yet, you can write your own Wheel logic using the Cylinder.
@marymarin35065 жыл бұрын
Привет, смотрю твои видео, очень нравятся, но скажи пожалуйста почему когда я скачиваю материалы из видео, у меня либо миллион ошибок либо просто всё фиолетовое Heeelp please
@tfmate-ij5em2 жыл бұрын
Any way to update it to 1.0?
@CodeMonkeyUnity2 жыл бұрын
The syntax has changed quite a bit so there's no easy way to upgrade, but all the core Data Oriented concepts are the same
@Truth-Voyager5 жыл бұрын
What values do I need to change to increase the size of the grid? Presently the cell sizes are 1x1 I need to up that to 100x100 and still have all of the path finding work. I found where to increase the scale size but the unit continues to move around like the cells are still 1x1. Any ideas?
@CodeMonkeyUnity5 жыл бұрын
The pathfinding returns int2's of the positions to follow, you can then transform those values to whatever you want like multiply them all by 100 to match your world units
@Truth-Voyager5 жыл бұрын
@@CodeMonkeyUnity Which lines are you referring to in particular? This one? path.Add(new int2(endNode.x*150, endNode.y*150));
@Truth-Voyager5 жыл бұрын
Never mind, I figured it out. Thank you for the awesome video!
@aggressivemastery5 жыл бұрын
:O
@lidiadup16485 жыл бұрын
Hello
@sunnyboy73582 жыл бұрын
Unity ECS 0.5 Update removed JobComponentSystem. Your code is broken and dont work. Please have a look at it and fix it. Not very good tuturial material
@CodeMonkeyUnity2 жыл бұрын
Videos on KZbin cannot be updated, look in the changelogs to see what the JobComponentSystem changed to
@traptown56115 жыл бұрын
Code Monkey
@ArnCiS965 жыл бұрын
Hmm, it kinda nonsense why in hell you do copy&pasting instead of adding required components and implemented systems will do rest? Kinda misleading workflow :/
@CodeMonkeyUnity5 жыл бұрын
What do you mean? All the code that I copy pasted was fully made in one of the previous videos so I didn't want to waste time repeating myself over again