Can I create multiple image folders when developing with Renpy?

Aug 2, 2017
75
311
I want to organize the image folder so it's easier to manage a lot of images. I want to create a folder for intro images, empty rooms, quest lines, etc. but when I googled this none of the links were helpful. Do you guys have any experience with this?
 

penecultor

Newbie
May 4, 2017
78
648
I want to organize the image folder so it's easier to manage a lot of images. I want to create a folder for intro images, empty rooms, quest lines, etc. but when I googled this none of the links were helpful. Do you guys have any experience with this?
Ofc you can.
Define your images and you're good to go.

image whatever = "game/images/backgrounds/whatever.png"
image empty(name) = "game/images/scenes/emptyrooms/room(name).png"
image quest(number) = "game/images/scenes/questlines/quest(number).png"
 

the_unseen

Newbie
May 10, 2017
81
82
I think it's possible. I don't really know much about renpy yet, but you can check code of Starship Inanna or Depraved Awakening, they seem to have different .rpa files for different episodes. Author of Depraved Awakening is pretty active here, so you can probably pm him, maybe he could help.
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,835
Sure you can, why shouldn't you? X_x
There are multiple ways depending on what you want to achieve, but the simplest way would be to just define the images, that way you'd also see any errors with Lint (renpy launcher feature).
i.e. if you've got a "Room1" Folder inside the images folder (/game/images/room1/)
Code:
image Room1 Cupboard = "/room1/cupboard.png"

label start:
    show Room1 Cupboard
    with dissolve
But there are also ways of auto defining the images, the usual renpy auto define is alright, but it doesn't use the folder names in the definition nor does it allow you to have the same image names in two or more different folders, so each image has to have a unique name. There are ways around it, all of them can be found on the lemmasoft forum in the ren'py area ;) Which is a good place to start if you need ideas or help :)


p.S.: About Depraved Awakenings and it's different .rpas well yes that's also achieved by putting the images in different folders and defining archives for each folder, which then can be uploaded seperately as "patches" ;)
But that's something entirely different :)
 
  • Like
Reactions: bas and penecultor
Aug 2, 2017
75
311
Ofc you can.
Define your images and you're good to go.

image whatever = "game/images/backgrounds/whatever.png"
image empty(name) = "game/images/scenes/emptyrooms/room(name).png"
image quest(number) = "game/images/scenes/questlines/quest(number).png"
Perfect! thanks for the help
 

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,686
If you mean full images you can put them in folders without problem and use the command "scene" to show them, the only requirement is not to have duplicate names.

If for example you have to use the image with other commands like "add" inside "screen" you just have to specify folder.

For example...

- Full image

scene image_name

(it does not matter where it is whenever it is inside the images subfolder)


- Smaller image, icons, etc...

screen test_screen:
_____add "icons/moneyicon.png"


(you have to specify the path to the file, but without writing the folder images)
 

Papa Ernie

Squirrel!?
Uploader
Donor
Dec 4, 2016
12,328
47,213
I want to organize the image folder so it's easier to manage a lot of images. I want to create a folder for intro images, empty rooms, quest lines, etc. but when I googled this none of the links were helpful. Do you guys have any experience with this?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,143
14,827
But there are also ways of auto defining the images, the usual renpy auto define is alright, but it doesn't use the folder names in the definition nor does it allow you to have the same image names in two or more different folders, so each image has to have a unique name.
If you are talking about , it use the folder name. If you have "images/characters/mc/happy.jpg", "show images characters mc happy" should works without problem. The only problem is that you have "images" in the name, but you can correct this by using to remove what you want. But in this case, yes, you should be careful of duplicated names.
By example, put this in the option.rpy file :
Code:
define config.automatic_images = [ '/', ':', '_' ]
define config.automatic_images_strip = [ "images" ]
And you'll not have to care about defining the pictures.

