Introduction to Custom Resources in Godot!

Поділитися
Вставка
  • Опубліковано 13 січ 2025

КОМЕНТАРІ • 47

  • @tprczghost
    @tprczghost 3 місяці тому +2

    First

  • @xt00thpastee
    @xt00thpastee Місяць тому +8

    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.

  • @parallax_rat
    @parallax_rat 2 місяці тому +6

    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.

  • @stormlord3389
    @stormlord3389 12 днів тому

    Finally a tutorial that explains how to add it to the object itself. The other tutorials were outdated.

  • @MinkWumpf
    @MinkWumpf 2 місяці тому +4

    I didn't used them now, but when i need them i will remember this video. Thanks

  • @Atenvardo
    @Atenvardo 21 день тому

    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!

  • @Sudoweeb
    @Sudoweeb 3 місяці тому +3

    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 :)

  • @Kry0000
    @Kry0000 Місяць тому

    Clear, concise and straight forward information. Resources are much more clearer now and their use-cases are brought to light, thank you.

  • @Sargath-hs8cb
    @Sargath-hs8cb 29 днів тому

    Good video, good design of a video. It is short, focuses on one specific topic, no wasted words.

    • @queblegamedevelopment4143
      @queblegamedevelopment4143  29 днів тому

      Thanks! I'm glad you liked the format!

    • @Sargath-hs8cb
      @Sargath-hs8cb 28 днів тому

      @@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.

  • @musicdudejoe263
    @musicdudejoe263 2 місяці тому +4

    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.

  • @Hino_dev
    @Hino_dev 3 місяці тому +4

    I like your videos, thanks ❤🎉

  • @setaindustries
    @setaindustries 3 місяці тому +6

    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

  • @_gamma.
    @_gamma. Місяць тому

    Thanks for this, made some of my code much more reusable!

  • @decorummortis5175
    @decorummortis5175 2 місяці тому +4

    I do use resources for saving, mostly user preferences and game data so far

  • @Paruthi.618
    @Paruthi.618 26 днів тому

    good tutorial.. explained in easily understandable manner.. thanks

  • @ukrsolid
    @ukrsolid 3 місяці тому +1

    this is really helpful, thanks for sharing

  • @studiotoby9952
    @studiotoby9952 2 місяці тому +1

    very helpful!!! thanks!!!

  • @Kurobeau
    @Kurobeau 2 місяці тому +1

    incredible vid. opened my eyes. and now.... i got so much to change bahaha.

  • @kirakuro8019
    @kirakuro8019 Місяць тому

    What are some best practices when using this as a save file?

  • @iDemandSky
    @iDemandSky Місяць тому

    is it possible to make a recursion between the resource and the scene? If so, how can I do that without causing issues?

  • @TheMaJestic14
    @TheMaJestic14 2 місяці тому

    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!

    • @queblegamedevelopment4143
      @queblegamedevelopment4143  2 місяці тому +1

      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

    • @TheMaJestic14
      @TheMaJestic14 2 місяці тому

      @@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

    • @queblegamedevelopment4143
      @queblegamedevelopment4143  2 місяці тому +1

      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?

    • @TheMaJestic14
      @TheMaJestic14 2 місяці тому

      @@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

  • @Dadax9398
    @Dadax9398 3 місяці тому +1

    cool

  • @senjos
    @senjos 3 місяці тому +1

    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?

  • @thesomeone2nd
    @thesomeone2nd Місяць тому

    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?

  • @MMGMegaMultiGamer
    @MMGMegaMultiGamer 3 місяці тому

    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

    • @lout160
      @lout160 3 місяці тому +1

      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.

  • @lout160
    @lout160 3 місяці тому +1

    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
      @queblegamedevelopment4143  2 місяці тому

      Well yes and no.
      You should checkout my custom resource saving tutorial where I go in depth on the subject:)

    • @lout160
      @lout160 2 місяці тому +1

      @@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.

    • @queblegamedevelopment4143
      @queblegamedevelopment4143  2 місяці тому +2

      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 :)

  • @decorummortis5175
    @decorummortis5175 2 місяці тому

    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

    • @queblegamedevelopment4143
      @queblegamedevelopment4143  2 місяці тому +1

      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 :)