so far this is the best video I've seen on resources. Great intro and very thorough, while not wasting any time at all. This is the resource video I needed. Thank you. Good editing too. I hope your channel grows.
Great video! Right to the point, clear and easy to understand, and gets the value demonstrated in a great way. Switching from Unity I really missed scriptable objects - then I discovered how similar resources are.
@@queblegamedevelopment4143 Now if I can find a view on how to keep the scrollbar at the bottom... I spent 2hours plus today and using chatgpt, couldnt do it.
This was really clean. Could you make a video about signals in custom resources? Would be great to manage all stats in a single resource, or possibly across multiple resources that handle different stats, but was wondering how these would communicate with each other considering what you said about not having _ready function etc.
Me and a friend are messing around with building a card game, this seems extremely useful for that! I could define hundreds of cards as resources and have a script that realises them as gameobjects
Thank you for the video , a question i have , lets say you are doing a run in a game , and you get items that increase your health , dmg and defense in the resource , if you die , how do you reset the resource to default ? For some reason its not resetting for me and the player can keep getting more health in each run etc!
So if the resource is saved externally (you're loading a resource each run), you'll need to call the duplicate() method on it. This is so that the saved resource is acting as the default, and you're duplicating the reference for the actual data that's being used
@@queblegamedevelopment4143 Thank you! But it still doesnt stop the data from going back to default , the player is still getting the past stats new default on a new run
Do you have a default resource saved to your file system? Loading that at the start of a run (and duplicating it) should achieve this :) EDIT: are you trying to keep the save data, or refresh it to default?
@@queblegamedevelopment4143 yes the resource is saved in the file system , i load it by doing @export and attach it , i tried doing stats. dup on _ready but it still between runs keeping the stats
Thank you! Can this also be used to store level strings like used in games as Sokoban (...####.../..#--#####/###-.#---#/#@--$----#/#-##*#####/#---$--#../###-.--#../..#--###../..####....) and then be loaded to populate the level?
I have a question. I want to have a var texture in a resource and set the texture of a node inside its script. I tried it with texture = stats.texture but it doesn't work. Am I missing something?
I have managed pretty much the same functionality with just Global scripts and classes. Im failing to see any major advantage by using custom resources (compared to my approach) or maybe im just still not understanding custom resources completely
I'm not sure how your globals are setup, but for example, with a custom resource you could pass the same resource to anything and that thing can independently determine how to handle it. Like with an attack, it could have knockback, and fire damage. Things immune to burning can discard the burning aspect, things with knockback immunity won't be knocked back.
From what I understand, the trade off for how easy it is to use resources for save files is that it opens a vulnerability that allows people to inject code into the user's machine. It's much safer to use an encrypted JSON file for saving and loading.
@@queblegamedevelopment4143 Well... This is embarrassing. I've watched those. And it was you explaining to me how the resource loader could potentially be misused. Your "SECURE saving in godot with encryption" was what taught me how to implement a save system that I feel comfortable using.
Oh haha 😅 Maybe I'm remembering a comments discussion I had with someone lol So I was going to talk about the situation in this video, but it would have added an extra 5 minutes so I cut it out. Basically the situation is: - if you have a single player game, or any game where players don't share files (e.g. the steam workshop), then custom resources are not harmful. This is because the only way someone could get a malicious file, is if they downloaded it from an external site. In this case, the error would be on the user, since malicious code could be downloaded even if the save files weren't formatted as custom resources. - if you did have a game where players shared files via the Steam workshop or something similar, then yes, custom resources would probably be a security risk. You could technically code in a quick check to see if the files are formatted properly for loading (check for extra function names of code), but this would be a valid place to refrain from using custom resources. Hopefully that clears things up :)
Inheritance doesn't work the way you explained it. An object class doesn't need a defense if not all objects do. A sign can inherit from object making it an object but it could then have a defense. Example: Object - name - desc Sign :: Object - now has all of object - defense This means Sign technically looks like: - name - desc - defense
I did try to explain it that way? My point was having: Entity: - attack - defense Player :: Entity (Has stats) Sign :: Object (doesn't have stats since I wouldn't want sign to inherit from entity since the entity class would typically have other methods irrelevant to a sign) So yes, you technically could have both the Sign and Player inherit from Entity (both would then have inherited stats), but this would mean your movement logic would probably need to be a component. In that case, you'd already be favoring a components structure, and a stats resource would make more sense to keep things modular. I guess my explanation on the subject could have been unclear, but I hope this clears it up :)
First
so far this is the best video I've seen on resources. Great intro and very thorough, while not wasting any time at all. This is the resource video I needed. Thank you. Good editing too. I hope your channel grows.
Thanks for the feedback! 👍
Great video! Right to the point, clear and easy to understand, and gets the value demonstrated in a great way.
Switching from Unity I really missed scriptable objects - then I discovered how similar resources are.
Finally a tutorial that explains how to add it to the object itself. The other tutorials were outdated.
I didn't used them now, but when i need them i will remember this video. Thanks
Just want to say this was a great tutorial, the simple way you show examples really helped me wrap my head around the concept and use cases, awesome!
Thanks, i was really needing this tutorial, i watched many but i didn't get to understand the concepts completly, but thanks to you i know it now :)
Clear, concise and straight forward information. Resources are much more clearer now and their use-cases are brought to light, thank you.
Good video, good design of a video. It is short, focuses on one specific topic, no wasted words.
Thanks! I'm glad you liked the format!
@@queblegamedevelopment4143 Now if I can find a view on how to keep the scrollbar at the bottom... I spent 2hours plus today and using chatgpt, couldnt do it.
This was really clean. Could you make a video about signals in custom resources? Would be great to manage all stats in a single resource, or possibly across multiple resources that handle different stats, but was wondering how these would communicate with each other considering what you said about not having _ready function etc.
I like your videos, thanks ❤🎉
Me and a friend are messing around with building a card game, this seems extremely useful for that! I could define hundreds of cards as resources and have a script that realises them as gameobjects
imagine writing each on its own lol
Thanks for this, made some of my code much more reusable!
I do use resources for saving, mostly user preferences and game data so far
good tutorial.. explained in easily understandable manner.. thanks
this is really helpful, thanks for sharing
very helpful!!! thanks!!!
incredible vid. opened my eyes. and now.... i got so much to change bahaha.
What are some best practices when using this as a save file?
is it possible to make a recursion between the resource and the scene? If so, how can I do that without causing issues?
Thank you for the video , a question i have , lets say you are doing a run in a game , and you get items that increase your health , dmg and defense in the resource , if you die , how do you reset the resource to default ?
For some reason its not resetting for me and the player can keep getting more health in each run etc!
So if the resource is saved externally (you're loading a resource each run), you'll need to call the duplicate() method on it.
This is so that the saved resource is acting as the default, and you're duplicating the reference for the actual data that's being used
@@queblegamedevelopment4143 Thank you!
But it still doesnt stop the data from going back to default , the player is still getting the past stats new default on a new run
Do you have a default resource saved to your file system?
Loading that at the start of a run (and duplicating it) should achieve this :)
EDIT: are you trying to keep the save data, or refresh it to default?
@@queblegamedevelopment4143 yes the resource is saved in the file system , i load it by doing @export and attach it , i tried doing stats. dup on _ready but it still between runs keeping the stats
cool
Thank you! Can this also be used to store level strings like used in games as Sokoban (...####.../..#--#####/###-.#---#/#@--$----#/#-##*#####/#---$--#../###-.--#../..#--###../..####....) and then be loaded to populate the level?
I have a question. I want to have a var texture in a resource and set the texture of a node inside its script. I tried it with texture = stats.texture but it doesn't work. Am I missing something?
Hmm that should work, unless the texture isn't being loaded.
Are you getting any errors?
@queblegamedevelopment4143 Nope 0 errors
@thesomeone2nd okay, would you send a snapshot of both scripts?
@@queblegamedevelopment4143 How to do that here?
@thesomeone2nd You could send it in the discord
I have managed pretty much the same functionality with just Global scripts and classes. Im failing to see any major advantage by using custom resources (compared to my approach) or maybe im just still not understanding custom resources completely
I'm not sure how your globals are setup, but for example, with a custom resource you could pass the same resource to anything and that thing can independently determine how to handle it. Like with an attack, it could have knockback, and fire damage. Things immune to burning can discard the burning aspect, things with knockback immunity won't be knocked back.
From what I understand, the trade off for how easy it is to use resources for save files is that it opens a vulnerability that allows people to inject code into the user's machine. It's much safer to use an encrypted JSON file for saving and loading.
Well yes and no.
You should checkout my custom resource saving tutorial where I go in depth on the subject:)
@@queblegamedevelopment4143 Well... This is embarrassing. I've watched those. And it was you explaining to me how the resource loader could potentially be misused. Your "SECURE saving in godot with encryption" was what taught me how to implement a save system that I feel comfortable using.
Oh haha 😅
Maybe I'm remembering a comments discussion I had with someone lol
So I was going to talk about the situation in this video, but it would have added an extra 5 minutes so I cut it out.
Basically the situation is:
- if you have a single player game, or any game where players don't share files (e.g. the steam workshop), then custom resources are not harmful. This is because the only way someone could get a malicious file, is if they downloaded it from an external site. In this case, the error would be on the user, since malicious code could be downloaded even if the save files weren't formatted as custom resources.
- if you did have a game where players shared files via the Steam workshop or something similar, then yes, custom resources would probably be a security risk. You could technically code in a quick check to see if the files are formatted properly for loading (check for extra function names of code), but this would be a valid place to refrain from using custom resources.
Hopefully that clears things up :)
Inheritance doesn't work the way you explained it. An object class doesn't need a defense if not all objects do. A sign can inherit from object making it an object but it could then have a defense.
Example:
Object
- name
- desc
Sign :: Object
- now has all of object
- defense
This means Sign technically looks like:
- name
- desc
- defense
I did try to explain it that way?
My point was having:
Entity:
- attack
- defense
Player :: Entity
(Has stats)
Sign :: Object
(doesn't have stats since I wouldn't want sign to inherit from entity since the entity class would typically have other methods irrelevant to a sign)
So yes, you technically could have both the Sign and Player inherit from Entity (both would then have inherited stats), but this would mean your movement logic would probably need to be a component.
In that case, you'd already be favoring a components structure, and a stats resource would make more sense to keep things modular.
I guess my explanation on the subject could have been unclear, but I hope this clears it up :)