I want to use DLC in my game. I thought I would give PCKs a shot.

I create a project (set_001). I export the PCK file w/o debug. The project has:

res://
     content/
          001/
              *.jpg (50 JPEG files)
              image_data.tres (Created by another "tool" Godot project)

I have test program with the following in _ready():

` var pck = ProjectSettings.load_resource_pack("/home/steve/godot/PatternsOrignalImages/InternetStorage/pcks/set_001.pck")
print("Load return: ", pck)

var dir = DirAccess.open("res://content/001")
if dir:
	dir.list_dir_begin()
	var fn = dir.get_next()
	while fn != "":
		print("fn: ", fn)
		fn = dir.get_next()	

`

All that prints out are the .import files. None of the data files are present. How do I get the data files put in my PCK file.

  • indicainkwell replied to this.
  • BriarSMC

    Relevant Links:

    I thought about this some more.

    All that prints out are the .import files. None of the data files are present. How do I get the data files put in my PCK file.

    From this quote, I assume you may not know about the import and export process. Please review the import process. Here's a summary (Shameless crosspost). In the end we are left with special "import" and "remap" files that point to the final resource.

    I'm not sure if there are more files left behind than just "import" and "remap". Additionally, I don't know how this is affected when the pck is encrypted.

    ResourceLoader and load() are aware of this process and remaps the original paths to the final paths. So, the data is there, but it's not in the same format or location.

    What can we do?

    • Have a well defined directory structure. So you don't have to scan every file for specific resource types.
    • Create an "index" script, scene, or resource. Define an api to access resources contained in your dlc.
    • You can strip the ".import" or ".remap" from the end of the path. Then use the stripped path with load().
    • Create a custom ResourceFormatLoader that loads "import" and "remap" files and return the actual resource. This enables you use load(). I have written this. It works fine. The prior points are better.

    I think a simple workaround is to generate a text file with all the paths of the resources in that will be included in your pck and include the text file in the pck as well.

    You can read in the text file after loading the pck and load() as usual.

    BriarSMC

    Relevant Links:

    I thought about this some more.

    All that prints out are the .import files. None of the data files are present. How do I get the data files put in my PCK file.

    From this quote, I assume you may not know about the import and export process. Please review the import process. Here's a summary (Shameless crosspost). In the end we are left with special "import" and "remap" files that point to the final resource.

    I'm not sure if there are more files left behind than just "import" and "remap". Additionally, I don't know how this is affected when the pck is encrypted.

    ResourceLoader and load() are aware of this process and remaps the original paths to the final paths. So, the data is there, but it's not in the same format or location.

    What can we do?

    • Have a well defined directory structure. So you don't have to scan every file for specific resource types.
    • Create an "index" script, scene, or resource. Define an api to access resources contained in your dlc.
    • You can strip the ".import" or ".remap" from the end of the path. Then use the stripped path with load().
    • Create a custom ResourceFormatLoader that loads "import" and "remap" files and return the actual resource. This enables you use load(). I have written this. It works fine. The prior points are better.