Downloadable Content Access (DLC) [SOLVED]

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Corruptinator
:warning: Old Version Published before Godot 3 was released.

Hello! Does anybody know using GDScript to access outside the project folder to open files and other materials that can be used as a secondary addon, aka DLC

I know that there is a way in GDScript that we can use a certain command to access a certain folder in a PC or MAC to get to the external folder that exists outside the game, which maybe it can be useful for installing mods or addons?

It’s nothing important or critical but it was a good question with a good example answer that was lost due to the replacement of the old Godot Forums with the new one.

For example let’s say my addon folder is located in “C://[USER]/game_location/addons” and I wanted to access the mod folder containing extra TSCN and TRES files necessary to implement the addon…

I can tell you just this (my answer).
https://forum.godotengine.org/8667/how-easy-is-it-to-decompile-a-data-pck-file

On top of that, heard that Godot 3 will improve some things, also change all the way projects work (won’t be compatible with 2), maybe making easier multi-package, patch, dlc and mods.

eons | 2016-11-09 14:31

:bust_in_silhouette: Reply From: eons

Finally figured it out…

Is just:

Globals.load_resource_pack(path_to_pack)

Where path_to_pack could be res://file_name.pck, user://file_name.pck , maybe external files too.

Resources will be accesible as if these were on the game virtual filesystem (from res://), not sure what happens with files with the same name (I think new files overwrite/override older ones).

Export to a zip first to know the name changes if making binary conversions/compressions/encryption (files are renamed, like scene.tscn.converted.scn)


It may be possible to create/modify a pck file with PCKPacker but not sure.

Thanks! I’ll check it out and see if it works.

P.S. What about loading external PCKs? isn’t there a command that allows that to bring in files from outside the executable game file?

Corruptinator | 2016-11-29 05:19

It actually works! here is the code:

Globals.load_resource_pack(Globals.globalize_path("res://"+"DLC/"+"DLC1.pck"))
var data = load("res://Test.tscn.converted.scn").instance()
add_child(data)

(NOTE: globalize_path command does allow the godot to load files externally since it quickly uses the “res://” to bring up the location of the computer folder on the OS.

EX: globalize_path(“res://”) = “C:/[User]/[Username]/Godot/[Project]”

Corruptinator | 2016-11-29 10:52

I don’t know yet what happens if new resources have autoloads (since engine config is overwritten if packed with the editor), could be interesting if these could be added.

Also, Resource.take_over_path might be useful to rename/overwrite resources after loading them.

eons | 2016-11-29 18:34

Note: As of Godot 3, load_resource_pack function resides in ProjectSettings class

Doc link: ProjectSettings — Godot Engine (latest) documentation in English

CKO | 2020-03-09 06:40