Resources in Godot Are Amazing
Вставка
- Опубліковано 20 жов 2024
- Follow Me on twitch: / chaff_games
Here is the playlist to the course: • Godot 4 FPS Tutorials
Today we're looking at Resources in godot. And how to make a custom resource for your game. This an incredibly powerful tool that can empower you to create amazing tools in your game.
Support the Channel: / chaffgames
Join The Discord: / discord
My Latest Course: www.udemy.com/...
Get the FPS Template Here: chaffgames.com...
My Set Up:
VO Mic: amzn.to/3QfnL6d
Audio Interface: amzn.to/46MFidg
CloudLifter: amzn.to/49dMUqE
Camera Mic: amzn.to/4980cFh
Case: amzn.to/46JiTxi
CPU: amzn.to/471Jeah
GPU: amzn.to/3si8r0G
Keyboard: amzn.to/3tPL6nC
Mouse: amzn.to/46KhM0h
As an Amazon Associate I earn from qualifying purchases.
---------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
Please like and Subscribe! It's truly appreciated
#gamedevelopment #godot4 #godot
Links to my Socials
Instagram: / chaff.dev
Twitter: / chaffdev
Itch.io: chafmere.itch.io/
Website: chaffgames.com
Check out the full FPS Course: ua-cam.com/play/PLhnGgh9GDmn5DRLPnIlPRPS8ci5GnAsvO.html
First week of learning games, I have no idea what he is talking about but I feel productive
Well it took me 2 years of using Godot before finding out about resources so even if you don’t fully understand, the memory may help you when the time come.
Well it took me 2 years of using Godot before finding out about resources so even if you don’t fully understand, the memory may help you when the time come.@@Chaff_Games
Pretty good explaination, as someone who have been with the Godot since it was announced, I kept saying that once you understand the relationship between nodes and resources - everything else will click.
So if I’m understanding this let’s say I wanted to make a characters stats like health and shield should it be a resource
As always, it’s going to depend on the project and the complexity of the scene you’re working with.
@@Chaff_Games it finally clicked i understand EVERYTHING!!!!
i needed this yesterday, i was literally searching for it, thx for making the video so youtube could reccomend it to me
Awesome glad to be able to help 😊
Super nice breakdown there! Resources seem like a real power-house ready to be exploited, but I haven't seen a use case demonstrated yet. This video was my answer ;D Thanks! And good vid! ;D
😊 thanks
Here is a use case :)
ua-cam.com/video/V79YabQZC1s/v-deo.html
I'm just in the process of creating a character controller, and it's working very well now. Anyway, I wanted to add in the ability to equip weapons, and wasn't quite sure how best to do it in godot... I skimmed reddit and saw someone mention resources. The docs didn't quite bridge the knowledge gap for me, so I checked out this video- and yes, it's exactly what I need.
Thanks for the quick 5 minute demo, now I know that this is the right feature to use for what I need.
for unity devs, this is just ScriptableObjects's brother, right?
Yip, Godot just has a different name for it :D
Yes, but unlike in unity, they have sub resources
Yes but in godot you dont have choise to not use scriptable objects, and funny enough its the upside cuz it teaches to manage project resources.
It’s better : resources fields can be edited directly in the inspector.
But you can edit the properties of SO in the Unity's inspector too...
Wew! Very well made, thank you!
Backing in Godot 3.x I was looking for it.
Exactly what i needed. ❤
I recently completed Code Monkeys free Unity course, and the recources seem to work like Unity's Scriptable Objects,
I heard that. I've never worked with Unity long enough to get into Scriptable Objects.
From what I understand. Resources is same as component? Or is there any difference between the 2? I created my fps game and use node as component for my "Upgradable". For example, for my shotgun, it can be upgraded to explosive shotgun that stick to the wall or enemy for certain second before explode. And it can be simply add the node to the "Bullet" node via the code itself. Is there any difference or advantage to use resource?
I don't get how to assign a resource in code. Everyone shows dragging and dropping a resource into the inspector, but I want to have a character script that has a resource assigned to it by code, because it will be changing multiple times during gameplay. Anyone know what I mean?
It does not need to be loaded via an export variable. You can just load it in code as well “ var some_resource = preload(the_path_to_the_resource) “. Is that what you mean?
@@Chaff_Games yes thank you! except i think i need to use load not preload
great tutorial!
☺️
you don't need to store the names of all the animations in your gun resource, it looks like you could just infer them from the name since all the ones shown onscreen follow the same simple pattern:
("name" + "_" + "the type of animation").
the video was helpful btw, thanks for making it.
I actually did do that back in 3.5 but opted out to allow for more flexibility. When I’m prototyping my naming schemes are all over the shop.
Wait, I'm a bit confused, what is actually the difference between classes and resources, and under what circumstances would classes actually be more appropriate to use?
The first thing that comes to mind, is that resource can’t be placed in the scene tree. So in a case where whatever you’re working with is pure data a resource maybe more appropriate. But if it needs to be in the scene tree, perhaps you extended the rigid body class for a common object in your game, then it’s a class.
@@Chaff_Games The thing I'm confused about is that in the video, you say that your weapons are pure data, but then they're also objects in the game, which fits my idea of a class better.
Are you using both a Weapon resource and class to make the weapon objects, or do you just have one weapon object that loads data from the resource upon spawning?
For example, the class would be a generator for the weapons, that draws the data from a resource similar to how you would use arrays in other languages.
@AgentChick Oh I see, I have a simple node3d that reads the data and controls that state (current weapon). The state machine does all the lifting, it tells the animation player what animation to play and when damage ray casting ect, the resource is behind that feed the manager the data. So basically yes, it could be it’s own class, weapon manager or something like that. What the resource allows me to do is have a single script that controls what weapon I’m using and what it should do, since it’s always querying the resource for that information first. So if I want a new weapon I just need a set of animations and a new resource, because the behaviour is already defined. If you want to learn more I have a series that I’m going through showing how to make exactly this and you can also download the project and check it out.
If you’re curious about how this would look as a full class system rather than resource based. My old 3.5 fps template did that instead. It’s not as good, but it can totally be done that way if you want.
@@Chaff_Games Ah, that clears things up, thanks!
Congrats on the patron launch :D, resource creation is a very powerful tool especially if you want to make swap-able objects and if non programmer(s) (artists, writers and etc) are helping on the game creation they can swap out pieces of the game for testing and so on without touching your code base. It should be mentioned that resource creation using C# does not work. Cool vid and keep up the great work!
The following video explains how to do it in C# as well - haven't tried it out myself though: ua-cam.com/video/yUmY3Gi3z5U/v-deo.html
If you are like me and don't want to klick links a random person on the internet sent you, the video is called "Creating custom resource types [Godot/C# Tutorial]" and made by "Mina Pêcheux"
I don't understand why I have to see 48 seconds of random intro, only to have to pause between the actual instructions that are shown within miliseconds
🫡
I doubt this was a tutorial even tho the tags say so,it was much more an explanation
They are indeed. Use them extensively
so it's like a dictionary but you are exporting it?
It’s like dictionary plus the added bonus of being able to execute code and typed variables that you can enter into the editor.
So resources are shared among multiple nodes. But for example, if i wanted to create a multiplayer game, where each player has different stats, should i still use resources and how would I make them be individually changeable without changing all others?
I’ve not looked at multiplayer for a long time. But if I was going to do multiplayer. The player stats would probably held on the server in a database. Then when the player logs on you would query the database and get the stat as required. You could have a resource on the client side that you could populate with those stats at log on and periodically check to make sure that they’re the same to reduce queries.
@@Chaff_Games yeah with persistent stats, databases or rest interfaces would be best, but I rather meant things like player stats such as damage per shot or collected power ups that don't need to be persistent and are discarded after the round...
I recently tried to understand how to transfer resources over the network, through the godot multiplayer, but I still did not understand (
I had to parse the resource into a dictionary and transfer it in this form.
Maybe someone has faced a similar problem, how did you solve it?
I've never tried but I would do the exact same thing.
So resources can be godot's way of doing enumerators?
Think scripted objects on unity
KDE PLASMA FTW!
Yep, my DE of choice. Can’t go wrong.
@@Chaff_Games same)
I am obliged to say “I use arch btw”
@@ClayTheFoxx Nice! I want to make the switch but this Manjaro build has been really stable and everything is set up. I used to be more gallivant switching distros but since I started development, I'm a little more cautious switching.
I'm curious if a ScriptableObject as Architecture is possible with Godot Resources, that work just like in the Ryan Hipple talk. I know it's more of a Unity thing, but can it be applicable in Godot in some way?
I’m honestly not sure it’s been years since I used Unity. Godot is very flexible however, it’s likely possible to do.
In the video it sounded just like Scriptable Objects and since it can also have methods, then it might really be just like scriptable objects.
@@raulzilla Well, I couldn't figure out how to implement the SO architecture using them,
can be resources created with C# in Godot?
Sorry I’m not sure. I would assume so, but you never know with mono.
@@Chaff_GamesThey can, I've literally just done one!
So with resources its very easy to make games with mod support?
I’ve never tried. But I could see their utility.
how do you quickly load the game when start pressed (f5), it takes me 30 sec . can you please guide me...please
Hey there, sorry to disappoint you but it’s just edited. I do experience a wait but it’s just going to depend on your hardware, I don’t think there’s anything you can do.
do you have a corsair keyboard ?
You can save your scenes in scn format instead of tscn.
Scn is a binary way to save scenes, tscn is textual, this should speed up the launch of the project in test mode.
because i noticed my godot is slower if the RGB on my Corsair K55 RGB is controlled by a software on the PC , the fix is to unplug / plug the device from the computer
That’s so weird I wonder what causes that
Hmm. Godot looks like a nice engine, but I guess bevy's simplicity and Rust is what stole me. ESC seems a bit simpler to me.
I had done a course in Unity before changing to godot. I never made a game in Unity so I sort of count Godot as my first serious game engine. And in a way this made it easier for me to click into the Godot way of doing things rather than having to re wire my brain to work with a different system. At the end of the day the best tool is the one you feel most comfortable with.
Nooooo. TOTK spoiler
Zelda dies…
@@Chaff_Games aaaahh