Тёмный
No video :(

DOTS Gameplay: Basic Player Input and Movement 

Wilmer Lin GA School
Подписаться 12 тыс.
Просмотров 24 тыс.
50% 1

In this episode, we demo a very simple means of connecting keyboard input to generate player movement. Create Components and Systems to translate and rotate a spaceship in a top-down environment!
TimeStamps:
0:27 Starter Project
0:57 Packages
1:57 Creating the Spaceship SubScene
5:04 DataComponents
5:38 InputData
6:58 MoveData
8:02 Adding Authoring Components in Inspector
9:09 PlayerInputSystem
14:00 PlayerMovementSystem
17:48 FaceDirectionSystem
Starter Project:
github.com/Uni...
Final Project:
github.com/Uni...
Software: Unity 2019.3.9 with HybridRender Version 0.4.2 and Entities Version 0.9.1 from the PackageManager
NOTE: issues have been reported with Unity 2019.3.14f running Windows (seems to be okay on MacOS on that version)
Also check out the previous videos in this series:
Unity DOTS: System Base
• Unity DOTS: System Base
Want to learn more about DOTS and ECS? Sign up for our mailing list to get notified when the premium course releases:
gameacademy.sc...
Want to support this channel? Subscribe to our premium courses at GameAcademy.school:
gameacademy.sc...
Let’s build something cool together!

Опубликовано:

 

26 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 86   
@victrolaface
@victrolaface 4 года назад
Most comprehensive ECS series on RU-vid right now. Really appreciate your effort.
@GameAcademySchool
@GameAcademySchool 4 года назад
Robert Lovelett thanks! Sadly not the most watched series :(
@shakofarhad876
@shakofarhad876 4 года назад
I like how you are going through every step in detail. Thank you for another great video!
@GameAcademySchool
@GameAcademySchool 4 года назад
Glad you liked it!
@andersencastaneda6080
@andersencastaneda6080 2 года назад
Your courses on Udemy and GameAcademy are excellent. I hope you continue updating this channel with more tutorials, a lot of game development student needs your content.
@GameAcademySchool
@GameAcademySchool 2 года назад
Thanks! I haven't had time to record in a while though I've been meaning to get back to it. Had bills to pay :)
@omgawesomeomg
@omgawesomeomg 2 года назад
I think the Translation component in the FaceDirectionSystem is not needed. I don't know if you still make videos, it's been a year since your last one, but I would love more DOTS content, especially since its changing so rapidly. I went through many videos, articles and documentation and your videos are the best thing I've come across regarding DOTS.
@scruffy1234
@scruffy1234 2 года назад
So useful , thanks Wilmer 😊
@CanKarakuzulu
@CanKarakuzulu 4 года назад
Great tutorial. Thank you. And about that ConvertToInt32, if you disassemble System.ConvertToInt32(bool) you'll see that it uses a ternary operator, selecting between 1 and 0. So probably compiler will inline this and that will produce the exact code (:
@GameAcademySchool
@GameAcademySchool 4 года назад
Can Karakuzulu yes, exactly.
@GoodNewsJim
@GoodNewsJim 4 года назад
Thank you. I knew how to use an IComponentData,and Jobcomponent system, but I didn't know how to do a processing script for input. Now I do. Boss video. God bless.
@shirosurfer8864
@shirosurfer8864 4 года назад
Just noticed you have a new dots video super awesome !I'll watch it when im done with work I'm still waiting for the course man and please include physics with taging components man super Salute
@GameAcademySchool
@GameAcademySchool 4 года назад
Yeah Tagging is probably next. Physics needs a lesson unto itself before we start using it.
@zacharym7000
@zacharym7000 4 года назад
Great Vid. I Just wanted to add that if you were to recreate this project in Entities 0.11.0, you can add the range attribute to the movementData.turnSpeed variable within the MovementData Component. I've not tried this in other versions, but I know it works with here.
@GameAcademySchool
@GameAcademySchool 4 года назад
Thanks for the info!
@envilonscript
@envilonscript 3 года назад
Hi, would you consider making a video about how to do this using the new unity input system?
@gregs_on_tracks
@gregs_on_tracks 4 года назад
Unity should be paying you for those tutorials.
@GameAcademySchool
@GameAcademySchool 4 года назад
Gregor Heinze Heh. Probably.
@DeathxStrike18
@DeathxStrike18 4 года назад
what if you want mouse position data? for InputData?
@anonymoussloth6687
@anonymoussloth6687 3 года назад
plz do a video that uses this with the new input system
@Dream_Wood
@Dream_Wood 4 года назад
How to control cameras and IU in DOTS?
@envilonscript
@envilonscript 3 года назад
That is tricky right now. As far as I know, there is no supported way to do this and you have to make a workaround. I think you should be able to create an entity that you would control instead of the camera and have a monobehavior script that would apply the translation of the entity to the camera.
@ThienHaFlash
@ThienHaFlash 3 года назад
Wonderful tutorial!
@xontik
@xontik 4 года назад
how the fuck you have so little subs and views ? Best ESC/DOTS series here !
@animalfun7794
@animalfun7794 4 года назад
Thank you!
@saito853
@saito853 3 года назад
For the inputs wouldn't it be easier if you just make them all int (instead of bool) then cast in the direction.x = right - left, direction.z = up - down ?
@nanami-dl7eh
@nanami-dl7eh 4 года назад
I have 2 question 1.is it possible for put canvas in subscene and write a system to control everything? Just like(entity.foreach((ref image, ref someDataForfill_UI_Image)=> {}).Run(); And whem eventsystem selected,it will fill the UI image, Or also do more things , if it's possible to using this to control whole game UI? 2.entity.foreach can just foreach some part of entity instead of each entity? Or maybe That Won't make a big problem, then just forget it
@LukeAps
@LukeAps 3 года назад
I am so upset that other people's tutorials show up when searching, instead of yours.
@michalrivola5676
@michalrivola5676 3 года назад
So I tried this in unity 2020.2 and its not working. The spaceship in subscene Translation is not updating at all + dissappear from game, but if I add another spaceship in current scene ( not subscene) Translation is updating in entity but not moving in game. Any solution?
@michalrivola5676
@michalrivola5676 3 года назад
Okey, problem was in using URP, so either change your materials to Lit( or something like that) or enable Hybrid renderer V2, Project setting < Player < Scripiting define symbols < Add ENABLE_HYBRID_RENDERER_V2
@prakyathd5018
@prakyathd5018 3 года назад
How to print message to console when using Unity Tiny?
@muuubiee
@muuubiee 3 года назад
Drag and drop doesn't work, because it says it can't find the file I just dragged and dropped... I guess I'll just have to go through this without any follow a long... a bit of a bummer, but it's still educational.
@nswell1074
@nswell1074 4 года назад
Thank u for your sharing! I love your channel. could u tell me how to play the animation in the ECS
@GameAcademySchool
@GameAcademySchool 4 года назад
Animation is still work in progress. You can do it currently but controlling an animation controller/graph is, uh, not fun. I think it's best to wait for this part of DOTS to get fleshed out a little more. I suspect it will get much easier in the future.
@Hairclone
@Hairclone 3 года назад
The values for the moveData is not updating for me in the debugger. However, everything seems to work. Have I messed up a setting? For debugging purposes, it would be nice to see the values actually change... Im using Unity 2019.4.15f1
@Hairclone
@Hairclone 3 года назад
For those of you who are as stupid as me: The root cause was that my gameview was deselected when i was fiddeling in the entity debugger, so I just had to click anywhere in the game view to start moving again and see the values being updated
@arthurdsjrjbr
@arthurdsjrjbr 4 года назад
Thank You! You Have Helped Me a Lot! But I do have a question: How do I apply It on an FPS game? I mean you are changing the object velocity relative to the World Axis, how do I make It so It uses the Local object axis (Z front of the object, X sides, etc)?
@spikeliu6476
@spikeliu6476 4 года назад
Awesome tutorial! Could you please teach how new input system works with ECS, I couldn't find anything online that teaches that. Thanks!
@GameAcademySchool
@GameAcademySchool 4 года назад
Spike Liu it has nothing to do with ECS per se. it’s just a different, more flexible way of defining input. Unity already has a nice video on how it works
@spikeliu6476
@spikeliu6476 4 года назад
@@GameAcademySchool Thanks for the reply, finally got it working... Looking forward to your new course! I enjoyed your other courses on udemy, your way of teaching, especially when you use a graph while explaining works great.
@CalicoArchives
@CalicoArchives 3 года назад
What's the difference (pros and cons?) between ConvertToEntity and using SubScenes? When should I use which?
@GameAcademySchool
@GameAcademySchool 3 года назад
Use SubScenes. ConventToEntity is on the way out.
@CalicoArchives
@CalicoArchives 3 года назад
@@GameAcademySchool Thank you!
@Ankhtepot
@Ankhtepot 3 года назад
Hi. I'm running into the thing, that even with the finished project from your git, after installing versions of Entities and Hybrid renderer from this video, when I press play, the ship is not seen anywhere. With a ticked checkbox next to subscene in Hierarchy, I can see the ship, but after entering Play mode, it seen only in Scene, but not in the Game window. I'm using Unity 2020.2.1f1.
@Ankhtepot
@Ankhtepot 3 года назад
I could fix this in 2020 with allowing Hybrid Renderer V2 as described in this document: docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/index.html
@mujina93
@mujina93 2 года назад
@@Ankhtepot Another link that people might find useful, with the installation instructions to pass from Hybrid Renderer V1 (used in this project, older, no longer maintained) to Hybrid Renderer V2 (more recent and actively developed): docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/creating-a-new-hybrid-renderer-project.html#hybrid-renderer-v1
@croonymoons
@croonymoons 3 года назад
Hi Wilmer, I've been enjoying these tutorials. I'm following along and building my own project with the skills you're demonstrating. I'm trying to spawn entities with player input using the component system setup. I have an input data component and input system that both work in the entity debugger, but I'm struggling to see how to connect these concepts with the entity spawning concepts in your intro to ECS videos. Since the Spawner uses Monobehaviour to call the InstatiateEntity method, is that method not accessible through the SpawningSystem I built using SystemBase? Can the "SpawningSystem : SystemBase" send data to the "Spawner : Monobehaviour" to call a method? Like if upKey is pressed, spawn entity. I would think the spawn system handles the logic and calls the method by referencing the Spawner, but that doesn't seem to work. Do you know any resources that can help me understand this issue?
@GameAcademySchool
@GameAcademySchool 3 года назад
Correct. You won't be able to access the ECS/DOTS Systems from anything in the "classic" Monobehaviour world of Unity. The easiest way to "bridge" the two currently is make some public static methods on your Monobehaviour. These would be accessible by both ECS and classic. So use the static methods from within ECS and then respond from the Monobehaviour or vice versa.
@joaohudsonlacerdaoliveira5253
@joaohudsonlacerdaoliveira5253 3 года назад
One question, if I remember correctly, each component is stored in a different array, if this is true and we have many objects, wouldn't iterating through entities accessing various components increase the cache miss?
@muuubiee
@muuubiee 3 года назад
I had that thought as well, however, that does not seem to be the case. Component data is stored linearly, so MoveComponent - GlowComponent - ScoreComponent are all placed after each other, and then the next Entity starts with it's own components. So, whenever you're looping through all entities you'll prefetch the next entities in the array, and therefore have insane read speed and more or less completely avoid cache misses. I'm not sure why this doesn't happen in OOP as well... From reading a little, it seems like it is because OOP uses references, and pointers a lot, which scatters the data around. And of course, if data isn't linearly structured prefetching doesn't work. Here's some stuff about ECS software.intel.com/content/www/us/en/develop/articles/get-started-with-the-unity-entity-component-system-ecs-c-sharp-job-system-and-burst-compiler.html I believe struct of arrays is OOP with data oriented design... I don't think it'd really lead to cache misses, many arrays will fit in the cache.
@CalicoArchives
@CalicoArchives 3 года назад
Thanks for the well explained tutorial. How can you do mouse clicks on entities and UI using DOTS?
@GameAcademySchool
@GameAcademySchool 3 года назад
You don't necessarily need to use DOTS for UI work. You can use the existing "classic" system. Otherwise, you'll need to build your own UI System (which can be done but is more work obviously).
@CalicoArchives
@CalicoArchives 3 года назад
Ah, I see. Thank you!
@MusicaPaLarumba
@MusicaPaLarumba 4 года назад
Thanks for this great video. For your player input if the point of DOTS is performance, is not better if you do this? byte a = 1, b = 0; moveData.direction.x = (isRightKeyPressed) ? a : b; moveData.direction.x -= (isLefttKeyPressed) ? a : b; moveData.direction.z = (isUpKeyPressed) ? a : b; moveData.direction.z -= (isDownKeyPressed) ? a : b;
@GameAcademySchool
@GameAcademySchool 4 года назад
Leo Salas The ternary operator works out to be the same as Convert.ToInt32
@MusicaPaLarumba
@MusicaPaLarumba 4 года назад
@@GameAcademySchool yes but im using a byte instead of int32, 8 bits is less than 32 bits
@GameAcademySchool
@GameAcademySchool 4 года назад
Leo Salas ok fine but the savings here is minuscule. Since you don’t have a lot of player inputs and this runs on the MainThread not sure how much savings you expect. For me I will let it go in exchange for readability
@hasan7786
@hasan7786 4 года назад
Still getting the hang of C#, then..... dun dun diiiiin! This.
@anonymoussloth6687
@anonymoussloth6687 3 года назад
Can you do a video with making a game that uses ecs, jobs and burst all together?
@GameAcademySchool
@GameAcademySchool 3 года назад
I put all DOTS videos on hold. It has been pushed off the immediate roadmap for Unity 2021, so waiting for it to mature a bit more
@cradle_of_chaos
@cradle_of_chaos 3 года назад
@@GameAcademySchool Do you think it means that none of the DOTS packages will get to verified status in Unity 2021?
@GameAcademySchool
@GameAcademySchool 3 года назад
@@cradle_of_chaos I dunno. I mean the core functionality of the packages is there. You can use the ECS, C# Jobs and Burst compiler just fine. They work really fast -- but they don't play nice with some features of the engine. If you have the manpower and know-how, that's enough. You can probably write what you don't have now. But if you're a solo dev, I would, uh, wait.
@raildex686
@raildex686 4 года назад
Hey, Nice tutorial, but theres still a question which doesnt really fit into the ECS videos. How did you manage to install a RenderPipeline and ECS/Hybrid Renderer at the same time? I tried so many versions an different approaches but it just keeps crashing when i convert gameobjects with RenderPipeline materials into entities Can you pls tell me what you did there?
@GameAcademySchool
@GameAcademySchool 4 года назад
Rail Dex I didn’t do anything special at all. However, not all version numbers work with each other. Use the Package Manager to resolve version conflicts
@anonymoussloth6687
@anonymoussloth6687 3 года назад
is there a reason why you used subscene instead of convert to entity (just for my knowledge)?
@GameAcademySchool
@GameAcademySchool 3 года назад
Subscene is the preferred workflow. ConvertToEntity is eventually going away apparently
@anonymoussloth6687
@anonymoussloth6687 3 года назад
@@GameAcademySchool so subscene basically converts all of its children into entities automatically?
@muuubiee
@muuubiee 3 года назад
@@GameAcademySchool Doesn't that makes it much harder to procedurally generate stuff? How do you reference stuff in a subscene to build something? Like the cube example before. If you put a single cube into a subscene, how would you then increase it by however many you want?
@Liqvidniy
@Liqvidniy 4 года назад
What kind of weired behaviurs we can get if we use just Normalize or LookRotation instead of save variants? I feel like methods without save suffix should be safe by default and those that are unsafe should be suffixed with unsafe word.
@GameAcademySchool
@GameAcademySchool 4 года назад
You can't normalize a float3.zero (e.g. when you aren't holding the keys down). If you put an extra check if (!moveData.direction.Equals(float3.zero)) you can use regular normalize. The screen will blank out and won't show the player if you get a NaN error.
@shirosurfer8864
@shirosurfer8864 4 года назад
When is the course coming out man?
@GameAcademySchool
@GameAcademySchool 4 года назад
Sorry, I've had some obligations to attend to (work) and haven't had much time to record. It's been delayed, probably closer to end of summer. it may be all for the best, since Unity Physics continues to evolve. I suspect the DOTS core package has mostly settled down by now... but you never know...
@kelsosharp2170
@kelsosharp2170 4 года назад
Using Unity 2019.3.14f1 When using the play button always locks down Unity and you have to use task manager to close Unity. I have added none of my own code, just followed the tutorial, the only change is the version of Unity itself. It also locks Unity down in random ways, and it seems like it is the sub-scene that is causing the issue.
@GameAcademySchool
@GameAcademySchool 4 года назад
I was able to download the final project from GitHub and upgrade Unity to 2019.3.14f1 safely. It seems to function okay.
@GameAcademySchool
@GameAcademySchool 4 года назад
Kelso Sharp are you using the same package versions or something else?
@kelsosharp2170
@kelsosharp2170 4 года назад
Game Academy.school everything is the same, only used the starter project from github not the completed one.
@GameAcademySchool
@GameAcademySchool 4 года назад
@@kelsosharp2170 Does the final project hang on your machine? The Starter version is the same repo so not sure why it would cause Unity to hang.
@kelsosharp2170
@kelsosharp2170 4 года назад
@@GameAcademySchool I downloaded the complete project unzipped it and loaded it as a unity project, I changed nothing, I can run the subscene solo, but if I run the playerinput scene it locks up
@Lythowastaken
@Lythowastaken 4 года назад
If I would use the new Dots Physics I would use the PhysicsVelocity instead of Translation? Dots is adding so much stuff im confused ._.
@GameAcademySchool
@GameAcademySchool 4 года назад
Yes, if you wanted a Physics-based controller.
@Lythowastaken
@Lythowastaken 4 года назад
@@GameAcademySchool Thanks! Yeah I want to play a little bit around with 3D :D My sub is yours
@TrigenStuff
@TrigenStuff 4 года назад
im watching from the future and i have to say no it did not 1:20
@GameAcademySchool
@GameAcademySchool 4 года назад
Trigen Moon glad to know, it’s still fresh :)
Далее
DOTS GamePlay: Tags
19:09
Просмотров 10 тыс.
Unity DOTS: C# Job System
19:47
Просмотров 20 тыс.
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
DOTS Gameplay: Trigger Events
25:02
Просмотров 12 тыс.
Unity DOTS: Components And Systems
18:50
Просмотров 16 тыс.
Unity DOTS: Creating an Entity
15:59
Просмотров 49 тыс.
Unity DOTS: System Base
12:47
Просмотров 15 тыс.
Unity Job System - A Practical Code Example
13:50
Просмотров 81 тыс.
The AMA Club Model is Failing. Here's Why.
16:10
Просмотров 43 тыс.
An Aseprite Crash Course In 30 Minutes
31:47
Просмотров 1,1 млн
How Games Have Worked for 30 Years to Do Less Work
23:40