Collection of Resources: Embedded or Separate Files?

Godot Version



I’m currently working on getting data into a game I’m beginning to develop. My understanding is that Resources are a powerful way to go about this, and I’ve already got my individual classes setup, as well as the Resource that will act as a collection of them. However, I’m at a crossroads.

My collection contains:

@export var items: Array[Item]

Now as I’m developing those Items, I seem to have two choices. I can create them inside this resource directly, where they’ll get embedded, or I can create the resources separately and then link them in.

Given that for my use case something is likely to have the entire collection loaded in memory basically all the time, is there any reason to favor embedding the resources in the collection vs. having them as separate files?

In either case I can write some tooling to make editing easier if I’d like, so it seems like it might come down to the number of files on disk, but I’m curious if there’s any other considerations I may not be aware of.

When a resource is loaded it is loaded into RAM as a whole anyway, including all subresources, regardless of whether the subresource are embedded or are in separate files.

Making each item into a separate file depends on whether this file is used separately in some other part of the game or not (as is it going to be loaded separately without the collection?). If your subresources exist only as part of this collection, there is no practical reason for them to be in separate files, it will just cluster your file system.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.