What would be the pros and cons of using the ResourceSaver to save an entire world of NPCs, monsters, and other things, as PackedScenes, vs serialization through dict->json as described in Saving Games?

As far as I can tell, the first method is really easy, as long as all the relevant vars on all game objects are export'ed, I can just save and load an entire structure of nodes. With the second method I have to re-create every single node, but since it's the method mentioned in that docs page, I'm supposing it has some advantages.

Well, it just occurred to me that encription is one great advantage of json saves.

4 days later

ResourceSaver saves resources, you can't save scene with it, I would prefer using PackedScene and serialising it using var2str and save it

9 days later

@deepgaurav said: ResourceSaver saves resources, you can't save scene with it

Well, it's how I managed to save (and load) sectors in a space game I was making.


func save_sector(sector):
	var fscn = "%s%s.tscn" % [save_path, sector.get_name()]    # name sector file from sector name
	var pk = PackedScene.new()
	pk.pack( sector )
	ResourceSaver.save(fscn, pk)
	sector.free()

@deepgaurav said: I would prefer using PackedScene and serialising it using var2str and save it

I didn't know about var2str. Seems like a useful thing to know. Thanks.

5 years later