No video

Command Pattern - Game Programming Patterns in Unity & C#

  Рет қаралды 51,556

Jason Weimann

Jason Weimann

Күн бұрын

Check out the Course: bit.ly/3i7lLtH
-------
I'm doing a full series based on the book 'game programming patterns'. It's full of a lot of great gems including the command pattern. In this video I go over a few use cases and sample implementations of the command pattern in a Unity project and show some of the benefits (like the ability to undo/rewind time)
Inspired by Robert's great book on Game Programming Patterns - amzn.to/2Ohg01Z
More Info: unity3d.college
Join the group: unity3d.group
Patreon: / unity3dcollege

Пікірлер: 60
@danielrousseau6541
@danielrousseau6541 6 жыл бұрын
The best unity channel by far.
@merlynguevara2612
@merlynguevara2612 4 жыл бұрын
He's an anomaly, a great programmer that uses light mode. protect him at all costs.
@mana20
@mana20 6 жыл бұрын
Glad to see design patterns in the context of Unity
@NaughtyDuck
@NaughtyDuck 6 жыл бұрын
THIS! This channel deserve more, way more subscribers
@CamoflaugeDinosaue
@CamoflaugeDinosaue 5 жыл бұрын
Your videos are really excellent. Might not get as many views as some channels because the topics aren't as flashy or gimmicky, but they really do fill in the kinds of things that a REAL game designer needs to know.
@IDontReadReplies42069
@IDontReadReplies42069 Жыл бұрын
i'd say command pattern is YAGNI for like 99% of situations
@phobos2077_
@phobos2077_ 5 жыл бұрын
You should consider improving the sound quality. Content is top notch but the horrendous mic sound bogs it down.
@Unity3dCollege
@Unity3dCollege 5 жыл бұрын
Definitely, working on this now. thx :)
@rafa_guitar
@rafa_guitar 6 жыл бұрын
Always visiting Jason channel for useful information!
@GettingRektGaming
@GettingRektGaming 6 жыл бұрын
I look forward to this series! I find commands to be really useful for splitting the "visual" (delayed) actions from the "logic" (computer usually knows if you have died before the animation is playing). You did touch on this in the "turn based" talk. I would love a series where you create a single minimal game with all of your structures and tips in place. Since it is when using multiple systems your setup really shines, avoiding the technical debt. Anyways, great video!
@pranavkushwaha6016
@pranavkushwaha6016 4 жыл бұрын
Top-notch content, thanks for creating such a great series. It would be great if you could create some abstract class diagram to understand the communications between classes and interface better thanks a lot.
@dany19991
@dany19991 6 жыл бұрын
liked before the video started :) . not disappointed. this will be a good series to watch . it was a bit on the fast side , and the sound quality is kind of low , otherwise it was perfect .
@ZoroastrianMK
@ZoroastrianMK 5 жыл бұрын
As a Junior developer, I'm looking forward to learn about of all the patterns that can be used out there. It would be really interesting to see, for example, a project built around Scriptable Objects to create systems (I didn't fully get the " Overthrowing the MonoBehaviour Tyranny" in Unite, despite looking very interesting), and making good Singletone Patterns (I discovered what they where when working in my first company and put me to work in a project full of null references of singletones, now I see them everywhere and I can't get out of my head that nagging feeling that something is going to crash at some point). Thank you for all your work, people like you make us, the rookies, learn how to do things the proper way.
@Unity3dCollege
@Unity3dCollege 5 жыл бұрын
You're in luck (kinda)... :) The next video goes into scriptable objects in a pattern I use all the time. SHould hit today or tomorrow :)
@karim009
@karim009 5 жыл бұрын
Thank you again for your unique contents. This topic is so underestimeted, especially from beginners.
@popuzin
@popuzin 6 жыл бұрын
finaly, you start it! fantastic )) many thanks
@cetiah
@cetiah 5 жыл бұрын
I enjoyed this video - especially the tips at the end.
@SunnyApples
@SunnyApples 5 жыл бұрын
Thank you very much Jason for the tutorial!
@popuzin
@popuzin 4 жыл бұрын
Cool video :) Watched it second time just to refresh my memory of your example. You mention about some more deep example if we ask about it. So maybe time came to make video with more advanced implementation of this pattern, what do you think?
@b4Vibe
@b4Vibe 6 жыл бұрын
Looking forward for more examples ! And please, if you have a microphone try to record with mic, it may increase the quality of you voice.
@Unity3dCollege
@Unity3dCollege 6 жыл бұрын
Sorry about that, gonna figure out what's going on, think it's something w/ the noise reduction that messed it up.
@Sashi70
@Sashi70 5 жыл бұрын
Referred to your other video, in which you explained the differences between array, Lists, stack and so on, I would suggest to use a Stack for the CommandProcessor
@jeangodecoster
@jeangodecoster 5 жыл бұрын
Hey Jason, pretty cool video. However I'm a bit bothered by the way you implement the MoveFromTo part. It feels wrong to have such a specific method in such an unspecific thing as a IEntity Interface. What it means to "move from to" should be entirely implemented inside the Command, and not inside the entity. I understand though why you did it this way: you don't have access to "startCoroutine" and "stopCoroutine" from within the context of your Command class (because it's not a monobehaviour). However this could be worked around very simply by using a singleton monobehaviour and do something like MySingletonMB.instance.StartCoroutine(MoveFromToCoroutine(from, to)); Probably a bit advanced for the target audience, but I'm sure you will appreciate the beauty of this ;-)
@tinabPixel
@tinabPixel 4 жыл бұрын
Thanks, Jason, your tutorials are always great and helpful for me. Correct me if i am wrong I think the "Redo" method in the command processor will not work as it supposes to be since we already removed refrence to command we have pefromed "Undo" on it.
@Layarion
@Layarion 3 жыл бұрын
Honestly wished you used something with a less aggressive noise gate. makes you a tad harder to understand. or just get rid of the noise gate all-together and let the room tone in.
@TheMateyl
@TheMateyl 5 жыл бұрын
You look exactly like Dan Harmon. Also, great channel.
@jasonargo4459
@jasonargo4459 4 жыл бұрын
Great video, thanks. Just for my own clarification, the object we are storing is the Vector3 direction, yes?
@popuzin
@popuzin 5 жыл бұрын
more examples would be great =) also, in your old style, as a small article on your site
@feritinferrt9388
@feritinferrt9388 5 жыл бұрын
thank you very much for your videos
@STARasGAMES
@STARasGAMES 5 жыл бұрын
Hi! I found your great channel! You are super cool! I really like your examples, that shows things in the most simple way. Noticed, that you overviewed a lot of features from new versions of Unity, but I think you missed a huge topic: Assembly Definitions. I tried them in my project, They works fine with my code. But what to do with plugins? Third party code? The problem is that if I using assembly definition files in project, then all code from 'Editor' folders would be in build. And now I must go through all 'Editor' folders, create .asmdef files and then reference all dependencies... It's annoying! Does anyone know tricks to avoid such thing?
@samueldeodato5270
@samueldeodato5270 6 жыл бұрын
I bought this book few days ago
@endihidir2087
@endihidir2087 4 жыл бұрын
For me, only confusing thing is that In the first example, we don't need to original position of the player but In the second example we need it for Undo. Why?
@JohnDoe-bo5yk
@JohnDoe-bo5yk 2 жыл бұрын
Any chance you could show a simple yet scaleable turn based battle system? I'm working on one and it's working but I feel like I'm making it much more difficult than it should be
@waynegamedev6202
@waynegamedev6202 2 жыл бұрын
Where can we download the scripts from this video?
@jonathansaindon788
@jonathansaindon788 4 жыл бұрын
How would you go about implementing this pattern for a card game where the UI is event driven (for decoupling) and the actions are animated. For example, you discard a card with the DiscardCommand and the ui animates the discard. This command should not complete as long as the animation is running, but it is event driver so... Is it possible?
@jarekshark1356
@jarekshark1356 2 жыл бұрын
thx
@themaskyyt
@themaskyyt 3 жыл бұрын
Hey Jason! Does the book still holds up for nowadays? I'm genuinely curious about it
@Unity3dCollege
@Unity3dCollege 3 жыл бұрын
Definitely
@themaskyyt
@themaskyyt 3 жыл бұрын
@@Unity3dCollege Thanks!
@JoshyHJoshy
@JoshyHJoshy 4 жыл бұрын
Could we possibly get the scripts used in this tutorial please?
@adkinsy85
@adkinsy85 5 жыл бұрын
Is this like packages like in in java where we can call one package in another package?
@R.Chessman
@R.Chessman 5 жыл бұрын
I don't really understand how the magic behing the Transform property works in IEntity. For me, it seems like that transform merge with the transform of Monobehavior and any call to transform.position will modify the position of the gameobject in the scene? How do you explain that?
@Bloodthirst
@Bloodthirst 5 жыл бұрын
its basically something like this : public interface IEntity { Transform EntityTransform { get; } } public class SomeMonoBehaviour : IEntity { public Transform EntityTransform => gameObject.transform; }
@sineadzara8458
@sineadzara8458 5 жыл бұрын
Could this work with mouse drags to move a gameObject towards mouse?
@gazoonman
@gazoonman 4 жыл бұрын
I have no idea, what do we need IEntity interface in the first place when we can achieve the same thing to depend on ClickToMoveEntity or Entity???
@IDontReadReplies42069
@IDontReadReplies42069 3 жыл бұрын
For separating your data layer from your behavior layer or implementation. That's all these patterns are doing, cleaning up your code so that it's more organized and easier to add things to it. You can do virtually anything with just a series of if statements on one script. I mean, how did people get things done before object oriented programming?
@nitroflight
@nitroflight 4 жыл бұрын
Can you show how to do the reverse animation for undo?
@daft990
@daft990 4 жыл бұрын
When you start watching and the Wikipedia page you have open features the castle from my home town... :-o
@matw2418
@matw2418 5 жыл бұрын
Source code ?
@DixeyDo
@DixeyDo 5 жыл бұрын
I have a question If i become a programer i will be abe to design games ?
@flyer2707
@flyer2707 3 жыл бұрын
I'm really a fan of you Jason! Great tutorials! However, I do have a bit of feedback. I believe that you don't have to explain everything you have coded (in this case: how you collect input), because that's not what this tutorial is about and that's basic stuff. If people would want to learn that they would search a specific tutorial for that. ;)
@EqualToBen
@EqualToBen 5 жыл бұрын
Hahahaha I just read this and was considering making a video- damn it man
@yayingzhang1506
@yayingzhang1506 2 жыл бұрын
Hey thanks for the tutorial! Very nice to see some real examples in unity! One thing though, in CommandProcessor class, if we need Redo(), then it shouldn't remove the command in the list in Undo(), right? undo-ed commands only remove when new commands are added to the list to override it. Code at kzfaq.info/get/bejne/i9V-qNCcsrrcXYk.html
@dadlord689
@dadlord689 5 жыл бұрын
So it seems to lead to an allocation of coomand class on heap in Update. At least use structures for such things.
@excellNexcel
@excellNexcel 6 жыл бұрын
Who the fungoola gave a thumb's down ?!
@zaprodaju1661
@zaprodaju1661 Жыл бұрын
This isn't the correct way of doing educational videos. Following any project by explaining content that was made in advance is incredibly tiresome. This is especially the case when there are multiple methods and parameters that are being passed through multiple scripts. It's great content, but you should create projects and scripts from scratch if you want to keep your audience engaged. This is the lazy way of doing things. Fanboys will attack me for this, but I'm not wrong about this.
@worstDevYT
@worstDevYT Жыл бұрын
Why your background is white?!?!
@worstDevYT
@worstDevYT 7 ай бұрын
Are u stupid? Can't he just use white theme?!?!?!!
@wildantamvan5341
@wildantamvan5341 6 жыл бұрын
enter pak eko
Object Pooling (in depth) - Game Programming Patterns in Unity & C#
29:56
What You Need To Know About The COMMAND PATTERN
14:09
BMo
Рет қаралды 3,4 М.
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 79 МЛН
Parenting hacks and gadgets against mosquitoes 🦟👶
00:21
Let's GLOW!
Рет қаралды 13 МЛН
Schoolboy Runaway в реальной жизни🤣@onLI_gAmeS
00:31
МишАня
Рет қаралды 4,1 МЛН
English or Spanish 🤣
00:16
GL Show
Рет қаралды 8 МЛН
Humble Object - Game Programming Patterns in Unity & C# (kinda :)
15:31
What is the Command Pattern? (Software Design Patterns)
19:55
Be A Better Dev
Рет қаралды 17 М.
Observer Pattern -  Game Programming Patterns in Unity & C#
18:52
Jason Weimann
Рет қаралды 90 М.
How to Program in Unity: Command Pattern Explained
22:37
iHeartGameDev
Рет қаралды 67 М.
How to use the Command Pattern (Skill Combos Example)
11:08
git-amend
Рет қаралды 8 М.
Design Patterns: Command/Memento
31:08
Microsoft Visual Studio
Рет қаралды 34 М.
When to use Factory and Abstract Factory Programming Patterns
12:13
The 8 Game Code & Architecture Mistakes We ALL Make - Unity3D
25:45
Jason Weimann
Рет қаралды 122 М.
Паттерн Command, Команда, Unity, C#, gamedev
20:00
Sergey Kazantsev
Рет қаралды 2,7 М.
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 79 МЛН