[SOLVED] Getting assets from a split game RPA file outside of base directory?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
DeVNCraft
Regular
Posts: 58
Joined: Fri Dec 13, 2024 7:54 am
Projects: The Shadow Over Willowtown
Organization: VNCraft
itch: VNCraft
Location: US
Contact:

[SOLVED] Getting assets from a split game RPA file outside of base directory?

#1 Post by DeVNCraft »

I've been trying to use config.archives to add a non-relative path to an external archive in preparation of a multi-persistent style setup (I'm not using multi-persistent itself due to lack of OS support like android), I realize I could use something like unrpy or even toms example here on the forums to copy each file out of the archive, but the entire point is to save space.

I've tried using config.archives like so...

Code: Select all

config.archive.append("C:\\path_to_part1\\game\\images")

config.archive.append("C:/path_to_part1/game/images")

# as well as

config.archives = [ "C:\\path_to_part1\\game\\images", "C:\\path_to_part1\\game\\audio" ]
I've tried using both types of slashes, just paths, with or without extensions, etc. etc....as well as using ../../ to go backwards in the directory structure to the folder with both games in it and setting the config.searchpath during an init block...nothing seems to work.

I was able to accomplish it by using the path in environment.txt in the base directory but then it crashes due to my code files being the same for both in an archive as well.

Code: Select all

RENPY_SEARCHPATH = "C:\\path_to_part1\\game\\images"
What I need is for renpy.list_files() to find just the archives I need so it can directly read the assets or to skip over script code...which I thought the documentation for config.archive said it does--but for the life of me I can't get ren'py to recognize the archive no matter how early I try to set the variable and I really prefer not to dig into the pickle system or copy the actually files to a second location on someones device.

I went so far as trying to edit the renpy script and loader files to just ignore duplicate errors and that didnt work either, honestly i'm afraid i'll break something beyond my knowledge of how ren'py works under the hood if I tried much more in that direction.

I can find the files with glob, which I can also use to find loose resources and it loads them perfectly fine from anywhere, the search path variable works and lets me load them from the archive, but nothing seems to let me do it the way I actually want it to be done...and the entire point is to keep them inside the archives for the smaller size and not change the game files.

Anyone have any idea why its not recognizing the archives...is it because the path is outside of the games base directory?

Any known workarounds for this?

I've searched everywhere and people always want to extract them, but I can't find anything on just loading them from inside the archive without maybe keeping each one as an binary data loaded that way...but the thought of all those in memory makes me think that might cause problems down the road if the size gets too big as well.
Last edited by DeVNCraft on Sun Apr 20, 2025 6:42 pm, edited 1 time in total.
The Shadow Over Willowtown

▪︎ C/TC++/VC++ ▪︎ Q/V/Basic ▪︎ Python/Ren'Py ▪︎

I blame the other guy for being here 8)

User avatar
jeffster
Eileen-Class Veteran
Posts: 1228
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#2 Post by jeffster »

I'm not sure if it's doable for different platforms, but generally we can create symbolic links (in Linux, Android, Windows, probably Mac), which create something like references from one folder to a file in another folder. So you can use .rpa that physically resides in another place.

I don't know if Ren'Py could do that working across folders because there could be limitations like access permissions across folders. I think Android & Mac are especially anal about that, but IDK.
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)
All my tutorials, code samples etc. are Public Domain: use them with no restrictions.

DeVNCraft
Regular
Posts: 58
Joined: Fri Dec 13, 2024 7:54 am
Projects: The Shadow Over Willowtown
Organization: VNCraft
itch: VNCraft
Location: US
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#3 Post by DeVNCraft »

jeffster wrote: Sun Apr 20, 2025 4:48 pm I'm not sure if it's doable for different platforms, but generally we can create symbolic links (in Linux, Android, Windows, probably Mac), which create something like references from one folder to a file in another folder. So you can use .rpa that physically resides in another place.

