It took me 3 days to finish this. The best part is the colossal amount of repetition. In many tutorials, this would be bad, but the repetition here really cements the workflow into your brain.
10:30 i think the bottleneck there was mapsize, as once the space is filled up, there is no avoidance space left which should result in calculation loops when using local avoidance.
I have a similar issue, except it only freezes when in VR using oculus air link. I can't remember exactly what I did that made this happen. The issue doesn't occur if I run the same scene without a VR headset connected. I can still use the editor freely while in play mode in VR, however, the entire editor freezes when I try to exit play mode.
It would be amazing if you were platform agnostic. Unreal Engine has an ECS engine, and maybe, with enough support, Godot could start implementing one.
Hey! Since Unity 6 Preview just came out, one thing I am confused about is whether this tutorial will work in Unity 6. Are the Entities packages bug-free for the new editor version or do we need to stick to LTS? There are so many changes to ECS over the years that it's hard for me to keep up...
im don't think able to do that the game im work now is multiple fps game and the target audience i is people that like old multiple shooter like quake, half life ,unreal tournament ect i have 0 idea what name convention thos game use yes for sure i know those games have name's however thos game don't have name like escape phobia ect. and as game general the are just Multiplayer fps game, it's that some people call quake , unreal tournament, arena shutters. however my game is not quake clone yes the are inspired for games like ,half life ect but the have the own unique spine and i have multiple many mekanins that is more common in new shooter's.
Can we plz get #region/#endregion bug fixed for DOTS/Burst/Jobs? I use it to collapse ugly using directive, precompiler and IDE stuff at the top of files or organize anything that's got parts best read in sections (i.e., file with lots of small definitions). But it breaks compilation ... seems it messes up something in code gen and theres a mismatch from #region and #endregion.
@@danielkandersen6599 I removed #regions from my whole Unity package but I will try to recreate the problem for ya. It's possible it got fixed in the meantime but I never heard mention of it. So I will let ya know what happens. But from what I remember it seemed like it would break from simply having #region <using directives here> #endregion and then try to write an IAspect or IJobEntity, possibly worse if you have multiple definitions in a .cs file.
You can assign functions in an array of weapons, for example I could attach Fire() to weapon[0] and then call weapon[0] as a function to fire whatever "weapon" you assigned to it.
Thank you for providing this fantastic tutorial free for all. I have been following this video step by step and learned more than I expected. Awesome work! As nothing is bug free, I found a few in this project.
Two bugs were found with your FinalProject. 1st: When I set the minPlayersToStart to 2, the game will start correctly once the 2nd player joins. However, the 3rd player will be frozen with the game start UI "Waiting for -1 more to join...". And the TeamPlayerCounter component for all clients has 0 for both BlueTeamPlayer and the RedTeamPlayer. (But the 3rd player won't have this problem if he joins before GameStartTick) 2nd: Only happens if the host is a build not the editor. If there are more than one player. The host's abilities UI for Q and W will not be on cooldown correctly. Also, the host's abilities cooldown UI will be on cooldown if the 2nd or 3rd player casts a spell. This only affects the UIs, the internal cooldown is correct for the host or clients. Another bug is, the "var skillShotAbility = ecb.Instantiate(skillShot.AbilityPrefab);" will be excuted on both the client and the host if the client casted a SkillShot. Similiar with the 2nd issue.
Solution for the 1st bug: In the "ServerProcessGameEntryRequestSystem", change "if (playerRemainingToStart <= 0 && !SystemAPI.HasSingleton<GamePlayingTag>()){ }" to "if (playerRemainingToStart <= 0) { if (!SystemAPI.HasSingleton<GamePlayingTag>()) { // If enough players joined and the game hasnt started before. var simulationTickRate = NetCodeConfig.Global.ClientServerTickRate.SimulationTickRate; var tickUntilStart = (uint)(simulationTickRate * gameStartProperties.CountdownTime); var gameStartTick = SystemAPI.GetSingleton<NetworkTime>().ServerTick; gameStartTick.Add(tickUntilStart); ecb.AddComponent(gameStartRpc, new GameStartTickRpc { NetworkTick = gameStartTick }); var gameStartEntity = ecb.CreateEntity(); ecb.AddComponent(gameStartEntity, new GameStartTick { NetworkTick = gameStartTick }); } else { // The client joined after game started. ecb.AddComponent(gameStartRpc, new ClientJoinedAfterGameStartedRpc { }); } }" . Add "public struct ClientJoinedAfterGameStartedRpc : IRpcCommand { }" somewhere. In the "CountdownToStartGameSystem", add the if statement like "if (!SystemAPI.HasSingleton<GamePlayingTag>()) { var gamePlayingEntity = ecb.CreateEntity(); ecb.SetName(gamePlayingEntity, "GamePlayingEntity"); ecb.AddComponent(gamePlayingEntity, new GamePlayingTag()); } ecb.DestroyEntity(entity); OnCountdownEnd?.Invoke();". Otherwise, there will be more than one GamePlayingTag if a new client joins the game while on countdown. Also, add "foreach(var (clientTag, entity) in SystemAPI.Query<ClientJoinedAfterGameStartedRpc>().WithAll<Simulate>().WithEntityAccess()) { var gamePlayingEntity = ecb.CreateEntity(); ecb.SetName(gamePlayingEntity, "GamePlayingEntity"); ecb.AddComponent(gamePlayingEntity, new GamePlayingTag()); ecb.DestroyEntity(entity); OnCountdownEnd?.Invoke(); }" just after the exsiting foreach loop. The last thing is add "_beginGamePanel.SetActive(false);" inside "GameStartUIController.EndCountdown()" because we skipped the countdown.
Solution for the 2nd bug: In "AbilityCooldownUISystem.OnUpdate()", add "WithAll<GhostOwnerIsLocal>()" at the end of the first foreach query. Solution for the 3rd bug: In "BeginSkillShotSystem.OnUpdate()", find the 2nd foreach loop which instantiate the skillShot entity. Add "GhostOwnerIsLocal" inside the "WithAll<>".
So for anyone trying to do this in later versions (0.5,1.0 ...) the archetype needs another type PhysicsWorldIndex, yeah I know johnny commented the same thing, but just gonna comment this again since I just wasted 12 hours trying to understand why no triggerevents are not being processesd by the job
Excellent Vid! Easy to understand for the somewhat hard of hearing. Question: It sounds like ECS would be ideal for larger, open world, multiplayer games...would I be correct in assuming this?
Thank you so much! ECS certainly benefits the game types you discussed, but that is far from an exhaustive list. ECS can also work very well for smaller games with dynamic entity structures
Amazing work here! Thank you very much for this very complete course, I learned a lot :) By the way, I can confirm that it still works fine with Unity 6000.0.4f1 using Entities 1.2.3. Oh and also, I had to add a "state.RequireForUpdate<MobaPrefabs>()" in the "ClientRequestGameEntrySystem" to make it work properly on a client build, otherwise the subscene NetCode prefabs may not be loaded in time when the client receives the spawning data from the server, resulting in a NetCode error followed by a disconnect (apparently streaming the sub-scene can take longer than it takes for the systems to start running).
"add a "state.RequireForUpdate<MobaPrefabs>()" in the "ClientRequestGameEntrySystem" " saved me. This issue didn't bother me till I started testing the MaxPlayersPerTeam. It's like the player has been connected and counted as a +1 for the selected team, then disconnected for a reason (I dont know the reason exactly).
Any thoughts on how you would need to implement the thin clients to use the aoe ability when they hit that timer? I've been trying something in a project of mine that has a similar setup but it's not working. I'm setting an InputEvent in my IInputComponentData GhostField, but when I inspect the Input Buffer Data on the entity in the inspector it has a size of 0. I'm guessing that Thin clients can't use InputData components?
Make sure in the ThinClientEntrySystem you are adding an AbilityInput component and an InputBufferData<AbilityInput>> buffer to the thinClientDummy. That *should* be all that is required for thin client ability input. Hope this helps get it working!
@@TurboMakesGames I had those, turns out in my ThinClientInputSystem if I don't create a new AbilityInput component before the input timer expires, the next frame the inputevent was still "Set", oddly though this would mean that every frame "WasPressedThisFrame" was true, but yet when inspecting the InputBuffer in the inspector it was not and my system that queries the InputData was not seeing it. The aspect that returned ShouldAttack was always true as well which was confusing. Anyways, figured it out, thanks for the help.
The blob asset thing is great! First time hearing about it. It's like a little puzzle piece in the data oriented thing. The idea of having it serialized makes it even better. This simplifies a bit of the architecture conceptualization which is something I'm struggling with figuring out. This is nice because it basically says "figure out the things everything uses or many things use frequently". Love it. Great video. Also, thank you Turbo for pointing out the unity sale. There's a bunch of awesome things available. I mean, my bank account is cursing both of us out, but *I* appreciate it. 😂
MoveInput is an IComponentData - check out this video to see how I setup input in Unity ECS - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-bFHvgqLUDbE.html
I've been delving into SourceGenerators in Unity for a while now, and I'm glad to stumble upon this video. It's just a pity it didn't come out a couple of months earlier; it would have been a great starting point. Despite having scoured a lot of information on my own (by some miracle), there were plenty of intersting insights in this video that I hadn't come across. For anyone just diving into Source Generator, I recommend checking out my Unity solution as well. It might not be perfect, but I believe it could offer some valuable insights: github.com/VPDPersonal/UnityFastTools
Might have been discussed in the project already, but does this cover the idea of spinning up game instances to handle more than 10 players in a queue waiting to play. Say I have 1000 people wanting to play, but we need to spin up instances of the game server to handle multiple instances of the server running? If not, how would we go about tackling that using Unity Netcode and the Multiplayer services provided by Unity.
This video does not cover that. Something like that is more along the lines of integrating with other services such as Unity Lobby to manage all this. With these UGS services, once a match is found and players are connected, they all communicate the same way show in this tutorial. There are some other good tutorials regarding these services if you poke around a bit. Hope that helps get you going in the right direction!
@@TurboMakesGames I've gotta particularly insightful tutorial on relay and lobby from Hugos multiplayer Kitchen Chaos game .... however, Im having difficulties understanding how I can use a Lobby/Relay, spin up a server, and then still have the code in your full demo (snapshots, server reconciliation, rollback etc) work. Is this possible?
"Actually I guess technically, the worst case scenario would be that your entities do not fit in chunks at all ... uhm which means that you probably have some bigger problems on your hands ... hu hu hu" ..... Classic :D
Really love your ECS videos Johnny. Clear, concise, practical examples, and a little nerd humour .... love it man. Keep up the great work brother. We appreciate you man.
For anyone else going through this in 2024 or later, I STRONGLY recommend looking up the Input System Package when you get to the part dealing with controls. My left stick worked fine as shown in the video, but my right stick was all jacked up, and it took a lot of troubleshooting to find out that the built-in input manager has the axes numbered differently depending on if you're using an Xbox controller vs a Dualshock vs whatever else. The Input System Package takes care of all that for you, so you don't have to hunt down button/axis mappings for every controller you want to support, you just say "gameplay > movement > up is left joystick up" and the system knows how to read that input from a BUNCH of different gamepad types. I'm only about 2/3rds through the tutorial, but the only other issue I've noticed so far is that the Text UI Asset is considered legacy now, replaced with TextMesh Pro. It's very similar and actually includes the ability to outline the text without having to add an outline component, but when using it in your code you need to use TMP_Text instead of just Text as the type. Accessing the text is done identically in a TMP_Text object as in the Text shown in the video.
lol, I just found out that what I thought was built-in outlines on TMP Text was actually modifying the font, so changing it on one text object changes it for all of them. Okay, outline components are back on the menu.
They did. When they did official livestreams about DOTS and Dani was there, they gave the series a shout-out. At least once (I didn't watch the others for the same reason I don't really watch these anymore... )
This is exaktly what I need right now :D Had been trying to solve smth with generic typing but I still needed to create a file for every Type i want it to support... This is huge!. Thank you for showing it off and unscarryficating source generation for me!