Level up your code with game programming patterns: Command pattern | Tutorial

Поділитися
Вставка
  • Опубліковано 30 січ 2025
  • Ігри

КОМЕНТАРІ • 96

  • @jacobs.7925
    @jacobs.7925 Рік тому +110

    PLEASE more, we love those!! There are way too many beginner tutorials around but only a few good intermediate ones with this level of quality. UNITY PLEASE MORE, official videos are great!!! Add more examples/applications if possible, more is always more!

    • @HomeMech
      @HomeMech Рік тому +9

      Thank you for the spirited encouragement! ☺We do in fact have more on the way

  • @lakemonstergames32
    @lakemonstergames32 Рік тому +28

    Yes finally! absolutely need more design pattern tutorials! Design pattern knowledge is such an important factor which will step up everyone's game dev abilities.

  • @Th3-Mast3rmind
    @Th3-Mast3rmind Рік тому +22

    Your design patterns ebook is a really good learning resource. It strikes that perfect balance of having a clean architecture, without being complex to implement. Maybe you guys could also create more video examples based on what's in the ebook

  • @kozmobotgames
    @kozmobotgames 7 місяців тому +4

    As a game developer, I appreciate this kind of videos. Recently I have updated my latest game and fixed some certain bugs. Thanks for sharing the best tips for productivity and game creation!

  • @ShiftyTheDev
    @ShiftyTheDev Рік тому +7

    Really glad to see this channel covering something as important as design patterns. Looking forward to more!

  • @iHeartGameDev
    @iHeartGameDev Рік тому +126

    Unity directly covering design patterns?! Awesome stuff! Hopefully doesn't put my channel out of biz 😛

    • @AriaZed
      @AriaZed Рік тому +9

      I was pretty surprised too, tho your videos are exceptional!

    • @ButterDog11
      @ButterDog11 Рік тому +2

      Would love another video made by you about this! :)

    • @HomeMech
      @HomeMech Рік тому +3

      Aw, thank you Nicky! That means a lot since your videos helped me create these videos. We wanted to help devs get a feel for the patterns quickly, so I bet they'll seek out other videos that go more step by step like yours 💖 Love your new procedural animation series 🔥

    • @iHeartGameDev
      @iHeartGameDev Рік тому +6

      @@HomeMech ☺Now that is an awesome surprise! So happy to hear! And thank you for the shoutout of the proc ani series!

    • @iHeartGameDev
      @iHeartGameDev Рік тому +2

      @@AriaZed Thanks so much for the kind words!

  • @uni-mal4433
    @uni-mal4433 Рік тому +4

    This e-book is really amazing! (and this video too!)
    Thank you for providing essential educational resources.

  • @jesbyjesby7569
    @jesbyjesby7569 Рік тому +5

    I started learning Unity quite recently. It feels like games are my calling in life :). I happily watched a lot of videos on this channel using subtitles, but I still found it very very interesting! :)

  • @aliday9968
    @aliday9968 Рік тому +2

    Wow! It really important topic and we need more!! Thank you so much to start it! Don’t want to miss any new video

  • @paufenollosa
    @paufenollosa Рік тому +1

    So useful. Even the senior developers needs this kind of videos to lern or refresh knowledge.

  • @y01cu_yt
    @y01cu_yt Рік тому +2

    We loved it, please continue from here Unity!

  • @ericO141
    @ericO141 Рік тому +3

    this video is something I didn't know I needed

  • @roxforgegames4548
    @roxforgegames4548 Рік тому +2

    Finally, I recently started to learn about Programing Patterns and I am really mad that I was not introduced to it before.

  • @CiroContinisio
    @CiroContinisio Рік тому +2

    Really nice video! Understandable, to the point, and the little animations in scene view are funny.

    • @HomeMech
      @HomeMech Рік тому +1

      That means the world to me coming from you, thanks Ciro!!! ☺

  • @Yggdrasful
    @Yggdrasful Рік тому +3

    Awesome, thank you for the video !

  • @uaAntonidiuss
    @uaAntonidiuss Рік тому +2

    love these visuals with Kyle

  • @nickicool
    @nickicool Рік тому +1

    Awesome series tutorials! Right way!

  • @mjkkaya6056
    @mjkkaya6056 8 місяців тому +1

    These are essential training! Unfortunately they were newly created, but it's okay. Keep going these Unity!

  • @EmadGhasemiDev
    @EmadGhasemiDev Рік тому +2

    This is what people need, design patterns with practical examples.

  • @sabharishrinivas4895
    @sabharishrinivas4895 Рік тому +2

    Thanks for the tutorial, much needed.

  • @AaronAsherRandall
    @AaronAsherRandall Рік тому +5

    I need like 100 of these videos…

  • @hellfim
    @hellfim Рік тому +2

    Finally a Unity example with a code of nice quality! ❤❤❤

  • @mariohaberle6147
    @mariohaberle6147 Рік тому +2

    Nicely animated.
    Unity is finally catching up on cool tutorials 👍
    Very well explained - but I think new programmes won't have a clue what's going on here.
    These should perhaps be named "Advanced" for people who have been coding for a while but have no clue how to write good code.

  • @fahmyeldeeb
    @fahmyeldeeb Рік тому +5

    More of this!
    I've been working as a Game Dev for a while using Unity, and it is so validating to see Unity's official channel posting more about how they code.
    There is a lot of "advanced" stuff out-there that is just pure complex garbage that does not work for Unity or game development in general.

  • @Liforus1
    @Liforus1 Рік тому +2

    Extremely cool content!

  • @Bloompix_Studios
    @Bloompix_Studios Рік тому +2

    Definitely a step in the right direction.

  • @yonatanabergel
    @yonatanabergel Рік тому +3

    Series on design patterns? Lets go!

  • @Maxx__________
    @Maxx__________ Рік тому +2

    Excellent tutorial!

  • @cankuruuzum1973
    @cankuruuzum1973 Рік тому +2

    It is nice to see such content. Great work! It would be very nice to see scripting while explaining it because scripted pages make it difficult to understand. Developing it while scripting also helps us understand the progress better.Just some advice for upcoming tuts.

  • @PrajwalArtist-p4d
    @PrajwalArtist-p4d Рік тому +2

    amazing - much needed

  • @vakuzar
    @vakuzar Рік тому +7

    Im glad you are doing these, but I think the issue is that it's not super clear why using this is a particularly helpful pattern compared to another similar one. I think making them a little longer to explain better both the use of it as well as the details would be good.

    • @HomeMech
      @HomeMech Рік тому +2

      Thank you for the feedback! We have more videos on the way soon, including a final video where the patterns are used together in a system. Since the videos each have their own personality that fits the pattern, we hope that the difference between them is clearer when taken as a whole. But do let us know what you think!

  • @Octamed
    @Octamed Рік тому +6

    Great! I would start though with the nightmare scenario of how to do something WITHOUT this pattern, then beginners might see a direct reason to use it.
    Also, hassle Unity to support interfaces in the inspector!

    • @HomeMech
      @HomeMech Рік тому +3

      Haha, great idea! In fact, in our upcoming factory video, we start exactly like that ☺
      In the case of command, I'm reminded of the bunny story we learn to tie our shoes, either the floppy ears or down the hole 🕳🐇 There are other complicated or just plain bad ways to tie your shoes, but sometimes it's useful to have the "right thing to do" be easy to remember.
      📩Hassle interface support, roger roger🤖

  • @benjaminlehmann
    @benjaminlehmann Рік тому +3

    Love this content. More of the same please :D

  • @StefanLopuszanski
    @StefanLopuszanski Рік тому +3

    Videos like this are actually good and useful. Definitely want to see more and have an in-depth guide for these.
    I went to the link provided but couldn't find the ebook or anything else about this...?

  • @radiantgames55
    @radiantgames55 Рік тому +1

    More of this please!!

  • @AIAdev
    @AIAdev Рік тому +1

    I understood 💯 of this the first time. … probably

  • @MarekNijaki
    @MarekNijaki Рік тому +2

    Great video

  • @1DrowsyBoi
    @1DrowsyBoi Рік тому +1

    Nature is healing... hopefully.

  • @Algost_
    @Algost_ Рік тому +2

    Very good video

  • @haseebraza7764
    @haseebraza7764 Рік тому +2

    classic 👌

  • @SBroproductions
    @SBroproductions Рік тому +3

    How do you handle commands that might take more than a single frame to execute? For example getting the character to walk 1m forward, then 5m to the left. These actions take time to finish.

    • @amr_zewail
      @amr_zewail Рік тому

      You can put an extra boolean IsComplete in each command, and make the commands manager not move on to the next command until the current one is completed.

    • @HomeMech
      @HomeMech Рік тому

      Great question! There are several ways to go about this. In a "WalkCommand" you could have an "isComplete" flag that starts out false and is set true once the character has reached the destination or the coroutine is complete. You can also invoke an event like "commandComplete." This is probably a good idea for the robot chef--"Order up!" 😄 It's worth noting that chatbots like GPT are *very* good at assisting in modifying or fine-tuning the patterns in various ways like you are asking. Just knowing the patterns a little is enough to unlock all the great advice that you wouldn't get if you didn't prompt for it. The concise nature of the ebook examples make them perfect for copy-pasting with a prompt. That said, I could see it suggesting something more complicated, like integrating the commands with a state machine, so it may be worth seeing a simple boolean flag or event-based approach first.

    • @BobrLovr
      @BobrLovr Рік тому +1

      Finite State Machine, a simple enum and switch statement. Or an interface or even delegate would work

    • @PhaaxGames
      @PhaaxGames Рік тому +2

      If the Execute command is a coroutine (or async) then you can just wait for it to finish.

  • @geri4367
    @geri4367 Рік тому +1

    This is the way

  • @RimuruDev
    @RimuruDev Рік тому +1

    Великолепный материал

  • @psinity
    @psinity Рік тому +1

    even I made my recent video covering this!

  • @orisofer
    @orisofer Рік тому +1

    Maybe I'm missing something, but if I use two Stacks for my Undo/Redo system, eventually I can end up keep allocating more and more commands since the beginning of the run. Isn't it a waste of memory? Is there a way to maybe keep the undo collection limited for only X amount when it's full?

    • @HomeMech
      @HomeMech Рік тому +3

      Great point! The examples are simple as needed to capture the pattern. How to handle a sequence of commands really depends, and our main objective is that people understand the pattern first. We have a final video on the way that is an action/fighting combo system (like Mortal Kombat or Street Fighter) using the command pattern--in that system, managing, evaluating, and clearing the sequence of button actions that might produce a combo is essential and pretty involved 😅

  • @TedThomasTT
    @TedThomasTT Рік тому +3

    Very good, but maybe take the next one a bit slower.

    • @HomeMech
      @HomeMech Рік тому

      Thank you!! Slow down a bit noted 😅

  • @AaronAsherRandall
    @AaronAsherRandall Рік тому

    I see no download or purchase link in the URL you posted. Come on guys… 🤦

  • @neistew
    @neistew Рік тому +3

    wow

  • @dharmeshkumar2763
    @dharmeshkumar2763 Рік тому

    I can't see any downloding link in mobile

  • @錘哥雜談
    @錘哥雜談 Рік тому

    So, where can find the code ?

  • @containedhurricane
    @containedhurricane Рік тому

    No need for C# OOP patterns because the performance is always much worse than ECS and Unity still haven't provided tools to track the connections in Scriptable Object event architecture

  • @ammaz3618
    @ammaz3618 Рік тому +1

    First

  • @fikrtemr
    @fikrtemr Рік тому

    My unit says Available: 0 bytes, how can I fix this?!!!!

  • @IanGA29XD
    @IanGA29XD Рік тому +3

    Omaga

  • @forestrf
    @forestrf Рік тому

    AI voice?

    • @HomeMech
      @HomeMech Рік тому +1

      🤖I am flattered you'd think someone would choose my voice from a drop down menu and think "yes, that's the one I want" haha 🙈

    • @forestrf
      @forestrf Рік тому

      @@HomeMech Sorry :S

    • @HomeMech
      @HomeMech Рік тому

      @@forestrf Don't be! It's a compliment in a funny kind of way 😄

  • @Feynman.R
    @Feynman.R Рік тому +1

    Too complicated and not understandable 😢

    • @HomeMech
      @HomeMech Рік тому +1

      Sorry to hear! Please let me know if I do better in the videos coming out next.
      I wish there were a way to do the robot chef story without code and then with the code... all that's needed to understand the basic gist of the pattern is the concept of putting robot chef orders in an envelope so you can create a list of them and thus have complete control over when they are opened/executed.

    • @BobrLovr
      @BobrLovr Рік тому +1

      what are you having troubles with

    • @BobrLovr
      @BobrLovr Рік тому +1

      @@HomeMech i think maybe just the classic undo redo functionality would be the best explanation of it. lets be honest you're not going to *actually* use this verbose code for something like this example

    • @Th3-Mast3rmind
      @Th3-Mast3rmind Рік тому +1

      ​​@@HomeMechI think OP is having a hard time understanding ICookingCommand and interfaces in general, since this is more of an intermediate level video. He most likely doesn't understand how interfaces can be used in dependency inversion. Maybe make a separate beginner video showing the purpose and how dependency inversion can be achieved with interfaces

    • @spider853
      @spider853 Рік тому +1

      @@BobrLovr I think there is just too much abstraction going on in the example, IRecipe, ICommand, a simple ICommand example, with a Queue and Execute method I think would be enough than going ICommand.Execute -> IRecipe.Cook ...

  • @LION303200
    @LION303200 Рік тому +2

    Such a bad video and hard to follow And Complicated … you need more simple and easy better explaining

    • @BobrLovr
      @BobrLovr Рік тому

      what point are you getting hung up at?

    • @Caffeen
      @Caffeen Рік тому +1

      Skill issue

    • @BobrLovr
      @BobrLovr Рік тому +1

      @@Caffeen save that for video games bud, these are people trying to learn. Why on earth would you bad mouth someone who's trying to understand something and better themselves?

    • @Caffeen
      @Caffeen Рік тому +4

      @@BobrLovr "Such a bad video" I'm all for people trying to learn and better themselves, and I would never insult someone for having difficulty learning, but badmouthing someone who put the time and effort into trying to teach you something is incredibly disrespectful.

    • @BobrLovr
      @BobrLovr Рік тому +1

      @@Caffeen It's not a great video or explanation. The usual example given for command pattern is usually an undo/redo functionalty because it's the best example you can give. Whatever weird abstract robot thing he's doing here is not an actual every day coding problem. It's a metaphor and not a very good one at that, he tried to be much too creative when it's explanation has already been perfected other places on the internet and in school

  • @MiTheMer
    @MiTheMer Рік тому +3

    Very neat tutorial!

  • @CharlieFleed
    @CharlieFleed Рік тому

    What possessed you to think this is a good way to explain coding? Cut the distracting animations, expecially those that make code I am still reading disappear, keep all the code on the screen, the components summary goes first, get rid of the kitchen example.