I don't know if Ren'Py could do that working across folders because there could be limitations like access permissions across folders. I think Android & Mac are especially anal about that, but IDK.
I actually came across this suggestion (t can't remember if it was you who answered that originally), but I'd rather not risk symbolic links in case they have the game separately in some important folder, I have my entire steam library on a separate drive that way and I learned the very painful reality of what happens when you just delete a folder link :lol:

I'd honestly prefer the pickle method to doing that...my real question is why config.searchpath and config.archive don't seem to do ANYTHING in my project but if I set it in environment.txt as the search path it picks up files from absolutely anywhere, relative or absolute paths...I was actually able to have it scan an entire folder full of ren'py games during testing and it found every resource...but it also found every script file and errored a million times.

My guess is that the search path set in environments.txt is treated as part of your games entire project and it loads all the script files, or maybe thats just how renpy.seaechpath itself works.

But according to the documentation, config.archive is only supposed to be for resources and skips script files...basically its meant to do exactly what I'm trying to accomplish...but it seems to do nothing at all.
The Shadow Over Willowtown

▪︎ C/TC++/VC++ ▪︎ Q/V/Basic ▪︎ Python/Ren'Py ▪︎

I blame the other guy for being here 8)

User avatar
enaielei
Miko-Class Veteran
Posts: 554
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#4 Post by enaielei »

DeVNCraft wrote: Sun Apr 20, 2025 3:53 pm I've tried using config.archives like so...

Code: Select all

config.archive.append("C:\\path_to_part1\\game\\images")
As per docs:
https://www.renpy.org/doc/html/config.html#var-config.archives wrote: The entries in this should consist of strings giving the base names of archive files, without the .rpa extension.
Base names being just the name of the archive (not an absolute or relative path)

Code: Select all

os.path.basename("a/b/c/test.ext") == "test"
I think what you're looking for is this:
https://www.renpy.org/doc/html/config.h ... searchpath
Last edited by enaielei on Sun Apr 20, 2025 6:44 pm, edited 1 time in total.
Please consider supporting me if you like what I do :D
https://paypal.me/enaielei?country.x=PH&locale.x=en_US

DeVNCraft
Regular
Posts: 58
Joined: Fri Dec 13, 2024 7:54 am
Projects: The Shadow Over Willowtown
Organization: VNCraft
itch: VNCraft
Location: US
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#5 Post by DeVNCraft »

I got it working...seems it HAD to be in my options.rpy file before the build configuration variables.

what I was able to do was set it like so...

Code: Select all

config.archives.append('c:\\path_to_part1\\archive_name')
I was forced to copy the renpy common folder into the root of my own game folder during testing using vscode but it gets excluded by renpy during distribution automatically and its no longer required.
The Shadow Over Willowtown

▪︎ C/TC++/VC++ ▪︎ Q/V/Basic ▪︎ Python/Ren'Py ▪︎

I blame the other guy for being here 8)

User avatar
jeffster
Eileen-Class Veteran
Posts: 1228
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#6 Post by jeffster »

DeVNCraft wrote: Sun Apr 20, 2025 5:30 pm I'd rather not risk symbolic links in case they have the game separately in some important folder, I have my entire steam library on a separate drive that way and I learned the very painful reality of what happens when you just delete a folder link :lol:
(OFFTOPIC) Move to Linux. There you can delete links and not risk deleting the originals.

(Among many other advantages of Linux).

DeVNCraft
Regular
Posts: 58
Joined: Fri Dec 13, 2024 7:54 am
Projects: The Shadow Over Willowtown
Organization: VNCraft
itch: VNCraft
Location: US
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#7 Post by DeVNCraft »

jeffster wrote: Sun Apr 20, 2025 10:21 pm
DeVNCraft wrote: Sun Apr 20, 2025 5:30 pm I'd rather not risk symbolic links in case they have the game separately in some important folder, I have my entire steam library on a separate drive that way and I learned the very painful reality of what happens when you just delete a folder link :lol:
(OFFTOPIC) Move to Linux. There you can delete links and not risk deleting the originals.

(Among many other advantages of Linux).
Windows 11 is forcing its way down peoples throats, its the inevitable outcome for me...but my concern is always the users playing first and not myself 😉
The Shadow Over Willowtown

