Using Composition to Make More Scalable Games in Godot

208,573
0
Published 2022-12-24
Ever heard the phrase "prefer composition over inheritance" but don't know what it means with respect to Godot? In this video, I cover how I use composition in my game to create content in an efficient and robust way.

📰 Sign up for my newsletter: firebelley.com/

📖 Learn Godot with my Udemy course: www.udemy.com/course/create-a-complete-2d-platform…

🎮 Pick up one of my games:
store.steampowered.com/search/?sort_by=_ASC&develo…
store.steampowered.com/app/1330940/Sword_Slinger/
firebelley.itch.io/sword-slinger

➡️ Follow me on Twitter: twitter.com/firebelley
➡️ Steam: store.steampowered.com/search/?developer=Firebelle…
➡️ Itch.io: firebelley.itch.io/

#Godot #gamedev

All Comments (21)
  • @TS-by9pg
    This! I'm a web developer, and I was scared to start a game dev project because I didn't understand what the architecture of the Godot project should be. Some YouTube videos recommended inheritance, but that seemed so clunky to me. This video is just what I needed. The community needs more videos like this. That focus on teaching you how to build a complex project in a right way, and not just simple step by step tutorials.
  • @Fupicat
    Just the first 5 seconds of this video are probably the best piece of advice for Godot ever: you should think of your reusable nodes as if you were extending the engine itself. This way of thinking has made working in Godot so much quicker and more fun for me!
  • @nrwl23
    Single Responsibility Principle, where everything should only do one thing well in its own specific context. Excellent explanation of how this works. Very useful, thanks.
  • The best instructions/instructors teach you a way of thinking. A lot of programmers are trained in the OOP paradigm (myself included), so inheritance feels "natural" at first until it turns into a complicated mess. This makes a lot of sense to me, and it emphasizes breaking down a big project into smaller manageable pieces, like building a room-sized skyscraper in Lego.
  • @Algardraug
    This is actually beautiful. Pure art in software architecture form
  • @kiyasuihito
    Love it. Godot has made me a firm believer in the concept of composition in software design, not just in games but also in the regular applications I help make at my job. One thing I found also to be nifty about Godot is being able to use Resources for much of your business logic. It makes it super easy to make unit tests by just making a scene with a single Node and give it the Reaources you want to test in its script... I'm geeking out. Godot is awesome.
  • @NautiluStudios
    I've spent basically my whole computer engineering career in an inheritance mindset. If you asked me, I would composition for godot was too busy. So many nodes for each little thing in each entity, for example. Inheritance melds better with how my mind works. That's why I think unity was so hard for me at first. My godot project is VERY inheritance based. I ignored all composition advice because I thought (and it's probably true that) 'I can do this with inheritance, whatever.' After watching this, I’m questioning everything lol. Great video!
  • @nERVEcenter117
    This might be one of the best videos I've seen for understanding how Godot nodes can and should be organized, period. You gave several use cases and examples that demonstrate the composition of disparate simple components. I've been a functional programmer for a long time, and understand composition from a raw software engineering POV, but Godot's node hierarchy in particular was confusing me: How do I know which node should be the root for any given component, and which should be composed "properties" of that root node? You've helped me piece it together from a higher conceptual level than any "Here's what all the nodes in the engine do!" video.
  • its always good seeing these kind of tutorials for godot bc its generally easy to get started but building good pratices comes a long way to organize the project and one day finish them.Good stuff.
  • This makes more sense to me, thank you. The issue I have with inheritance is that I'm not sure what common data a given base Object/Entity will need before I start exploring possible mechanics/variables, so I end up swip-swapping stuff around until it makes sense. The nice thing about this component approach is that you can manage the grouped data a bit easier in the scene tree. Lately I've been struggling with where to put custom Resources, because you can make a Resource "local to Scene" and mutate the variables away from their defaults, however, I feel like that could get out of hand quickly if I forgot which Scene changed things around.
  • This makes a lot of sense. It also creates a lot less spaghetti and what you might call "over building" than just inheritance.
  • @vidvad
    Very useful tutorial. I've been using composition for a couple of my nodes. I found it tedious to create at first but it makes creating new content later much faster and easier. I picked up a few tips from your video, thanks for sharing :)
  • @renzs18
    I was used to inheritance and it always brings me to a block when I have to make it a little different from its usual behavior. Looking at your video feels like this is a solution for my game so I have to save this video and keep watching this until this sticks to my mind. Although it is a little frustrating to start again from the start using composition but I think its worth it in the long run.
  • @NonUnknownDev
    Dude you rock!!! what a nice tutorial, I mean I know about composition, but you have opened my mind a lot for this!!!
  • @ShiloBuff
    Wow. These are the concepts I want to see more of for game development. It's a slightly older video, but it's still very relevant and important to using a proper scalable system. I would absolutely love to see more content like this.
  • @user-tn1ff6ic7k
    This is so well put together. Just spewing pure gold constantly, no time wasted. Well done sir
  • @JackKell100
    This video was extremely useful and this type of game architecture content is worth its weight in gold. Keep it up!
  • @PSPbrtag
    I started your course yesterday and found your channel right now by accident. You're a great teacher and I'm glad to be your pupil :)
  • @jkf16m96
    amazing video, this is exactly the kind of design i was looking for in my game. I just didn't grasp exactly how to make this kind of composition to also use godot features. With this I can make my game, you have my like and subscription