Modifying packaged GDScript during runtime.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Turnovus

I am currently considering the architecture of a game project I’m starting, and one thing that I want to consider from the ground up is mod support. To this end, I want to allow users to temporarily modify scripts contained in both the game’s .pck file and .pck files distributed with other mods. Ultimately, I want to have a system that does to GDScript as the Harmony library does to compiled C#/IL for Unity games (https://harmony.pardeike.net/).

In practice, what I want is a way for mods containing packaged GDScript to be able to access and modify other packaged GDScripts as though they were plain text strings, preferably without any significant impact on performance.

To be clear, I don’t want to change the actual .pck files in any way. Instead, I want to change the scripts loaded by the game.

:bust_in_silhouette: Reply From: aipie

If a pck file is loaded with and it contains an file with the same name as the ‘original’ project, then it should replace the original version (that could also mean that it breaks the program too).
See this for more information