▪︎ C/TC++/VC++ ▪︎ Q/V/Basic ▪︎ Python/Ren'Py ▪︎

I blame the other guy for being here 8)

DeVNCraft
Regular
Posts: 58
Joined: Fri Dec 13, 2024 7:54 am
Projects: The Shadow Over Willowtown
Organization: VNCraft
itch: VNCraft
Location: US
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#8 Post by DeVNCraft »

enaielei wrote: Sun Apr 20, 2025 6:41 pm
DeVNCraft wrote: Sun Apr 20, 2025 3:53 pm I've tried using config.archives like so...

Code: Select all

config.archive.append("C:\\path_to_part1\\game\\images")
As per docs:
https://www.renpy.org/doc/html/config.html#var-config.archives wrote: The entries in this should consist of strings giving the base names of archive files, without the .rpa extension.
Base names being just the name of the archive (not an absolute or relative path)

Code: Select all

os.path.basename("a/b/c/test.ext") == "test"
I think what you're looking for is this:
https://www.renpy.org/doc/html/config.h ... searchpath
I realized neither was what I was looking for, and neither works the way I needed it too. I just left it as solved and decided to go the pickle route, I need to avoid scripts being loaded a second time and setting the searchpath or the archives causes it to happen regardless.

I'm responding just to say that I missed your response, and that I WAS able to use an absolute path (as a define variable at that) when I did it in my options.rpy before the build.archive configurations.

Maybe I broke something by moving the common folder into my game folder, but it worked :lol:
The Shadow Over Willowtown

▪︎ C/TC++/VC++ ▪︎ Q/V/Basic ▪︎ Python/Ren'Py ▪︎

I blame the other guy for being here 8)

User avatar
jeffster
Eileen-Class Veteran
Posts: 1228
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#9 Post by jeffster »

DeVNCraft wrote: Tue Apr 22, 2025 8:46 am I need to avoid scripts being loaded a second time and setting the searchpath or the archives causes it to happen regardless.
I may be missing something, but if you control both locations of "archive" files, can't you have scripts outside of the additional searchpath?

Like

Code: Select all

<another game>/game/res
<= load, but not load

Code: Select all

<another game>/game/scripts
?
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)
All my tutorials, code samples etc. are Public Domain: use them with no restrictions.

DeVNCraft
Regular
Posts: 58
Joined: Fri Dec 13, 2024 7:54 am
Projects: The Shadow Over Willowtown
Organization: VNCraft
itch: VNCraft
Location: US
Contact:

Re: Getting assets from a split game RPA file outside of base directory?

#10 Post by DeVNCraft »

jeffster wrote: Tue Apr 22, 2025 9:13 am
DeVNCraft wrote: Tue Apr 22, 2025 8:46 am I need to avoid scripts being loaded a second time and setting the searchpath or the archives causes it to happen regardless.
I may be missing something, but if you control both locations of "archive" files, can't you have scripts outside of the additional searchpath?

Like

Code: Select all

<another game>/game/res
<= load, but not load

Code: Select all

<another game>/game/scripts
?
I could, except technically I can only control the previous games archive location, which of course has already been released before this concept came to mind.

If people just overwrite the folder on PC like most do and your actually required to do on android not to lose your saves, not only would that take up more space (particularly if android keeps both sets--idk here), but it would still cause an error...since I can't use a try except block for error catching in this situatuon, its a 50/50 it breaks the game because people don't bother to read (ironic for VN players lol), and depending on androids installation method possibly guaranteed to break the game.

One of my biggest concerns at all times is breaking or deleting users savedata, particularly on mobile, been there, done that, and likely quit playing myself.

I might be able to force ren'py to put my archives for the continuation of the game in a sub-folder, honestly never thought to try that approach...i'll have to give it a shot.

Thanks for the idea :wink:
The Shadow Over Willowtown

▪︎ C/TC++/VC++ ▪︎ Q/V/Basic ▪︎ Python/Ren'Py ▪︎

I blame the other guy for being here 8)

Post Reply