SIMPLE Tip For Better Unity Game Architecture

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024

Комментарии • 202

  • @git-amend
    @git-amend  10 месяцев назад +37

    Hi everyone! I hope you are all set to reach a few goals in 2024 - I know I am! Let's "G" + new string('O', 5)! 👍

    • @elijah-jones-inbox
      @elijah-jones-inbox 10 месяцев назад

      I enjoyed this video. It helped sort some things in my mind. I made a small game a couple of years ago. I used every worst coding practice ever. I'm getting back on the horse to make another game and it's difficult to architect a robust system. I'm learning a lot.

    • @git-amend
      @git-amend  10 месяцев назад +1

      @@elijah-jones-inboxGlad to hear it!

    • @napoleonbonerfarte6739
      @napoleonbonerfarte6739 2 месяца назад

      ​@@elijah-jones-inboxDifficult but my god does it feel nice

    • @elijah-jones-inbox
      @elijah-jones-inbox 2 месяца назад

      @@napoleonbonerfarte6739 true

  • @dorzaii
    @dorzaii 6 дней назад +1

    As a web developer for half a decade I always struggled to find clear Unity tutorials that focus on writing clean, manageable and maintainable code, your series on design patterns are amazing. I love how you write code and wished more Unity tutorials had your standard! Keep it up

    • @git-amend
      @git-amend  6 дней назад

      You're very welcome!

  • @frontalachivment3604
    @frontalachivment3604 10 месяцев назад +46

    Your videos are hidden gem - way better than anything other on youtube - way better than people with hundred thousands subs and to do unity guides.

    • @git-amend
      @git-amend  10 месяцев назад +4

      Thank you, I really appreciate that! Too kind.

  • @theimperialkerbalunion7568
    @theimperialkerbalunion7568 10 месяцев назад +7

    Its really interesting how much of this becomes second nature after years of developing

    • @git-amend
      @git-amend  10 месяцев назад +2

      Yes, I agree - I had to sit down and think for a bit before attempting to explain it!

    • @corgalie
      @corgalie 10 месяцев назад +1

      Op do you have any other tricks such as the “Is A” and “Has A”?
      Great video. Easy to listen to voice.

    • @git-amend
      @git-amend  10 месяцев назад +1

      @@corgalie I have a few more :) There will be more architecture videos coming up soon!

    • @theimperialkerbalunion7568
      @theimperialkerbalunion7568 10 месяцев назад +3

      @@corgalie there's a lot of resources online about architecting code. But honestly best way to learn is to try something, see the issues, and refactor it.
      And then just read or watch videos about architecture. There isn't one glove fits all, it's all about the problem you are trying to solve.
      For example, a lot of people say singletons are bad, but they are fine. Many enterprise codebases have them. Its using them badly that makes them well bad.
      But at the end of the day, we are here to make games. This is just to make the lives of your future self and team easier. But the player isn't going to see the code so game design is always more important.
      Code is just a laying the bricks, and architecting is making it structurally sound. But it won't tell you how to build a house that people want to buy.

  • @JeremiahT
    @JeremiahT 10 месяцев назад +4

    I almost exited the video when you started the lecture on favoring composition over inheritance. I'm glad I stayed because I enjoyed your examples on tuples and your trick for easily creating UML diagrams. Thank you.

    • @git-amend
      @git-amend  10 месяцев назад +1

      Great! Glad to hear it!

  • @TheMystogrigen
    @TheMystogrigen 10 месяцев назад +7

    Documentation Documentation Documentation. Throwing summary blocks everywhere helps a lot. Especially that tuple at 9:40. I throw them above classes/getters/methods. This works really well for ScriptableObjects, where you can just highlight the class name and it goes "Oh, this scriptable object is for storing audioclips and has functionality to easily grab a random one." Now you don't have to go rabbit-holing opening/peaking scripts to find what a function/class/getter does.

    • @git-amend
      @git-amend  10 месяцев назад +1

      Yes, that's a great point. I tend to document extension methods as well for this reason. Thanks for the comment!

    • @Hersatz
      @Hersatz 10 месяцев назад +1

      But then again, if your naming conventions were good enough, you shouldn't have to tell people what your classes or methods do.
      There are exceptions, of course, but documentation is more often than not a symptom of bad naming conventions or structure.

    • @theforgot3n1
      @theforgot3n1 10 месяцев назад

      @@Hersatz Completely agree. Documentation should be implicit in the structure of your code itself. Naming being the big main thing to watch out for.
      I do imagine large language models coming in to provide documentation as well though.

    • @TehAntares
      @TehAntares 10 месяцев назад

      How much documentation?
      From my experience, one can easily overdo it with tons of redundant documentation, effectively wasting time and energy on something that's either of not much use or will eventually change.
      I am not a fan of internal documentation. Although highlight does tell you what the class is, it likely won't tell you how to use it, where to use it, nor what's the context of the class (whether it has dependencies on something else, etc.). Certainly the last thing you want is someone else (or even you) doing local changes that are not consistent with the rest of the project, or might cause bugs or technical issues. For example, when you do make a unit spawner class, but make the mistake of not knowing that every unit needs to be registered in the unit manager, as other mechanics do need a quick access to all the units.

    • @git-amend
      @git-amend  10 месяцев назад +1

      ​@@TehAntares That's a good point as well. It can be challenging to decide what to document inside of a class. Often times comments add no additional value and are just visual clutter. Generally speaking, internal comments should only serve to explain code that actually requires explanation. I think this article has some very good points:
      stackoverflow.blog/2021/12/23/best-practices-for-writing-code-comments/

  • @Krahkarq
    @Krahkarq 10 месяцев назад

    Eye opener. Really love your hands on approach.

    • @git-amend
      @git-amend  10 месяцев назад

      Glad to hear it! Thank you!

  • @bromanguy
    @bromanguy 7 месяцев назад +1

    I absolutely love this channel lately. I really appreciate how you actually help people solve complex problems. Most other youtubers just give surface-level begginer if statement code instead, and try to sell me their overpriced course on top of that. Really appreciate your videos man, keep it up!

    • @git-amend
      @git-amend  7 месяцев назад

      Thanks for the kind words!

  • @oliverdowning1543
    @oliverdowning1543 10 месяцев назад +1

    Really interesting to see this concept being brought up in Unity. As a Godot hobbyist (who hasn't really touched Unity in 4 years or so) it's something that gets talked about a lot in the Godot ecosystem because, unlike Unity, there's no ECS it's all just "nodes" so an entire scene is one big composition tree and it's therefore super important to structure your code that way to work within the systems provided and super easy to do so.
    One example would be in the project I'm currently working on where I'm currently making, for it, a finite state machine in nodes rather than all in code. This works super well for this because, yes, you do have some inheritance with a base state class for instance, but since you're designing every state just based off of a few boilerplate methods in the base class and then placing that as a child object of the state machine that therefore just composes that particular state machine. The equivalent in Unity would either be making a state machine game object with a bunch of child game ibjects for the states or making one game object with a bunch of scripts for both the state machine and every individual state neither of which fits super nicely into the ECS of Unity which is probably why this isn't as core of a discussion within Unity development since it's just about how you structure your code not how you structure your entire game. I do find it really interesting to see how the same concepts do then show up in different ways in how you guys actually then write code though which is obviously quite different to the ideal Godot workflow since you have much more monolithic objects so while you wanna keep components you intend to reuse nice and small, generally it's ok to pack lots of features into one script and handle all the different logic and conposition within that which, while it absolutely can be done that way in Godot, generally isn't our ideal workflow with Godot generally preferring much smaller scripts (only one of which can be attached to any node) and then setting up their interactions through the node hierarchy and seperating out objects from each other using the scene system which is essentially like prefabs except used for pretty much everything from an enemy you wanna re-use loads to a gun you wanna have the player use to the main protagonist themselves or the game world and up to whole game scenes (hence the name). It's a very different structure where the game is just inherently a bunch of classes each composing greater and greater parts if the overall world and it's up to you to plan out how you intend to divide it up whereas Unity has everything already split up into neat objects but it's up to you to turn them from amorphous, a-hierarchical lumps of code into well order and structured units that are easy to work with through how you plan out and structure your code. It's really interesting to see how that shifts the way in which particular coding principles, such as inheritance vs composition, then get adapted and applied in different ways to fit the differences in workflow between the two engine.

    • @git-amend
      @git-amend  10 месяцев назад +2

      It's fascinating to see how different game engines approach code structure! Thanks for sharing your insights from the Godot perspective.

  • @AetherXIV
    @AetherXIV 10 месяцев назад +1

    I organically started building everything "standalone". I have a "Core" folder of scripts that I bring into every new game and am always improving. My Player class uses inheritance but very minimally.

    • @git-amend
      @git-amend  10 месяцев назад

      Nice when it comes naturally! Sounds similar to what I tend to do, my library is always slowly growing. Cheers!

    • @AetherXIV
      @AetherXIV 10 месяцев назад

      @@git-amend I'd say it was "naturally" in the sense Pain is natural :D The pain of refactoring led me to it. Thank you for the video. I want to get better at Composition.

  • @WaenglTaengl
    @WaenglTaengl 10 месяцев назад

    This video is literally a 'SpecialResource'! It helped my understanding a lot! Please keep on posting architecture/pattern videos, I'm more than happy to support!

    • @git-amend
      @git-amend  10 месяцев назад

      Glad it was helpful!

  • @IdealIdleIncremental
    @IdealIdleIncremental 10 месяцев назад +2

    Wow, that's actually an insanely useful video. I'm happy I stumbled upon your channel. Immediately subscribed. Your tip with tuples as a return type is sick. Will use it!

    • @git-amend
      @git-amend  10 месяцев назад

      Awesome, thank you! Welcome!

  • @nati7728
    @nati7728 10 месяцев назад

    When preferring composition over inheritance in my project, I've found that I still use inheritance frequently - just in my prefab variants instead of my code. For example, I have an Actor prefab (not a MonoBehaviour) that has all the functionality for moving around the world, taking damage, and holding an inventory (separated nicely into components), and then I have Player and Enemy prefab variants that I can conceptually think about as "Actors" since they are variants of the same prefab. For me it really feels like a best of both worlds way of doing things.

    • @git-amend
      @git-amend  10 месяцев назад

      That's a great approach! It's all about finding what works best for your project and adapting as needed. Cheers!

  • @GlasTaibhse
    @GlasTaibhse 10 месяцев назад +1

    your channel is amazing!! I'm still beginner/low-intermediate level so a lot of your vids are over my head, but I can't count how many times I've had eureka moments while watching your stuff

    • @git-amend
      @git-amend  10 месяцев назад

      Awesome! Thank you!

  • @hometipi4645
    @hometipi4645 10 месяцев назад +1

    This is, this is, i always wonder why no tutorial ever teach about tuple, i personally think it's usefull, many of them use "out" keyword when needed to deal with more than one returning value, this is great keep it up man

    • @git-amend
      @git-amend  10 месяцев назад

      Hey thanks! Yeah, I agree, tuples are an under appreciated feature!

  • @dotBAIT
    @dotBAIT 10 месяцев назад +2

    I would love to see how you would make a simple inventory system using just a hotbar like in lethal company. The way you explain and structure things is incredible

    • @git-amend
      @git-amend  10 месяцев назад +1

      Interesting, have not tried Lethal Company yet. Will check it out!

    • @dotBAIT
      @dotBAIT 10 месяцев назад +1

      @@git-amend Its a fun game. Not asking for a 1 for 1 but just the concept and proper structure. Much like the examples in this video I tend to over complicate things when it comes to an inventory system. So learning how to get the base down for a strong structure will be amazing. Im sure a lot of other people will enjoy it as well.

  • @techdave99
    @techdave99 10 месяцев назад +1

    Thanks for making videos during the holidays. Great video. Going to review some of my code and apply this.

    • @git-amend
      @git-amend  10 месяцев назад

      Thank you and you're welcome! All the best in '24!

  • @frontalachivment3604
    @frontalachivment3604 10 месяцев назад +1

    To be honest when it comes to value of your videos - you are top 1 above people with hundred thousands of subs.

  • @Breckdareck
    @Breckdareck 10 месяцев назад +3

    Like everyone else has reiterated before, your videos are excellent! Please continue banging out some fire videos in the coming year. Happy New Year! Keep up the great work!

    • @git-amend
      @git-amend  10 месяцев назад

      Thanks, will do!

  • @nathanbarraud4349
    @nathanbarraud4349 10 месяцев назад

    Wohoo I'm so happy I found your channel, it's a hidden gold mine ! Thank you for your high quality work !

    • @git-amend
      @git-amend  10 месяцев назад

      Glad you found it! Welcome aboard!

  • @armandopena5508
    @armandopena5508 10 месяцев назад

    The moment I saw "Composition vs Inheritance" I followed you! what a great video. Keep it up!!!💯

    • @git-amend
      @git-amend  10 месяцев назад

      Sweet! Welcome!

  • @rutchjohnson
    @rutchjohnson 10 месяцев назад +1

    WOW! This was an amazingly structured video! Loved that you took the perspective of a new learner at the beginning and showed the progression from easy/messy to advanced/structured with tips along the way. Awesome stuff and these type of tutorials just encourage me to keep on coding! HNY 2024!

    • @git-amend
      @git-amend  10 месяцев назад

      Thanks so much! Happy New Year!

  • @oldshamen
    @oldshamen 10 месяцев назад

    Happy New Year :)
    I really enjoy following your channel. One of the things I have experienced as the biggest challenge for most gamedevs is to keep a tidy architecture in their code. I have come across many developers over the years that give up (or delete all code and started over) due to major techincal debt and code complexity. Your channel is amazing at illustrating good practices without overselling the benefits/challenges. Your channel is a true gem!!

    • @git-amend
      @git-amend  10 месяцев назад

      Happy new year! Thanks for the wonderful comment!

  • @nilescongmakesgames
    @nilescongmakesgames 10 месяцев назад

    Hi, just want to say thank you so much for this video and other amazing contents. I struggled a lot when refactoring part of my game code, but your tips are truly helpful as it make me feel clearer what I need to do!

    • @git-amend
      @git-amend  10 месяцев назад +1

      Great to hear!

  • @Broudy001
    @Broudy001 10 месяцев назад

    Fantastic as always, and interestingly something I'd just been contemplating in relation to a process my controller is using

  • @dabmaster6874
    @dabmaster6874 10 месяцев назад +1

    Amazing! I have two years of experience and I didn't need tuples. But I think I might have needed them but didn't know it xD Thanks for the info and happy new year

    • @git-amend
      @git-amend  10 месяцев назад

      Right on! Thank you!

  • @perrygolden
    @perrygolden 10 месяцев назад

    mermaid markup can also be used to visualize code in varying different ways.

    • @git-amend
      @git-amend  10 месяцев назад

      Interesting. Looks like it has some VS Code integration too.

  • @gambitdevs1234
    @gambitdevs1234 10 месяцев назад +1

    Great video, as always :) still looking forward to a video about what you do for work and any tips sometime! But all your videos are a blessing, thank you!

    • @git-amend
      @git-amend  10 месяцев назад +1

      Thank you! Happy New Year!

    • @gambitdevs1234
      @gambitdevs1234 10 месяцев назад

      Happy New Year! @@git-amend

  • @ankitwarkade6920
    @ankitwarkade6920 3 месяца назад

    I wish you get 50k subscribers by the end of 2024☺. So much helpful content for any intermediate or advanced level developer or learner. Yet having subscribers less than 15k is not something you deserve.

    • @git-amend
      @git-amend  3 месяца назад

      I hope so too! Thanks!

  • @GamesOfVaibhav
    @GamesOfVaibhav 10 месяцев назад

    I love youtube recomendations :D

  • @amduck
    @amduck 7 месяцев назад

    god dammit you're finally gonna be the guy that makes me give a shit about dependency injection, aren't you?
    subbed. humbled and subbed. good shit homie. I usually get all claws out when I see people trying to apply a lot of software engineering paradigms that Unity's community has long since kinda overlooked (generally), but your approach is solid. no platitudes, no generalizations, just teaching approaches and respecting the language. shit rules man.

    • @git-amend
      @git-amend  7 месяцев назад

      Welcome aboard!

  • @danielsonstudios
    @danielsonstudios Месяц назад

    Holy crap!! You made this so simple!! Thank you!

  • @PiGameDev
    @PiGameDev 10 месяцев назад

    Great video again! You could also return a list of gathered resources instead of a tuple. That way you don't have any limit on how many resources a node can contain. What do you think?
    Great job and I can't wait for another video!

    • @git-amend
      @git-amend  10 месяцев назад

      Thank you! Yes, a List or another Collection type would work if you didn't need to distinguish one Resource from another, also great if you wanted to iterate over them with LINQ. The only downside (in this example) would be that you wouldn't be able to tell which one was the 'special' one if the consumer wanted to treat it differently somehow. Also, most collections in C# are reference type whereas a Tuple is an immutable value type, something I didn't mention explicitly, but might be something to consider. Cheers!

  • @512Squared
    @512Squared 10 месяцев назад

    Yippee 🥳 - Another amazing video from one of the best Unity tutors out there.

    • @git-amend
      @git-amend  10 месяцев назад

      Thank you! Happy New Year!

    • @512Squared
      @512Squared 10 месяцев назад

      @@git-amend Likewise

  • @Caliums
    @Caliums 10 месяцев назад

    Really helpful! Thanks as always and happy new year!

    • @git-amend
      @git-amend  10 месяцев назад

      Happy new year! Thank you!

  • @captainnoyaux
    @captainnoyaux 10 месяцев назад

    I love this subject, it'd be awesome to have more practical examples like this one or for more complex topics

    • @git-amend
      @git-amend  10 месяцев назад +1

      Absolutely, I plan to make quite a few more on this subject - seems to be not too much practical advice about it on YT.

    • @captainnoyaux
      @captainnoyaux 10 месяцев назад

      Exactly ! That's nice 👍

  • @goldone01
    @goldone01 9 месяцев назад

    Agree with the sentiment of the video. However, I'm a bit surprised you don't bring up in your video that unity itself is component based. To me, the best advice is to embrace that. So often you see a Player class that has the functionality. Whereas in 95% of cases you'd want a health component, attack component, player input component, etc

  • @jacobs.7925
    @jacobs.7925 10 месяцев назад +1

    Hey supreme leader, hope you have great holidays! Need advice please, sorry for asking here, quite desperate (I'm skipping holidays just to work/learn), you're the best unity dev right now at youtube by far.
    Let's say you know how to code a specific game, closed scope, solo dev. In a terrible/spaghetti/unoptimized way, but you just know how to do it. Would you rather code it now, even it being a total mess or would you rather hold/study and then start from good architecture before putting any line at rider?
    I'm not sure if I just go for it and then refactor once I get the skills (not sure how much work it takes) or if I should study a lot before writing any code at all (aiming at production-level quality). My skill level: I coded a clone of Slay the Spire by myself, in the worst possible way (breaking every principle of SOLID, using tons of FindGameObjectsWithTag, having 500+ lines monoliths as scriptable objects, its fucking scary), but it works perfectly. Gonna code a 2d turn-based game by myself, would love your advice.
    Thanks a ton!!

    • @git-amend
      @git-amend  10 месяцев назад +2

      Thanks for the comment! In my opinion, you don't need to put your next project on pause - instead of halting everything to learn, integrate learning into your development process. As you learn new concepts, apply them to refactor parts of your code. You've successfully built a game, which is a significant achievement. This experience is invaluable. Start by leveraging what you already know.
      Build a small part of your new game, refine it, learn from it, and then move to the next part. This way, you’ll progressively improve both your game and your skills. While aiming for better quality is important, beware of the trap of perfectionism. It's okay if not every part of your code is exemplary. Sometimes, progress is about moving forward, even if it's not perfect.
      I think you saw my post about suggested books from the last video. I think these two might be good for you:
      Agile Software Development: Principles, Patterns, and Practices - Robert C. Martin
      Clean Architecture - Robert C. Martin
      Read a bit every day as part of your routine and start applying some of the concepts as you write code for your new project. Remember, every developer has written code they’re not proud of. What makes you a better developer is the willingness to learn from past experiences and continuously improve. Your journey from a spaghetti codebase to a more structured one will be a valuable learning experience.

    • @jacobs.7925
      @jacobs.7925 10 месяцев назад

      @@git-amend wow thanks for the effort of coming with such a detailed reply, you rock, gonna follow that 100%!! I won't forget this lesson

  • @neoteraflare
    @neoteraflare 10 месяцев назад

    just found your channel. This video convinced me to subscribe! Really good work!

    • @git-amend
      @git-amend  10 месяцев назад

      Awesome! Glad to hear that, welcome!

  • @kpm25
    @kpm25 10 месяцев назад

    Thanks for your awesome resources! 👌

    • @git-amend
      @git-amend  10 месяцев назад

      Glad you like them!

  • @jumpjumpdiegaming
    @jumpjumpdiegaming 10 месяцев назад

    Happy new year brother!!! You are nailing it with these videos. There’s going to be a whole lot more skilled devs out there because of you. Thanks again!

    • @git-amend
      @git-amend  10 месяцев назад

      Happy new year! Thank you!

  • @restushlogic5794
    @restushlogic5794 10 месяцев назад

    Nice one.
    I always make class one by one no need inheritance or anything then if I found CTRL+C alot, then I could merge the class by using inheritance or interface even the generic one.
    For programer progress is better but the important thing is make it lazy.

    • @git-amend
      @git-amend  10 месяцев назад

      Sounds similar to my usual process. It helps me to write a small amount of code before I decide on an abstraction, if any. Cheers!

  • @termite1737
    @termite1737 10 месяцев назад

    Thank you for sharing, and happy New Year to you! :)))

  • @programmer2AG
    @programmer2AG Месяц назад

    First thing your videos are always great, and I love this one too. what I want to ask is how did you create that fade effect, where trees are vanishing in a circle pattern, and we are able to look at the player from above. How can I create that effect?

    • @git-amend
      @git-amend  Месяц назад +1

      I'm using the Advanced Dissolve asset from the store. Link is in the description, it's very easy to use and has a great demo scene. Highly recommended.

  • @TheKr0ckeR
    @TheKr0ckeR 10 месяцев назад +1

    Great guide as always, I am in minute 5, and asking the question before i finish, So what if our some of our base nodes has no special resource? Wouldnt it be a reduntant methods in some of derived classes, for example a Gold Node without special, wouldnt it break Liskov's substition principle? I always like the idea of "Composition over inheritance" but while applying it in a medium scale project, i find myself duplicating a lot. writing the same thing.
    Btw, the PlantUML tips is extremely useful!

    • @git-amend
      @git-amend  10 месяцев назад

      Thanks for the comment. LSP states that objects of a superclass shall be replaceable with objects of its subclasses without affecting the correctness of the program. If some base nodes lack special resources, it doesn't inherently break Liskov's Substitution Principle as long as derived classes still fulfill their base class contracts, even with some methods becoming redundant. In fact, the Null Object pattern is very useful in these scenarios - but I want that to be a separate video so I didn't get into it here... stay tuned!
      In regard to duplication - this is almost always indicates that you should consider Inversion of Control / Dependency Inversion. Duplicate logic can almost always be injected one way or another as a service or strategy.

    • @TheKr0ckeR
      @TheKr0ckeR 10 месяцев назад

      @@git-amend Great explanation. I would love to see some examples about Liskov substition later on if you have time!

    • @git-amend
      @git-amend  10 месяцев назад +2

      @@TheKr0ckeR Quite a few people have requested a good SOLID video, so I'll plan one for early 2024.

    • @Briezar
      @Briezar 10 месяцев назад +1

      @@TheKr0ckeR consider this method: void Gather(BaseNode node), and this class BigGoldNode : GoldNode (which inherits BaseNode). LSP basically means that if you pass in BigGoldNode instead of GoldNode, the program should still work.

  • @azizcanyalcin
    @azizcanyalcin 24 дня назад

    I think you should write a book about those topics

  • @opxv
    @opxv 10 месяцев назад

    Hey, great video as always. I love the little touch-ups you do, just those little refactorings. That's where my question comes from. I kinda expected the ResourceType enum to be deleted once the ResourceConfig was in place. Do you or would you handle your types like this e/g defining type in code, choosing it in ScriptableObjects? Or was it just the cut for the video?
    Cheers and happy new year!

    • @git-amend
      @git-amend  10 месяцев назад

      Thanks! That's a good question. For me - I usually keep them in an Enum format so I can easily have a drop down menu in my scriptable object definitions and not do any extra work. However, you might want to approach that differently if you want to be able to define types from inside Unity - or somewhere else, like say Google Sheets. In that case I would probably have a ScriptableObject that just represents the list of types aka a ScriptableList. This works great for any kind of data that needs to change in the Editor or at Runtime.

  • @onerimeuse
    @onerimeuse 10 месяцев назад

    This is the first architecture video I've watched where I said "aaaaah, OK. I get this" without going and looking for six other videos like it. Any chance you understand dots enough to explain it like this?
    Is it messed up that I can't wait for family time today to end so I can watch everything on your channel? (posted at 4pm, new years eve 😂)

    • @git-amend
      @git-amend  10 месяцев назад

      Haha great! Maybe start with the Programming Patterns playlist! No DOTS videos on the channel yet, but you aren't the first to ask so maybe one of these days.

  • @PuebeckDev
    @PuebeckDev 8 месяцев назад

    Hiya, bit late to the party, but for class diagram generation you can also look into automated documentation generation. I hooked my project onto Doxygen and am able to generate UML diagrams without the chatGPT intermediary step.
    Still though, this is a great video, I'll be binging your channel when I find the time :)

    • @git-amend
      @git-amend  8 месяцев назад

      Thanks for the tip!

  • @adirmugrabi
    @adirmugrabi 10 месяцев назад

    i favor composition over inheritance, but i still sometimes use inheritance.
    for example: both a door and a resource node are Interactables, but each of them has very different interaction.
    in the character controller i check if what i am looking at, is an interactable, and if so i call interact().
    having a class that will composite both of these is not the best.

    • @Mad3011
      @Mad3011 Месяц назад

      I would personally use an interface in that case

  • @bazzel1059
    @bazzel1059 5 месяцев назад

    Is there a video on how you did the logic for how the camera looks through the leaves of the trees? It looks really good.

    • @git-amend
      @git-amend  5 месяцев назад

      No video per se, but I did explain it a little bit in the video description. Link to the Asset I'm using there as well.

  • @Raidea
    @Raidea 10 месяцев назад

    This is a fantastic video, thank you!

    • @git-amend
      @git-amend  10 месяцев назад

      You're very welcome!

  • @stephenkirby6788
    @stephenkirby6788 10 месяцев назад

    Well done video sir, commenting for the algorithm!!!

    • @git-amend
      @git-amend  10 месяцев назад

      Much appreciated!

  • @pagoda_dimensionale9761
    @pagoda_dimensionale9761 5 месяцев назад

    Amazing video and very clear examples. Can i ask what IDE are you using? There is a video about the plugins that you use in Unity? I never seen Console Pro and it look really cool.

    • @git-amend
      @git-amend  5 месяцев назад +1

      There is actually a video in the works about the additional Assets i use. Console Pro is from the Unity Asset Store, you can find it here: assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889?aid=1101lw3sv

    • @pagoda_dimensionale9761
      @pagoda_dimensionale9761 5 месяцев назад

      @@git-amend thank you 🙏

  • @manzell
    @manzell 10 месяцев назад

    Serialization is such a biyotch when using Interfaces everywhere. And I'd really like simpler ways to share functionality without encapsulating them in a third class!

    • @git-amend
      @git-amend  10 месяцев назад

      I sometimes forget how annoying it can be, since I've used Odin in every project for years now.

  • @just-jiu
    @just-jiu 6 месяцев назад

    I would rather have a BaseNode and SpecializedNode separated, returning array of resources instead. So the base class is open to extension in the future and doesn't have any unused variables when special resources are not configures.

  • @erfansh1925
    @erfansh1925 24 дня назад

    Thank you for this videos.

  • @inkofthedragon
    @inkofthedragon 10 месяцев назад

    This was a great video! Do you have another one that applies Composition to create different character types? Each character would have different abilities or stats. Like for an action game, have a Goblin, Dragon, Boss, and so on. Each character would "have a" melee attack, ranged attack, defensive tactic, maneuver tactic, special ability, perform task behaviour, and so on. On that note, what if you have a special character like a Boss that has finishing moves that regular enemies do not. Would you create a different base class for that? Or keep the same base class of perhaps "NPC" and just leave certain fields blank for those missing features? Curious to hear your insight on this. Thanks, great channel!

    • @git-amend
      @git-amend  10 месяцев назад

      I do not have a video specific to that context. However, you are on the right tack with your description. I would start splitting the character/enemies into specific domains - combat, movement, abilities, etc. Those would likely be further reduced. The amount of coupling and extent of the inheritance hierarchy really depends on the project though. We'll have more videos on this in the future, but you might want to watch the videos on Strategy pattern and the Dependency Inversion principle. Cheers!

    • @inkofthedragon
      @inkofthedragon 10 месяцев назад

      ​@@git-amend Another question I had is about the architecture of components for a character. Right now I have a ton such as a NavMeshAgent, Rigidbody, AnimationHandler, Health, SquadHandler, Inventory, FieldOfViewHandler, and so on. Currently all these components are gathered in the NPC class, then passed into the NPCController. The NPCController is then passed into concrete abilities such as dash, melee, and so on. The abilities then can use Controller.Inventory or Controller.FieldOfViewHandler and so on. This architecture feels dirty but I'm unsure the cleaner approach?? I'm still fairly new to programming so I'm not sure if I'm phrasing this correctly but I guess what I'm trying to achieve is the idea that concrete classes (the specific ability) can access the components in the high-level classes to cause an effect. Or should I be more thinking of it in a completely different way?? A specific example is when an enemy enters the AttackState, it needs to Add itself in as an attacker - so SquadHandler.AddMember(). So the AttackState requires access to the SquadHandler. In the same vein, StateParameters needs to be passed into AttackState so it can affect the Animator, plus the Agent so can use things like Agent.isStopped = true, plus the FieldOfViewHandler so the AttackState can determine if the target is still in view, and so on...I think you get the idea. A lot of things are getting passed around into different states as well as different abilities. Sorry for the long description but being a noob means it's hard to describe these problems. Appreciate any direction to cleaning this up for the long term. Thanks once again! You are amazing!

    • @git-amend
      @git-amend  10 месяцев назад +1

      @@inkofthedragon It seems like you need to reference various services from multiple locations, possibly even static classes or classes instantiated at runtime. If that's the case, then there is nothing wrong with passing in an object that exposes references to the specific services you need. A cleaner approach is to just pass in a Strategy or Command to be executed, so that your states for example are not tightly coupled to behaviour. The strategy can be created at runtime and contain the references and logic to be executed. This is more in line with the single responsibility principle and allows you to change behaviour in each state if you need to.
      Try not to let perfection get in the way of progress. Just keep building things and applying knowledge that you acquire. As you continue to learn more, and are exposed to new ideas and concepts, your skill level will naturally increase as you apply that new knowledge to your project. Remember, all senior developers were juniors once!

  • @fokeyjo
    @fokeyjo 10 месяцев назад

    Interesting about the tuples, didn't know about them... but I think I would've used an array unless I really needed to know that the 2nd harvested item was a specific type of harvest, in which case it would likely be a different class anyway! Is there a particular reason you wanted that separation?

    • @git-amend
      @git-amend  10 месяцев назад

      In the scenario shown in the video, using a ValueTuple is preferable over an array for several reasons. Firstly, ValueTuples allow for clear, named properties, enhancing code readability and making it explicit what each element represents. This clarity is especially beneficial when returning a regular harvested item and an occasional special item, as it avoids the ambiguity of array indices. Additionally, they offer the flexibility to hold different data types, if that was something you chose to do, providing a structured way to return multiple values without creating a custom class or struct.
      I might choose an array over a tuple if I were unsure how many items would be returned or if I wanted to use the result in a loop or LINQ.

  • @ragerungames
    @ragerungames 10 месяцев назад

    awesome video. thanks!

    • @git-amend
      @git-amend  10 месяцев назад

      Glad you liked it!

  • @nightyonetwothree
    @nightyonetwothree 8 месяцев назад

    instead of doubling "special" resource fields and methods, there can be a bool for isItSpecial or not.

  • @kevin41307
    @kevin41307 10 месяцев назад

    really useful tutorial

    • @git-amend
      @git-amend  10 месяцев назад

      Glad to hear that

  • @kilikopela83
    @kilikopela83 9 месяцев назад

    Wow, great video. Subbed!

    • @git-amend
      @git-amend  9 месяцев назад

      Awesome, thank you!

  • @metaling278
    @metaling278 10 месяцев назад

    What’s going on with that transparency shader on the tree? The one that’s letting you see your character when it’s occluded.
    Is there a video about it? :D looks super useful

    • @git-amend
      @git-amend  10 месяцев назад

      No video on that one (yet), I just started using it this week. It's the Advanced Dissolve shader made by Amazing Assets. I've taken that shader and used it as a node in several Shader Graphs used by my environment assets (made by Aquarius Max). It was surprisingly easy to use and has really good demos and documentation. It's on sale right now 50% off. Link in the description if you want to check it out! So far, I really like it.

  • @RayznGames
    @RayznGames 25 дней назад

    Great Video!

    • @git-amend
      @git-amend  25 дней назад

      Thanks for the visit, glad you enjoyed it!

  • @vietdungdev
    @vietdungdev 10 месяцев назад

    Can you talk about the game architecture when using DOTS and ESC?
    I was really confused about game architecture when I first learned about ESC a few days ago.

    • @git-amend
      @git-amend  10 месяцев назад +1

      At some point we will talk about it. In the meantime, have you seen Code Monkey's new video about DOTS?

    • @vietdungdev
      @vietdungdev 10 месяцев назад

      @@git-amend Yes, I just watched it. But I'm not sure how to transfer the architectures you taught to ECS.
      It would be great if there was an example video, looking forward to it from you

  • @Ironlionm4n
    @Ironlionm4n 10 месяцев назад

    Amazing video.

    • @git-amend
      @git-amend  10 месяцев назад

      Thanks! Glad you enjoyed it

  • @Andrew-pd2ci
    @Andrew-pd2ci 10 месяцев назад

    Hey, awesome informative video.
    I am wondering, what code conventions are you used to, because I worked mostly with rules by Microsoft code conventions

    • @git-amend
      @git-amend  10 месяцев назад

      Thanks for your comment! My code conventions fall in line with what I do at work - which actually involves several programming languages other than C# - Java would probably be the biggest influence in that area. Additionally we also use automated tools like Prettier to format our code when making commits so that it is always consistent - it has built in rules, so as a team we never have to argue about these kinds of things - we just use the tool: prettier.io/

    • @Andrew-pd2ci
      @Andrew-pd2ci 10 месяцев назад

      Thanks for your response. Interesting, I am a c# developer and I am sticking to Microsoft conventions and finding your code a little hard to read for myself.
      Thank you for the exclusive advanced tutorials on C#+Unity

  • @briandellinger298
    @briandellinger298 7 месяцев назад

    Question - I noticed you have some tasty plugins for Unity. I see Console Pro - which is nice, but also your Unity windows (the dropdowns inside of Unity) are black, what are you using for this (this doesn't come with with the standard dark-theme)? Also, your inspector looks different as well - are you using something for this too?

    • @git-amend
      @git-amend  7 месяцев назад

      The difference in the Editor (black backgrounds) is probably because I'm using Unity 2023. It has some nice features like scrollable context menus as well, among many other things. I have several additional Assets running in all projects, and there will be a video about my setup at some point since it's been requested many times. For the inspector, I use Better Transform from Tiny Giant Studio:
      assetstore.unity.com/packages/tools/utilities/better-transform-real-size-global-local-switch-and-child-parent--258314?aid=1101lw3sv

    • @briandellinger298
      @briandellinger298 7 месяцев назад

      @@git-amend Thanks for the response - take care!

  • @mehmeh8883
    @mehmeh8883 10 месяцев назад

    Top Videos

  • @ninqbi1738
    @ninqbi1738 10 месяцев назад

    Ur vid is so great. Im just curious the way u set up camera so that the tree does not obscure the character, can u help me?

    • @git-amend
      @git-amend  10 месяцев назад +1

      Thank you! I'm trying out the Advanced Dissolve shader made by Amazing Assets. I've taken that shader and used it as a node in several Shader Graphs used by my environment assets (made by Aquarius Max). It was surprisingly easy to use and has really good demos and documentation. It's on sale right now 50% off. Link in the description if you want to check it out! I really like it so far.

    • @ninqbi1738
      @ninqbi1738 10 месяцев назад

      @@git-amendThank u very much!

  • @rutchjohnson
    @rutchjohnson 10 месяцев назад

    So as a beginner my code tends to get messy when I start implementing the visual side of things. Say with your code near the end, when interacting with the rock to get a resource, how would I impliment visual change? Such as the rock breaking. Or how do I update the UI? I'm not wondering how to do it as I know of ways to do it but structurally how do I keep my code clean and add all these other elements that are part of every game.

    • @git-amend
      @git-amend  10 месяцев назад

      That's a great question. I was going to use the tree as an example, because I was working on the visual effects for chopping it down already but decided that was going a bit far for one video. In most resource gathering systems, you might need to remember some state - like how many times the node can be hit before it's exhausted, and what particle effects to play each time, and how long until it is ready for harvest again. As it gets more complex, if you feel that your list of exposed fields is becoming repetitive (or too many) consider extracting your visual effects and sounds into one or more strategies. So you could have a strategy that plays some sounds and vfx during harvest and another one when it's exhausted. Then you just use different strategies for trees and rocks, and you only have to change those in one place in the future.

    • @rutchjohnson
      @rutchjohnson 10 месяцев назад

      @@git-amend Ahh great! I’ll look in to that :)

  • @данет-э5л
    @данет-э5л 4 месяца назад

    @git-amend just quick quastion about how u made this effect when things are become transparent in front of a camera if there is a tree or a rock? Did u make a sphere object in front of camera with material that have shader with stencil buffer mask, and all other objects that can block camera have other material that to check if we draw them or not regarding this stencil checks? Or u made it some different way? rly wonna know your approach. ^_^ ♥

    • @git-amend
      @git-amend  4 месяца назад +1

      I left some details about that in the video description with a link to the asset I'm using, it's called Advanced Dissolve.

    • @данет-э5л
      @данет-э5л 4 месяца назад

      @@git-amend oh, Much thx ♥ gonna check it out.

  • @techdave99
    @techdave99 10 месяцев назад

    Are you creating a sphere that follows the camera and apply the Advanced Dissolve shader to it? (To clear the trees and stuff so you can see the character)

    • @git-amend
      @git-amend  10 месяцев назад

      A cylinder actually - it runs from the camera to a game object just above the player. That particular shader has support for many different types of geometrical shapes, and I'm thinking a cone might actually be a little bit better - still playing with it. I integrated that shader with the existing leaves Shader Graph, which was surprisingly easy and documented. Link is in the description if you want to check it out, it's 50% off right now. It's called Advanced Dissolve by Amazing Assets.

    • @techdave99
      @techdave99 10 месяцев назад

      @@git-amend I just got the asset. I hope the affiliate link worked, as I also got another asset at the same time.

  • @damonfedorick
    @damonfedorick 10 месяцев назад

    Nice

  • @adventuretuna
    @adventuretuna 10 месяцев назад

    How come your create menu has a scrollbar? Is that part of Unity 2023? Or maybe a Windows feature? I'm stuck in the LTS versions for reasons and use a Mac.

    • @git-amend
      @git-amend  10 месяцев назад

      Yeah, it's a feature of 2023. To be honest, it's taking me a while to get used to the new menus, but that is one feature that is pretty nice.

  • @saket37
    @saket37 10 месяцев назад

    Gold

  • @EricWilliamsCG
    @EricWilliamsCG 10 месяцев назад

    Wait, you can destructure things like you can in Javascript? I've been doing it long hand in C# forever.

    • @git-amend
      @git-amend  10 месяцев назад

      It’s only been available with C# 7 onwards - I forget exactly when Unity added support for it, not too long ago

  • @jrpenanueva1479
    @jrpenanueva1479 10 месяцев назад

    hi, do you have an information about how you did your trees slowly disappear when its abstracting the camera? id like to know the technique thanks

    • @jrpenanueva1479
      @jrpenanueva1479 10 месяцев назад

      is it like a shader? hmmmmmmmm

    • @git-amend
      @git-amend  10 месяцев назад +1

      A few others have asked so I added some detail to the description of the video. I'm using a shader called Advanced Dissolve from Amazing Assets - there is a link in the description. My trees use several Shader Graph shaders, and I've integrated that dissolve shader as a node in the graph. It uses a geometric shape to determine which area to hide. It's very powerful, well documented and easy to use. Link in description. Also - it's on sale right now 50% off during the New Year sale.

    • @jrpenanueva1479
      @jrpenanueva1479 10 месяцев назад

      @@git-amend make a tutorial video perhaps? would be a cool content 😍

  • @magia136
    @magia136 Месяц назад

    Omg you teaches more than the main topic 🤔

  • @V-post
    @V-post 10 месяцев назад

    Can’t generics cover a lot of this?

  • @krishx007
    @krishx007 10 месяцев назад

  • @mutlugameofhalit
    @mutlugameofhalit 11 дней назад +1

    Alright but I have a bigger question here: How do we save our classes and each instances' references to each others (Item, NPCCustomer, Player, Shelf...) and load them again? How can we handle this?

    • @git-amend
      @git-amend  10 дней назад

      ruclips.net/video/z1sMhGIgfoo/видео.html

  • @nikolazagorac8634
    @nikolazagorac8634 10 месяцев назад

    I say: both

    • @git-amend
      @git-amend  10 месяцев назад +1

      Absolutely!

  • @SuperTungbi
    @SuperTungbi 10 месяцев назад

    awesome work with a sexy voice, what can i ask for more. Thank you very much.

    • @git-amend
      @git-amend  10 месяцев назад

      Aww, you are too kind! Thank you!