Thank you, that's a very encouraging comment! The channel is definitely starting to grow a little faster lately because of this video, and more like it to come! Cheers!
@@git-amend You need to leverage your skills as a senior software engineer. Most tutorials/ videos target beginner levels. I've been working through all of yours, and they're all really informative. I also note your consistent release schedule. Just keep at it, once you hit a certain number you'll hopefully get a lot more subs because this channel deserves it. My main advice so far is have a look at your thumbnails, the text is really important and I often see "3D" or "Shoot Em Up" really clearly but can't see the rest - I personally don't think 3D or Shoot Em Up should have been the most prominent words but would have clicked if I had seen Parallax or Player Controller. In this thumbnail, "Game Programming Patterns" was very clear. The fluent builder less so, but I clicked based on programming patterns. Anyways, the video and audio quality are excellent and you are presenting really well. Its more of a case of getting that youtube algorithm to favor you. I've subscribed, hopefully the high quality content continues.
@@phoenixfire6559 Thanks for the comments and constructive criticism - it's always welcome. I think you are right about the text; I'm going to make some changes based on that suggestion - thank you!
THANK YOU! I didn't know I needed this knowledge and it fit right into my project, cleaning up a bit of code. It was so cool and easy to implement the builder with interfaces despite its complexity.
Leave a comment if there is a particular programming pattern you'd like me to feature in a future episode - already planning Factory, Adapter and Mediator patterns. Hit the bell so you don't miss a thing!
Awesome video! Very well explained! I could definitely watch a playlist of 30 of these video tutorials about other patterns and good practices, it's so hard to identify when to use it, it always looks like magic to me...
I am so grateful that I found your channel! Really help me alot learning game programming the better way since I am learning by myself. This is an absolute gem
There are a lot of tutorials about how to make games, but very few about how to write effective and clean code! Thank you for that. I'll definitely browse carefully the content of your channel! A gold mine!
Hey, even tho you are not as popular as you should be, this channel is a true knowledge treasure for my level so i hope you keep uploading regardless of your views and subs. these are super helpful and your explanations are easy to understand. thank you I would love if you can cover Strategy , Command , State patterns as well
Depending on what you're doing, you could use what I call self builder, where you merge the builder and the class, so you could have a boolean ready, that you set once the class is set properly (can also have it read only and use an initialization method). That's useful if you need to modify the class a lot and you're not using inheritance, because the builder is somewhat redundant, because you need setters anyway. So instead of Var Eb=new enemybuilder() Eb.health=100 Eb.behavior=behavior.followplayer Var enemy=Eb.build() You have Var E=new enemy() E.health=100 E.behavior=behavior.followplayer E.init() (You can also use that with a fluent builder, where you return this, I did it that way for clarity as it's just an idea, this assumes properties which call setters with that syntax, which aren't available in all languages.) Otherwise you're juggling between 2 or 3 classes for basically no reason. Though where you'd want to use an external builder is if you need to enforce a "non null" (not necessarily null, but there's no desirable default) behavior, like for example, you want every enemy to have their hp or behavior set (could be more complex, like requireing either a sprite or a 3d model), an external builder can just return null, while with a self builder you have to check that it has been initialized. (I.e. with a builder you can't create a class with an invalid state, while with a self builder you can have one)
Great insights on the 'self builder' approach! It's a neat way to streamline object creation, especially when inheritance isn't a factor. Thanks for sharing this alternative!
I've learnt so much from your channel, some goes over my head like this one, I'll need to watch it a few more times, and try putting it into a project before I get the hang of it I suspect
This is great information! The video would be better if the audio were higher quality, and the intro was better (or simply removed). I don't see very many smaller channels, but the first thing I notice in smaller channels is the lower quality audio. I liked the video. :)
I'd be very curious to see your take on a Composite Tree or even a behaviour tree. I built an implementation after reading a blog post by the developer of Project Zomboid, however I've had some trouble finding great use cases for it. Fantastic tutorials. I really hope your channel gains some traction
Great video!, btw on 3:40 you wrote that we should consider initializing the Builder with a prefab but how is that done? what if your "Enemy" class is the prefab in question? Should I put the prefab as a parameter of the method Build()?
I would consider using a prefab if you have several components that are common to all of a particular type of thing, like an Enemy. So all Enemies might have the same mesh and colliders for example, and the prefab saves you having to create a new game object and set those for each one. You could pass a reference to that prefab as a parameter, and that way you only need to instantiate a version of that prefab with the additional settings you want set by the Builder. You could also have a factory that has references to many variations of Enemy prefabs that has a CreateEnemy() method - it might choose a prefab at random from a List, then use the Builder to do some additional configuration and return a ready to use Enemy.
Great tutorial. In the interest of completeness, could you suggest how you build from a prefab instead of creating and setting up a gameobject from code (as suggested in one of the on-screen tips in the video)?
Sure - you could either pass in the prefab as part of the constructor, or in the final Build() method. Here is an example: public class Builder { GameObject enemyObject; public Builder(GameObject prefab) { enemyObject = GameObject.Instantiate(prefab); } public Builder WithName(string name) { enemyObject.name = name; return this; } public Builder WithHealth(int healthValue) { var healthComponent = enemyObject.GetOrAdd(); healthComponent.SetHealth(healthValue); return this; } public GameObject Build() { return enemyObject; } }
There are 2 ways, and I have both but in the videos I use GitHub Copilot: github.com/features/copilot The other way is to use JetBrains AI Assistant: www.jetbrains.com/ai/ Both of these are paid plugins and cost $10/mo.
I'm used to Java at work and follow most design patterns. But I'm really struggling to use them with Unity 3D. I'm trying to build a minecraft like block system for my game and can't quite figure out a way to do this in a way that's very extendible. For now I'm just trying to figure out a way to create 100s of blocks in a way that I have a base block with all the properties for ex: isFlammable, isTransparent, textures (6 for each face) but I'd like a way to select uniformMaterialSetup, distinctMaterialSetup, topDownSidesMaterialSetup, etc. And then I just create 100s of prefabs? And store it somewhere, or in a way that I can apply a block type to any baseblock and it gets all the properties. I've explored scriptableobjects, OOP mechanics and patterns so far. But even in my head I can't build a proper architecure I'm happy with. Most of my struggles come from how the inspector interacts with classes and mesh vs code. Your videos have helped a lot after trying a lot of things for a few days, but I'd appreciate a guideline for how I should start thinking about this. Thanks a lot for these videos.
Thanks for the comment. I wonder if the Flyweight pattern might help you out with the blocks. By separating intrinsic data (e.g., textures, flammability) from extrinsic state (e.g., position, specific material setups), you can create a base block type and then efficiently instantiate and manage variations through shared data structures. The Flyweight can reference your base prefab. Then maybe a Factory / Builder combination to create all kinds of variations?
@@git-amend wow, I just started reading about this as I've not used it ever before and what it intends to do aligns very closely with what I want. I understand that in the end I will end up using most common patterns, but this is exactly what I was struggling with. What should be the outermost pattern if that makes any sense. Thank you so much. I will read more about this and comment back when I make progress.
@@bhaktijpatil Sounds good. I also have a video called Flyweight Factory that does something like this. The video is about projectiles, but you could do something similar for blocks.
Meh, the only think I really don't like about the "fluent builder strategy" that is done here, is that you end up coping the entire object that you want to build, having the builder return itself is the way to go, but without making a clone of the target object. So you don't have to duplicate everything. Quick example is to just add a new property like "isActive", so you have the get/set for the actual class, and now you have to duplicate everything in the builder, a new isActive property with also its getter and setters.
That's a good question, and a few people have asked if I will make a video about that - which I still need to decide. While I'm not happy about the actions of Unity management, I'm also not interested in watching it burn to the ground completely and potentially destroying the work of so many, especially those who make their living making tools for Unity. For the next few weeks at least, I'll focus on making videos that are more about software engineering principles, which are transferable to any modern programming language.
BUILDER USING INTERFACES IS SO COOOOOOLLL !! , I am a noob, and seriosly all of these patterns appears like magical recipies, is there some grimoire pattern , that contains all these patterns ??😝