RPG Items in Godot Engine!

  Рет қаралды 27,908

Jacob Foxe

Jacob Foxe

Күн бұрын

Пікірлер: 47
@jacobfoxe4691
@jacobfoxe4691 7 ай бұрын
Hey Friends! Fair warning: This tutorial is a bit outdated! At some point, I'll get around to making a Godot 4+ version, but for now, I'd recommend checking out my video on the new Export syntax in Godot 4 to get started with some of the new data exporting rules! Thanks for the continued support! Let me know if you'd like to see this or any of my other older tutorials refreshed for the current Godot 4 landscape!
@domenbaumgartner8765
@domenbaumgartner8765 7 ай бұрын
Still a great video for learning the concepts, looking forward to seeing the updated version to use in my games.
@LowPolyPixel
@LowPolyPixel 2 жыл бұрын
This was the tutorial that I didn't know I needed. While I'm not making an RPG, this has so many use cases and now I've got ideas! Thanks for this.
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
Glad you found it helpful! Resources are SO powerful, regardless of the application! It’s a bit annoying that you can’t export custom classes (yet), but hopefully that’s resolved in 4.0. Cheers!
@TheLateAdopter
@TheLateAdopter Жыл бұрын
Once he said, "lets zoom in a little bit so its easier to see", I was liek, "THANK YOU!"
@_gamma.
@_gamma. 2 жыл бұрын
Great tutorial! HeartBeast has a couple videos where he compares them to “scriptable objects,” which is really where the structure shines IMO. JSON or CSVs can’t really compare. One neat thing I’ve been playing with are creating base “Item” scenes that allow me to set a resource in the inspector. It’s pretty much like your item scene in the video, but for the world instead of an inventory. Makes placing items around my levels super easy! Thanks for sharing the tutorial, looking forward to more!
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
Thinking of Resources as Scriptable Objects is perfect! Heartbeast's video is what got me so interested in Resources in the first place - lots of love to him and his channel! I love that idea of creating Item scenes to be placed in the world, too! I use something like this in my current game as a wrapper around my Item Resources (a la export(Resource)) and setting up the item in the inspector OR dragging an already-made one into that Item Scene Instance)! Thanks for the comment!
@slothinahat
@slothinahat 2 жыл бұрын
Yep same. I’m also using a base item which just reads properties from the resource while in game. It’s so much better than creating individual scenes.
@Playburger1337
@Playburger1337 Жыл бұрын
Depending on your Godot version, you may run into error very early when try to code along. Starting using godot 4 there are errors when trying export or @export the very first variables. var ITEM_NAME is okey - no error, as well as @export var name: String = "" no errror ! :) It takes a while to search but u will find links for both old and new engine commands.
@KiyoshiArtworks
@KiyoshiArtworks 7 ай бұрын
ty
@andrewmartin5183
@andrewmartin5183 2 жыл бұрын
Thanks for the tutorial, the idea of using extends to create the different item classes while still sharing functionality was exactly what I needed ☺
@willigoen
@willigoen Жыл бұрын
So nice!, thanks for this bro! Very illustrative keep going!!!
@canismajoris3959
@canismajoris3959 Жыл бұрын
Thank you so much for this tutorial! I've been struggling with how to construct an item database of sorts. My current implementation uses one big singleton that contains every item and it's various parameters, but this seems much better!
@tomtomkowski7653
@tomtomkowski7653 2 жыл бұрын
Hi, I'm really curious about this workaround about cyclic dependency with singletons you were talking about here 3:50
@FerreusDeus
@FerreusDeus 2 жыл бұрын
I got a little lost on the latter half but this was very helpful. I'm still wrapping my head around resources vs scenes and how resources are integrated. My item class is HIGHLY similar but extends nodes. I then make a scene for each item. I need to understand resources better.
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
No problem - there's a lot going on behind the scenes, and the difference between some of the object types can be pretty fine. In general, you can use exported variables in nodes or resources (or any other object that extends from the Object type), so it's not necessarily wrong to use nodes. However, using 'extends Resource' in your script allows you to create instances of that resource from the editor window very quickly (these are the .tres files). If you're familiar with object-oriented techniques, creating the Resource script is like defining a class, while creating a Resource of that script's type is like instancing that class. With these .tres files created, you can then call on them in your code to load/save data quickly, and you can easily change all types of information!
@FerreusDeus
@FerreusDeus 2 жыл бұрын
@@jacobfoxe4691 It seems extremely handy and clean. The way I was doing it, I couldn't attach a second script, so I didn't know where to add the functionality for individual items without adding it to the general item script and I intuitively knew that wasn't best practice. Thanks for taking the time to respond to me.
@mvolkankarakas
@mvolkankarakas 2 жыл бұрын
u r right that the video is long. however the resource is a deep subject. now I am aware how the links works amongst the godot class structure. u r a good tutor. please go on with your way. thank you indeed.
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
Thanks for the feedback! I'm glad you found it helpful! :)
@colemangentry4186
@colemangentry4186 2 жыл бұрын
Thank you! This is just what I needed.
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
Absolutely! Thanks for stopping by! :)
@Slipping_thru_the_Seams
@Slipping_thru_the_Seams Жыл бұрын
this looks really exciting!! im a total beginner rn hope to learn to apply this stuff soon. I've never done any coding before LOL
@TheLateAdopter
@TheLateAdopter Жыл бұрын
Thanks for the video. Very enlightning. I did watch the end credits as well :), and I'm suprised that there arent any game dev videos of the game. The marketing wont happen by itself when you release the game. You need to build a fan base and hype. Create gamedev / showoff videos of the game atleast a year+ before launch to get some traction. (I havent seen any of your game videos. Maybel Ive missed something)
@OldSwampo
@OldSwampo 11 ай бұрын
Great tutorial! Anyone who has played around with unities scriptable objects has played with this kind of data driven design. One pitfall that I think should be mentioned is the danger of storing actual runtime data in your item data. I might have just missed this section in your video, but with this current set up, it seems that you would run into issues when different inventories have the same item type. For example you have 4 cookies in your inventory and a shopkeeper has 5 cookies, with your resource storing the quantity both you and the shopkeeper would be accessing the same resource and therefore the same quantity. There wouldn't be an easy way to buy a cookie, therefore reducing the shopkeepers quantity by one and increasing your quantity by one since they are the same variable. I think the easiest workaround would be to either store the quantity in a separate inventory management script or create an item node which references a resource for all its consts but holds all its variables separately so that any number of them can be instantiated without them interfering with each other.
@starbirthcalamity
@starbirthcalamity Жыл бұрын
Your voice has captured me. I am working on an interesting variation of an RPG, and your perspective would be valuable. Obviously you have your own project so I don’t expect any interest, but I’d hate myself I didn’t at least extend the chance to work with you. Now I will finish your voi- video.
@Unknown-sr6tl
@Unknown-sr6tl Жыл бұрын
Keke's the real goat fr 🎵🎵
@visibletoallusersonyoutube5928
@visibletoallusersonyoutube5928 2 ай бұрын
For Godot 4: The syntax for exports is like this @export var my_item : Resource I had to change the item_sprite script quite a bit. Here it is. Mind you I don't use the same naming conventions as him so it won't directly port over but you should easily be able to see the pattern in what needs changed. extends TextureRect @export var my_item : Resource: set = _set_item @onready var my_label = $RichTextLabel func _ready(): if my_item: _set_item(my_item) # Initialize the item if it is set from the start func add_quantity(amount_added : int): my_item.add_quantity(amount_added) _update_label() # Ensure the label is updated func _set_item(new_item : Resource): print("setting item") my_item = new_item self.texture = my_item.get_texture() _update_label() # Update the label with the new item func _update_label(): if my_label and my_item: my_label.bbcode_text = str(my_item.get_quantity())
@viewerck
@viewerck Жыл бұрын
so good this tutorial! 10/10
@Grimm-hb7ek
@Grimm-hb7ek Жыл бұрын
This is a really great video
@kingveneer9380
@kingveneer9380 Жыл бұрын
does setget work differently in godot 4? managed to get most of it to work using your video about the new syntax, but I don't think you talk about setget
@TommCC
@TommCC 5 ай бұрын
How did you approach the inventory singleton? I tried to make one and I created a dictionary to store all items and a function to load them when one is added but Im pretty sure there should be a better way to do it
@slothinahat
@slothinahat 2 жыл бұрын
I’m already using resources for my items, but I really like the idea of separating them into types of item. Finally my sword item won’t have a place to instance placeable objects Quick question though, if I had the line if inventory_item is ITEM: (ITEM being the class name), and it was talking about say the cookie which is a food_item which inherits from the ITEM class would this still return true?
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
Thanks for checking out this video! I did a little test to confirm this behavior just now: -> "if cookie is ITEM" Returns TRUE because its class (FOOD_ITEM) inherits from the ITEM class. -> Likewise, "if cookie is FOOD_ITEM" ALSO returns true. This is typical behavior for object-oriented languages (like GDScript, and C++ that it's built on top of), and any classes that inherit other classes will also possess those member variables, functions, and un-overridden behaviors. Cheers!
@Fred-ju1xs
@Fred-ju1xs 11 ай бұрын
New to Godot. why did you need the pointer for the get_texture func at 15:45? Godot type casting doesnt cover pointers to textures?
@ArabGameDev
@ArabGameDev Жыл бұрын
stardew valley music fits perfectly
@hozerino
@hozerino Жыл бұрын
What's the best way to insert, in those items, some properties that are more "instance-local"? For example a "condition" property in the ARMOR_ITEM, that transfers between the inventory item, the dropped item and the equipped item. What would the best solution be? I can't find a sweetspot
@McHumaty
@McHumaty 11 ай бұрын
Could I fill in the resource fields with information obtained from a database? 5:16 And if my armor has a specific ability, how should the code be constructed? 9:26
@FinrodIngoldo142
@FinrodIngoldo142 2 жыл бұрын
Great tutorial and very helpful actually, but could you clear something up for me? Where do you put the function that gives the item it's action? For the cookie to restore health, do you put the function in the base Item class, because the cookie resource itself can't hold the function, right? Then the cookie would hold the parameters such as amount restored, single target, etc that are passed in? And the function itself would get called somewhere else, like in the battle scene or inventory screen? Do you use if statements to sort between functions then for restorative items, battle items, equipment (which you wouldn't eat to restore health)? I'm new to programming and Godot, so I'm trying to piece this bit together. Thanks!
@jacobfoxe4691
@jacobfoxe4691 2 жыл бұрын
Hey Christopher! Yeah, different classes of Resources can hold their own functionality (and override those of their parents)! I just released a video about it if you'd like to check it out, and you're welcome to ask again if you need further clarification! Cheers!
@FinrodIngoldo142
@FinrodIngoldo142 2 жыл бұрын
@@jacobfoxe4691 Thanks! I'll check it out this morning. It's really been puzzling me.
@BartoszBielecki
@BartoszBielecki Жыл бұрын
Godot 4 definitely has exportable custom resources. It's too obviously missing piece for remotely data-driven system.
@zrabatah
@zrabatah 7 ай бұрын
In Godot 4.1 I tried this twice and each time I get to 17:25 and try and put in the white_shirt.tres I don't see the white t shirt in the editor. I did make my own white tshirt PNG, but I didn't do anything unique with the picture and it should be showing up. Did anyone else get stuck here?
@jacobfoxe4691
@jacobfoxe4691 7 ай бұрын
My guess would be a mismatch on the editor version - the syntax in this tutorial was for Godot 3.2 (I think), and it's a lot different for Godot 4+. Otherwise, I'd check to make sure you're exporting the right type of variable to drop-in the PNG. Let me know if that points you in the right direction, or if that just made for more questions haha
@zrabatah
@zrabatah 7 ай бұрын
​@@jacobfoxe4691Well I found out that the $RichTextLabel.bbcode_text = newItem.getQuantity() has the RichTextLabel null when that line is run. For some reason the label is not being created in memory before that line of code is executed. Not familiar enough with Godot, but not sure why the child node is not being created when the ITEM_SPRITE code is running. Maybe someone else knows why this is happening on Godot 4 and not in Godot 3. I can try and load the project in Godot 3 to see if it works there. Also the bbcode_text seems to have been removed in Godot 4. It is still possible to toggle BBCode enabled in the editor, but the syntax no longer exists in the scripting editor. I was able to get this working by redoing it in Godot 3, so I must be doing something wrong in Godot 4.
@Nomarr
@Nomarr 11 ай бұрын
😀
@Rai2M
@Rai2M 3 ай бұрын
Um... good luck with dealing with hundreds (thousands) of unique items/characters.
@GrumpyIdiot
@GrumpyIdiot Жыл бұрын
pleaceeee make a full inventory system i really need that
Convert Resources to CSVs! || Godot Tutorial
28:27
Jacob Foxe
Рет қаралды 4 М.
I Made Minecraft in Godot
28:36
RachelfTech
Рет қаралды 57 М.
ЭТО НАСТОЯЩАЯ МАГИЯ😬😬😬
00:19
Chapitosiki
Рет қаралды 3,7 МЛН
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,4 МЛН
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 53 МЛН
Google Sheets to Godot
14:23
Queble
Рет қаралды 10 М.
You should use Enums! || Godot Tutorial
23:09
Jacob Foxe
Рет қаралды 14 М.
Tierlisting the BEST (and worst) GAME ENGINES
33:51
BiteMe Games
Рет қаралды 228 М.
My Experience Moving to Godot from Unity
16:54
DarkDax
Рет қаралды 28 М.
We made Vampire Survivors BUT in 10 Lines of Code
7:08
PlayWithFurcifer
Рет қаралды 1 МЛН
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 378 М.
INVENTORY & ITEM SYSTEM in Godot
50:30
Code with Tom
Рет қаралды 56 М.
Godot 4 - RPG Inventory System From Scratch
1:17:35
DevLogLogan
Рет қаралды 133 М.
ЭТО НАСТОЯЩАЯ МАГИЯ😬😬😬
00:19
Chapitosiki
Рет қаралды 3,7 МЛН