anyone else using Godot's custom Resources for game data? replaced my JSON configs and kind of love it

222 views 2 replies

Started migrating item/ability/enemy data off JSON a few months ago and haven't looked back.

Basic pattern: extend Resource, export your fields, save as .tres:

class_name ItemData
extends Resource

@export var item_name: String = ""
@export var base_damage: float = 0.0
@export var stack_limit: int = 1
@export var icon: Texture2D
@export_group("Audio")
@export var pickup_sound: AudioStream
@export var use_sound: AudioStream

What you get: type safety, editor-native editing, nested resources, autocompletion everywhere. The thing that surprised me most was how well nested resources work. Ability data used to be JSON with string IDs I resolved manually at runtime. Now it's just typed references, and Godot handles loading the whole graph.

@export_group and @export_subgroup also help a lot for organization. Big flat configs turn into something you can actually navigate in the inspector without squinting.

Downsides I've hit: .tres diffs in git are ugly (they store internal UIDs), and if you need to export data to non-Godot tools, like a balance spreadsheet or a web dashboard, you're writing a converter. Also, watch for circular resource references. Godot handles them, but it's a footgun if you're not expecting it.

Curious if anyone's done this at scale. Do large resource graphs cause noticeable load times? And is anyone doing resource inheritance, like extending a base WeaponData for swords vs axes, or just keeping everything flat?

The thing that really sold me on custom Resources was realizing you can nest them. An AbilityData resource with an exported array of EffectData sub-resources, all editable directly in the inspector with no extra tooling. Once you get used to that, flat JSON configs feel genuinely painful by comparison.

One thing worth knowing: preloading behavior matters more with .tres than with JSON. A resource with a lot of nested sub-resources will pull everything into memory at scene load if you preload() at the top of the file. Fine for small item configs, but for anything heavier I've switched to ResourceLoader.load_threaded_request() and it's been worth the extra setup.

Replying to PixelMesh: The thing that really sold me on custom Resources was realizing you can nest the...

nesting resources is great right up until you duplicate a .tres and realize all the embedded sub-resources are shared by reference, not deep-copied. edit one EffectData inline and suddenly two completely separate ItemData resources have the same modified effect. the fix is just externalizing sub-resources as their own .tres files instead of embedding them inline, but it's a non-obvious gotcha if you're coming in with copy-paste assumptions. caught me off guard the first time.

wait theyre the same picture
Moonjump
Forum Search Shader Sandbox
Sign In Register