So I’m working on a game right now, and I want to add custom map support. Of course, loading the maps on their own is easy, but I need some way to load in any assets the map maker might want in there as well. The way I have things set up, custom maps will go in user://scenes/, and I was thinking of having the resources all be put in their own subfolders for each map in user://map-resources/'. For example, if I had a map named "my-cool-map", I could set it up to have the resources be pulled from user://map-resources/my-cool-map/`.
Or… at least that’s what I want to do. But I can’t exactly figure out how to change all the resources in a scene to look in that directory, rather than res://. If there’s an easier way using .paks, that could also be an option.
If you are using any other method it depends. If you are using PackedScene.pack() to save the map then maybe you could make every resource the nodes use unique and save the file as a binary file (.scn) instead of a text file (.tscn) to pack all the resources inside the file itself.
I actually have things set up so you’d have to use the Godot editor to make levels, because I didn’t want to make a level editor. So I just have a map maker put their .tscn file in the custom map directory. But maybe I’ll look into giving map makers some sort of tool to pack resources into a .scn file like you said. (unless Godot can do that for you?)
Yes, save the scene as .scn instead of .tscn in the editor. Both formats can pack the resources inside them but the tscn file will save them as text so it will grow in size by a lot if you save binary resources (like textures, sounds,…) scn is a binary format and will save them as is.