Data models - using data to create extensible, maintainable games in Godot
Hello Godotneers! Every game revolves around data. Your game may have items, unit types, crafting recipes, dialogue, quests and a lot more. Handling all this with nodes can become quite difficult over time. In this video we are exploring how you can use data models to represent these game elements. We'll look at a simple implementation of making an item database and improve this by using Godot's resources to represent our game data. Then we'll integrate this data in our game to create a pickup, an inventory dialog and even a small crafting system. We'll also do quite a bit of UI work in the process, so there is a little bit of everything in here. Finally we're going to look into loading our resources dynamically (e.g. all items from a folder) and we're checking out an add-on that allows us to edit our item database like a spreadsheet. It's going to be fun ride, so jump in and happy Godotneering!
== Table of Contents ==
00:00 Introduction
01:18 A database of items
14:09 Using resources for game data
20:16 Building an inventory dialog
40:41 Creatin a crafting system
1:12:57 Loading resources dynamically
1:22:15 Maintaining a resource database
1:27:08 Conclusion
== Useful links ==
Example project if you want to follow along: github.com/godotneers/game-da...
Godot UI basics: • Godot UI Basics - how ...
Godot PCK Explorer: github.com/DmitriySalnikov/Go...
Godot Resource Groups Plugin: github.com/derkork/godot-reso...
Godot Edit Resources as Table Plugin: github.com/don-tnowe/godot-re...
Пікірлер: 287
As a backend developer used to Static typing and using lots of well defined design patterns, I can really appreciate that your approach feels a lot more like proper software engineering principles rather than just walking though how to write a snippet of code to do a task without any background on the choice. I love this approach. I would really love it if you did a video that covers properly how and why to use certain OOP design patterns in godot.
@user-qq4wb4rz7q
4 ай бұрын
As for the why it's almost a given this is the, let's say "strict and sturdy", way of doing things GENERALLY in programming and it's best if everyone knows and uses it for all things that are not prototyping or creating quick demos.
@gezbob3508
4 ай бұрын
@@user-qq4wb4rz7q exactly yes.
@Kio_Kurashi
4 ай бұрын
Right? When he went over the issue with the exported file I immediately thought of all of the tutorials that had this same kind of inventory system that never seem to mention it completely breaks once exported. Makes me super glad I watched the whole thing (though intermittently since he puts me to sleep. XD) so that now I can go fix that problem with my own resources.
@gezbob3508
4 ай бұрын
@@Kio_Kurashi indeed. Top quality and very well thought out,
@user-ub4hw4zo8s
4 ай бұрын
Where did you found here static typing
I’ve been in software development for almost 15 years, and I just want to say you have an incredible knack for teaching technology. People seriously underestimate the value in seeing the shortcomings of beginner/easier approaches to solving problems. You beautifully illustrate the process of growing and improving the implementation of an idea from “just getting something working” to a well-reasoned and robust implementation. I sincerely wish there were more long-form tutorials that followed this format. I always look forward to your videos and hope there are many more to come!
@MH-dn3jz
3 ай бұрын
Just saying yes, absolutely this. There is so much thought put into how these concepts are TAUGHT, it is hands down the most useful tutorials I've encountered. Way better than any of the copy/pasta "Do X in 10 minute" tutorials out there.
@GaryParkin
2 ай бұрын
Wow, I was going to say the same thing. I've been in development for way too long, prob 40+ years and I love a good instructor. Godotneers has it down. I can't wait to watch his shaders tutorial.
@willd2609
2 ай бұрын
10000% this!
As a senior software engineer with a lot of Python/Ruby experience and almost no gamedev experience, this video was fantastic! This video might be the first time I 'got' Godot resources and why they're useful.
@GaryParkin
2 ай бұрын
I agree. Resources are never taught as classes, and always glossed over like everyone knows what they are. I had to search through several videos to get what this guy taught me in a few minutes. If I wasn't subscribed, I would again.
"Container layouting" is the most Germanglish phrase I've heard in a while.
@Frank_G_Finster
4 ай бұрын
Denglish in German... for Deutsch English - Nice to know that there is an english word for that as well :D
@godotneers
4 ай бұрын
Well there has to be _some_ flavour in there. I learn and improve with every video. At least this time, the panel containers are less painful.
@NullUndefined1337
4 ай бұрын
It doasn´t matter what the anderen sagen XD ...."Container layouting"
@danielsantos3254
4 ай бұрын
Not just German. This is a common phenomenon in Taglish as well (Tagalog, from the Philippines). Probably the same with most places that learn English as a second language (or young children learning English as their first).
This is hands down one of, if not the best, easy to follow, very informative and fun to watch tutorial i watched in Godot. Thank you for sharing your time and knowledge.
I love how everytime I see one of your videos I think "THIS IS WRONG, YOU CAN DO THIS IN A BETTER WAY" and then you show the better way LMAO, really helpful!
Very nicely paced tutorial. I love it when tutors show a simple way (or different) to do things, then explain why that is not very good and then show a proper, more maintainable way to do it. Also, the on screen animations are very informative alongside the verbal explanation.
Quality over quantity. I really love ur content!
You are by far the best godot tutorial channel on youtube. The way you present your topics is very easy to understand.
Great timing with this video! After watching a few of your other guides I was beginning to research this topic, and it turns out you've just uploaded the exact video I was looking for. Thanks Jan
Bro, these videos are saving my a** because they're damn GOOD!! I was searching for more intermediate / advanced videos about Godot and even the video edits are AWESOME. You guide the viewer from going to an easy approach towards a more advanced approach, while explaining the process.
I was literally rewatching you last video. I'm so happy to see this notification, I always learn so much with your videos. I think that programming self learning misses a few spots and I am finding that you cover them very well. Thank you
You're my favorite Godot channel. Proper design patterns is so satisfying, and fixes a lot of fragility holes left by Godot's decisions, thanks for sharing !
Do you have a Patreon or somewhere I can try to help support you? This is one of the best channels for Godot on all of youtube!
@godotneers
4 ай бұрын
Thanks a lot for considering to support me! I have a Ko-Fi at ko-fi.com/derkork
These videos are so packed with good information and good programming practices!! It's honestly crazy
Man, you seem to make tutorials for just what I need right when I need them. I seriously appreciate your channel!
There is so much helpful information in this video. It's one of the single most helpful resources that I've encountered so far! Thank you so very much!
wow, what a grea tutorial! Really loving everything you've been putting out! Not enough tutorials that teach good practices like yours
You were so thorough!! I have been using godot for a while but your video has been a good refresher. Really good video!!
Excited for this one! I've really enjoyed your previous tutorials and as a long time non-game dev I've found myself itching to model some things without nodes. It'll be interesting to hear an experienced godot dev explain when and how to do this.
Thank you for the high-quality Godot tutorial content. Data Models are crucial for managing larger games.
This is incredibly serendipitous; I needed to tackle this exact problem and had a rudimentary version of an item system, but this tackles the whole topic! Thanks for another amazing tutorial.
Your tutorials are really top notch. Immaculately prepared and presented and I love that you show us pitfalls and how to overcome them and the reasoning behind the decisions.
It was a very very much useful, thank you!!! That is what i didn't expect from any youtube guide, it is very surprising to see so structurized, detailed, basical and useful material, thank you very much! That is what i really need right now!
This is very well made and informative. Methodical approach and dense with info about coding in Godot. Thanks for the hard work and making the info more accessible.
Thank you, this video was really helpful. The length is perfectly normal given the amount of things you showcase. Now that I've seen it once, I can come back to specific parts depending on what I need.
aaaand STILL, THE greatest godot tutorials out there, showing real best practices and actual architecting of complex systems. legendary stuff, keep it up!
This channel is the real deal. Good software engineering practices applied throughout, and the explanations are perfectly paced.
I thought I was going to praise the basics used in this guide, but it looks like I'm not alone - a backend developer beat me to it. So, for newbies who don't fully understand what's happening, in this excellent video, the author employs important techniques such as static typing, decoupling, and data encapsulation. These programming tricks may seem superfluous, but if you incorporate them consistently, you'll end up saving a considerable amount of time when you decide to work on a project that's more substantial than a game jam. For instance, static typing reduces memory usage and increases game performance because the system doesn't have to dynamically check data types. It also aids in debugging by preventing you from inadvertently sending the wrong data type.
What I like about this channel, besides the awesome presentation and explanation, are the topics. Imho they help building a solid and expandible foundation for my games.
Fantastic, extremely indepth tutorial whilst still being engaging and easy to follow. Thank you so much.
Amazing tutorial! Love the nice breakdown of everything and how you don't skip over anything.
Well this is an amazing tutorial not only about data structures but how to design your game in a scalable and maintainable way with less coupling and dependencies. The way you explain this stuff if easy to follow and grasp, thanks a lot.
This video was insanely useful! You explained this topic in an easy to understand way. I look forward to your future videos. Keep up the great work!
after just the first 20min of watching this, i already think it's amazing. very clear way of describing how to nicely implement static data like items, while including the reasons WHY this is a better way than just writing them into a script. excited for the rest of it.
Absolutely astonishing work. Great and very helpful video. Thank you, my friend!
I love the visual indicators you place over the code, like when you print from on_item_picked_up. As a novice programmer, it helps to reinforce what part of the function's code corresponds to the object's properties. I wish more tutorials did stuff like this! I also like that you have an indicator in the bottom-right showing which scripts are onscreen. Great stuff!
Nice little medley of good design tutorials. Thanks!
Didn't even notice that one hour had gone by. Clearly explained, really cool that you showed the shortcomings too. Also, the editing must have taken some work too, good job. This kind of more intermediate subjects for higher scale projects are scarce out there, keep it up!
I've been watching game design and coding tutorials for something like eight years, and yours are hands-down the best I've ever seen. (With some stiff competition!) I think my favorite thing that you do is when you show onscreen what parts of the code you are calling to when you are writing a function call or referencing a parameter on another script. It really helps tie it all together so that the viewer doesn't get lost.
My goodness what an excellent video! This is so well put together. I love how you explain the logic behind what you're doing and really focus on the core concept - how to model data - instead of just focusing on the "tutorial" aspects. It feels like the inventory/crafting systems are just demonstrations of real world applications of the principals you're trying to teach, which is INVALUABLE in this context. Unless you go to like, actual proper college for software development, learning these kinds of concepts is actually really difficult, because most of the information available to newbie game devs is of the "how to make x (tutorial)" variety. Thank you SO MUCH for making this. The production aspect of this video is also really well done. You present everything so clearly, and the video is really well paced and scripted. Watching it made me feel like I was back at university, in a good way. I'm a web dev mostly, and I knew I needed a better solution than "ten thousand dictionaries" to handling data in my game, but I really didn't understand what tools Godot did (or didn't) offer. This video was exactly what I needed. I really cannot thank you enough.
Every intermediate level tutorial is always very much appreciated. The pool of potential viewers is smaller and thus begginer tutorials are generally more reqarding to make, so It's difficult to find resources to move on from a beginner stage... So thanks for this!
Fantastic work on all your videos; they are incredible and I really appreciate the quality of your instruction. Thank you so much for all your hard work!
This video is so good, it transcends the topic of game development, this concepts can be applied in many software solutions, i love it! SUBSCRIBED!!!!
You are a natural teacher! This is fantastic and easy to follow.
I am not through the entire Video, but your way of explaining is so good and that you show what script you are talking about makes it so much more understandable! Keep it up :)
This is wildly close to how I am doing my game's inventory, but I learned several things I'm totally going to steal to make it more modular and less buggy. It's currently capable of duping items under certain conditions, and the fixes for those are "adds more spaghetti", but you showed me a few things that can circumvent the need for all that and solves my problem much more elegantly. Thanks a lot for this!
I already have an inventory for my game, but this video was really fun to watch... learning in a relaxed way with a cup of tea... :) - Thank you very much.
Hands down one of the best tutorials I've watched!
This topic is exactly where I got stuck in planing how to code the game. Thank you very much good Sir!
Just stumbled across this video, I’m a beginner to godot and game dev in general and this was a super clear and awesome tutorial. I feel like a learned a lot from this
holy smacker-doodles, thanks for the level up Godotneers!
you are the best teacher, demostration, examples, resolutions and clarifications, dam, Master
Fantastic job here! You have gained a subscriber and the first time in a long time that I was excited to click that notification bell. Looking forward to more.
Thank you so much for the amazing video! I've always been looking for a tutorial like this that explains in detail on how to structure data and yours is so good T_T I finally learnt what it's called!! Data models!!
This is one the best videos i've ever seen about godot. Thank you so much!
6 years in software development learning everything I know through YT and StackOverflow... you tutorial is THE best I ever enjoyed.
You are a blessing for the Godot community!
Your tutorials are the best man. Keep up the good work!
You have the best godot tutorials ever, also State Charts is incredible!!!
Yeah a new Godotneers tutorial. This topic is what I've been looking for!
Thanks for this video. Learned a great deal that feels like it's going to be extremely useful.
Thank you very much for this video! I have had a professional career as a software developer, but recently I have decided to get into game development. I have chosen to use Godot, since it works so nicely in Linux and also GDScript was really easy to learn since it's so similar to Python. I much appreciate your systematic approach and use of good design patterns. A lot of other tutorials have a more haphazard approach that's less understandable for me who is used to using design patterns to keep things maintainable and scalable.
I turn off my ad block to watch your videos and click on the ad too to help. Keep going sir!
I love all the video and it's super helpful. I'd say the best tutorials out there. My suggestion: Short videos to refresh my memory on individual parts like resources, array, etc.
Thank you very much! This was great to follow and a really nice concept to implement. subbed!👍
This is awesome, thank you for your high quality teaching abilities.
Really nice approach and one that I will be using from now on :D
Thank you for sharing this, you are doing an amazing job with your content, this is really valuable
I was maintaining my game actor definitions through a dictionary like you showed at the start, this resource maintaining method is so much better, will be porting all my static data to these formats
As a former senior software engineer and having watched 3 of your videos all the way through (I never got to write any games during my career :( ) may I just say that your explanations are some of the best I've ever seen for any topic. I look forward to more !
A great tutorial, I find it somewhat hard to find more intermediat/indepth tutorials regarding godot other than begginer ones. Hope to see more!
Wow i love the teaching style. Thanks a lot for this to be free.
In my first attempt at learning Godot I ran into the issue of the exported executable not finding my dynamically generated and loaded resources. I spent hours searching the internet and trying ugly hacks that simply did not work. I ended up rage-quitting Godot for several months while I worked on other projects. I wish I had found this video and used your Resource Groups plug-in the first time around. And not just this video - I'm on attempt #2 to learn Godot, and I found and watched several of your other tutorials. I had followed another KZreadr's tutorial on FSMs and implemented them by hand in GDScript. I watched your video on using the Finite State Charts plug-in and now I'm going back and ripping out all of my old FSM nodes to replace them. It's a similar story with my UI after watching your UI video. I want to echo the comments that people leave here: these are the best Godot tutorials on KZread by far. I wish I had watched them first after getting the hang of the basic Godot interface. Thanks for putting these videos together! I'm sure it's an enormous amount of work.
This channel is a jewel for all Godot users, a thousand thanks !!
Super interesting to follow. I think every Godot dev should learn about this topic
This is an exceptionally good tutorial. Thank you very much!
oh hell yea, I was wondering when a new Godotneers would drop. Can't wait to watch.
Thank you for the tutorial, amazing teaching skills. Good explanation, clear, really good. Just thank you.
Thank you! No one else explained it broken down like this.
Wow, its so comprehensive yet its perfect for beginner because the way you explained the concept with slow-paced and structured way. Although overly long for youtube video, but its never boring because the comedic illustration, best tutorial on Godot Can I make request on upcoming tutorial about hexagon grid movement system, because no many Godot content about this concept, thank you !
I just love your teaching style. Your tutorials on Godot are by far the best ones I have found.
this info is exactly what i need for my project.
I´m impressed ... oO very good tutorial, clean and perfekt explained XP I used godot some years ago ... maybe I will give it another try ^^
Legend, these tutorials are super useful!
one of the best godot's custom resource tutorial in existence.
Top video. Custom resources are my fave use-case, essentially ScriptableObjects or (almost) DataTables from other engines (even the godot manual says so!). As soon as there's some common element between actors, it's time to break out the Resource template!
Dude you're an amazing teacher, thanks!
On ther first minute of the video I already know that I want to watch it. Thanks for the amazing video (that I don't even finished yet) I'll finish it later on at home.
I love you channel, your teaching style is the best. Thank you so much
Legend. Great video brother.
You're a boss, keep up the work, your channel is goldmine. Just a little trick for the Access has scene unique name. It help if you move your nodes around but not if you rename them. In godot 4 you can use @export var node: type and drag the node in the editor. It's a bit tedious to get used to it and need a few more click but if your game grow and you tend to refactor a lot it will save some pain down the road. Although for small projects, onready vars are fine.
so clean, very very cool, thank you!
Please continue to make these and do take time to make them. Its great that they are once a month as it allows me to try them and also explore them.
Not only do you have a great way of conveying information, but the information you are teaching is done with proper programming practices and not just the quick and dirty way! Why do you not have a patreon or something?!
❤ I’ve been so excited for this! Great topic. This is going to be gooooood!
Perfect video at perfect timing as I'm working on same thing and it's nice to see how others do that. Really glad that my approach is architecturally the same. I had problem that Item scene had colliders and Resource and having same scene inside Resource is not allowed (Godot loops and explodes). I tried to have just a mesh, but it did not work. Somehow having just Mesh scene did not hit me :) Glad that there is not much to refactor.
Great explanation! You definitely need to do more videos!
Excited to watch this
As someone with ADHD who grew up with starting at Program.Main and having the main game logic loop check for when a player interacted with an item, using a systems pattern basically, and was struggling to figure out how to structure everything with nodes instead this was INCREDIBLY helpful. I've been trying to sort out how to deal with stuff like picking up items, and other node interactions, and was trying to figure out ho to get all of that on the different nodes (player, npcs, etc). Didn't think to just have the logic on the item nodes and have them deal with the logic of picking up an items, or be an extension of a best data model for that matter as I'd usually just pass that into a system the main loop would deal with, not the item node itself. Thank you for the good tutorial.
@bwah9481
4 ай бұрын
Ahh.. Program.Main. I remember those days.