As for the error, can surely be used to log them somewhere and/or use notify to warn you.
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,835
Well I meant the auto define without the usage of automatic_images and _strp which would just use the image name without any folders and so on, but it seems that I was wrong there, since it's the same you just mentioned and if it's true what you said then it's possible to also add the folder structure in front of the image names.... :) But yes, this is one of the auto definition methods I was talking about :D
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,143
14,827
[...] and if it's true what you said then it's possible to also add the folder structure in front of the image names.... :)
I haven't tested it upper than 6.99.12.4, but I don't see why it shouldn't works the same up to the 7.1.
So, yes, it include the folder structure. The pitfall, and what perhaps made some people think that it don't works, is that unlike for everything else in Ren'py, the 'images' folder is toke in count. So, for the "images/characters/mc/happy.jpg" picture, at first you try to use it like a regular picture :
Code:
show characters mc happy
which don't works.
Then come the fact that you have to deal with the full folder structure, which make names longer than expected. But if you think correctly the said structure, and use config.automatic_images_strip, it's time saving for a lot of games.
Not only because you don't have to write all the declaration lines, but also because when you test the game, you don't have to redo it because you forgot to declare one picture or made a typo when declaring it.
In the same time, you can more easily add/remove one picture in a scene and test what it do, without having to care of the declaration. As long as the picture is in the right folder you can perform your test. And if you finally decide to remove the picture, there isn't this declaration line to search for.
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,835
True, but I still define my images manually, actually the only reason I do that is because Lint counts the images too then :D But now it actually makes sense why people are using this automatic_images_strip stuff to remove the "images" folder in the automatic definition. I didn't understand it before where they got the rest of the structure :D But now it makes sense if the images always get auto defined like that + the images folder and you just remove the images folder and / _ from it you can use it as intended :D So like scene chapter one cpt01 005 i.e. :D the folder structure and imagename in that case was: images/chapter_one/cpt01_005.png ;)
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,058
If you want to use webp for any reason don't use config.automatic_images... I'm also not sure if its not going to go the way of the dodo in the future anyway with the response I got on github ( ).

I just decided in the end that it was better to have images with unique names that include the directory structure (Ex. CharacterName ReferenceScene/ReferenceSceneType ImageNumber)...

Anything in the image directory as others have said is just picked up automatically.

P.S ... If you read the final response on that github link... That 'better' function I wrote worked, but after the # of files in the directory was over a certain amount it just killed load times. Maybe someone better with python could have come up with something more efficient... XD
 
  • Like
Reactions: Palanto

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,143
14,827
If you want to use webp for any reason don't use config.automatic_images... I'm also not sure if its not going to go the way of the dodo in the future anyway with the response I got on github ( ).
Seriously ? He will not going to fix this ? Honestly, I really hate how narrow-minded he can be sometimes. If it's not how he think it must be done, then it's useless and shouldn't even be addressed :/


Maybe someone better with python could have come up with something more efficient... XD
renpy/common/00obsolete.rpy line 90:
Code:
            if not fn.lower().endswith(".png") and not fn.lower().endswith(".jpg"):
changed into :
Code:
            if not fn[fn.rfind("."):].lower() in ['.png', '.jpg', '.webp' ]:
and
renpy/common/00obsolete.rpy line 94:
Code:
            shortfn = fn[:-4].replace("\\", "/")
changed into :
Code:
            shortfn = fn[:fn.rfind( '.' )].replace("\\", "/")
I've done it on the fly, but it should be the needed fix. But, well, using it will put you on :/
Honestly, I don't see how the "images/" directory can be an improvement. It fall back to what @Palanto said above, you must have unique names for your files. Which completely kill the advantage of using multiple folders for your pictures.
But it's possible that it's not what I think, automatic finding of the pictures like in :
"images/myDir/pictureName.jpg"
Code:
show pictureName
Because it's not an improvement of the 6.99.13. But well, the change-log of the 6.99.13 say nothing about a change in the way Ren'py deal with the "images/" directory, and I don't have time to analyze a diff between 6.99.12.4 and 6.99.13.
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,835
If you want to use webp for any reason don't use config.automatic_images... I'm also not sure if its not going to go the way of the dodo in the future anyway with the response I got on github ( ).

I just decided in the end that it was better to have images with unique names that include the directory structure (Ex. CharacterName ReferenceScene/ReferenceSceneType ImageNumber)...

Anything in the image directory as others have said is just picked up automatically.

P.S ... If you read the final response on that github link... That 'better' function I wrote worked, but after the # of files in the directory was over a certain amount it just killed load times. Maybe someone better with python could have come up with something more efficient... XD
Hmmm in case it doesn't find them and you can't change the auto define to make it work, just keep the extension as .png even though it's .webp :)
 
  • Like
Reactions: anne O'nymous

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,835
You are a BETTER MAN than I, my friend, because I have a HARD time keeping in mind all of the current points and stuff that players have or should have... whew!! :D
Seen the number of people complaining because they can't open the jpg/png pictures of a game, he'll not be the only one :)
Weeelllll programs like irfanview tell you straight away it's a .webp with a wrong extension, do you want to change it? Clicking yes, changes the file to .webp and clicking no just opens it if you have the .webp extension installed ;) But yeah people will always complain, but if they aren't intelligent enough to open image files I'm not going to bother explaining them how to do it either :p We're in 2018 now, people should know how google works :p Besides if it's packed in an .rpa and people try to rip it open, it's their responsibility to find out how the crap works they're ripping apart ;)
 
  • Like
Reactions: anne O'nymous