Using resources for data in Godot

We chose to use Godot’s native resources over a text data format like JSON for this series. You can use either to manage data for your games; each has its pros and cons.

In this series, we’re going to use resources as they are Godot’s native data containers. If you were to create a large game project, I think resources could be a useful tool. Still, you would likely want to code an editor plugin to edit your game’s data efficiently.

JavaScript Object Notation (JSON)

JSON is a text-based data format initially designed to translate JavaScript’s types into text and vice-versa. It initially allowed developers to send data over the web in a human-readable, making it easy to inspect and edit the data in case of errors.

As it’s easy to read, edit, and pretty much all programming languages have built-in support for it. It’s become pretty ubiquitous, taking over XML in popularity.

Here are JSON’s pros:

The cons are that:

You’ll want to go with JSON mostly if you or a designer in your team uses an external program to edit your game’s data, like a spreadsheet program.

Godot’s Resource class

Resource is Godot’s built-in base type for data containers. All textures, 3D models, shaders, audio streams, and many more kinds of data extend the built-in Resource class.

The advantages of native resources include:

The disadvantages of resources are: