Guide to the Godot game engine/Resources and importing

In Godot, a is an object that stores data, like  and. They are reference-counted, which means when they are no-longer used, they will automatically delete themselves, freeing memory.

Making resources
To make a resource, you need to first find something that will use it. Create a new scene with a Sprite2D. You can do this by pressing "Other Node" after making a new scene.

Select it and look for its  property. Click  and press "New ". Press the  property (you may need to click on the GradientTexture) and press   from the drop-down menu. Click on this Gradient. Click the black rectangle. A blank area a little bit to the right will turn black. Click it and a popup that allows you to choose a color will appear. Choose a color. Do the same to the white rectangle. You can add more points and colours by pressing in-between any two of these rectangles. Congratulations! You made your first resource!

Games usually show art, not just square color gradients. For this, download an art program. Microsoft Paint will do for now if you use Windows, but it isn't so great when you want a transparent image (say, non-squares), so you might want a better program soon. I use Piskel. Alternatively, you could download the Godot plugin that adds an image editor. It can be found in the Asset Library and enabled in Project->ProjectSettings->Plugins. I forgot the name of the image editor, however, so you might need to search around for it.

Make anything at all. A diamond, a person, a car, or just a square. Save it into your project's folder. Go back to Godot, find the file and drag it over to the  property of the Sprite2D in the Inspector. Congratulations! You just imported - and used - your first file!

So, wait, what did I just do?
Importing files into your game is essential for game development. In Godot, you don't need to save the file or image into some kind of database to become usable. Just plop it down into your project's folder. Simple.

If you want to fine-tweak an imported file, do not use the Inspector! Changes made to imported resources in the Inspector won't save. Instead, double click your file, above the  dock is an   tab. Press the  tab button to show it. You will see a large or small menu depending on the file selected. For Texture (".png", ".svg", ".bmp" file extensions), you will see things like compression settings or process settings. Under, uncheck  , then press Reimport. See any differences from your old image?

makes your image look higher resolution than it actually is by making it blurry. Turning it off makes an image more pixelated.

Check  if your image will be used in the 3D world, or show in many different sizes, to increase visual quality.

makes your transparent images look normal when using filter or compression methods other than Lossless.

makes  files larger, scaled or higher resolution if you increase the number, with the opposite effect if you decrease the number.

What compression modes are available? And what do they do?

The compression format you use depends on many things. In general, use  for large textures or textures you don't see up close in-game and   for small textures in 2D games.

Texture artifacts are common in higher quality loss. Make sure to check your texture after re-import that it looks the same or that the quality loss is unnoticeable.

Sometimes you intend to lower the quality to break up a texture that uses flat planes of color if you are a less than skilful artist. Those artifacts can break up solid blocks of color, making it easier to make decent game art. However, consider becoming more skilled at art, or getting an artist,since this is not foolproof.

Making your own resources


You can make your own resource scripts. All they should do is hold information, they should not do any logic. For example, you can use resources to hold data for how an item works. It could store the name of the item, the image, etc. In Godot 4, it is much easier to separate different export variables in groups and drop-down menus.

In Godot 3.x, resources are mostly the same, but it is a bit more difficult to create organised groups like in Godot 4.

External links:
 * How to use export variables in Godot 4.x
 * How and when to avoid using Nodes for everything

What you have learned

 * 1) What importing is in Godot.
 * 2) How to make a resource.
 * 3) How to change the settings for an imported file.

Quiz


{What compression method is fastest to load? } { vram|VRam|videoram|Videoram|VideoRam }
 * type="{}"

{Can lossless break up a flat plane of color? } -Yes +No
 * type=""
 * Lossy does.
 * Lossy does

{Which of these are the best compression method? } -Lossless -Lossy -VRam -Uncompressed +All of the above
 * type=""
 * Each one is good at specific tasks, so they are all the best, in a way.

{Can you modify a texture in the Inspector? } -Yes +No
 * type=""
 * Try it. Changes won't be saved and you can't even use the Inspector to experiment.

{Can gradients only have 2 colors? } -Yes +No
 * type=""

