Ren'Py image subdirectories

dick bullcock

Active Member
Aug 11, 2018
643
2,480
Hi!
Those are my first steps on Ren'Py.
I want to use subdirectories just for to sort the images. I have seen so good games with thousands of images in the images directory, but I need to sort them in subdirectories.
My trouble is that the images doesn't render in the game, and it must be a stupidity.

I have a image with this path:
game/images/intro/000.png

In the code, I try:

label intro:
scene intro 000
or
label intro:
show intro 000

but nothing.

I think I am coding bad the subdirectory, cause "intro 000" is being understand as intro_000.png, and not as intro/000.png


Thanks in advance!
 

Madmanator99

Member
May 1, 2018
225
466
My renpy is rusty but, try to define the path to the image before, with something like this :
image 000 = "images/intro/000.jpg"
then use :
scene 000
Also you could use a name that reflects the image path, in case you have a 000 in multiple folders, and to help you keep track, like:
image intro000 = "images/intro/000.jpg"
scene intro000
Finaly, you can have the image definitions in a seperate .rpy file, like an "images.rpy" and define your images there as you render.

There could be other ways to do that, but that's the one I remember.
 
Last edited:
  • Heart
Reactions: dick bullcock

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
It's a quirk of how images are assigned automatic displayable id tags.

Your game/images/intro/000.png is referenced as 000 not intro 000

Add these two lines somewhere in your code (ideally in the options.rpy file)...

Python:
define config.automatic_images = [ '/', ':', '_', '-' ]
define config.automatic_images_strip = [ "images" ]
This will process the full names of the images (relative to the /game/ folder), including the directory name - while removing specific characters and replacing them with [space]. It'll also remove the "images" directory name from the extracted names for good measure.

... now scene intro 000 with dissolve will work fine.

-or-
Keep all filenames unique, even though they are in different folders.

Edit:
As a slight aside...

The way RenPy organizes displayable tags is that the first tag in it's name can be regarded as the "primary-id" tag.

A group of images like:
  • eileen summerdress happy
  • eileen summerdress neutral
  • eileen summerdress sad
  • eileen jeans happy
  • eileen jeans neutral
  • etc.
Are all primarily eileen. It's important because only one eileen can shown on the screen at a time.

show eileen jeans happy at left
... will be replaced when ...
show eileen jeans sad at right
... is used

It's why some of the RenPy examples have all background images prefixed as "bg".

I mention it because it might affect how you structure your folder names. A lot of devs end up with folder names like /images/chapter1/ or /images/scene01/, which isn't really how this "auto import all image names" is designed to work. Of course, anything that works is good enough. So maybe consider something like /game/images/bg/scene01/ for example.
 
Last edited:

dick bullcock

Active Member
Aug 11, 2018
643
2,480
My renpy is rusty but, try to define the path to the image before, with something like this :
image 000 = "images/intro/000.jpg"
then use : scene 000

Also you could use a name that reflects the image path, in case you have a 000 in multiple folders, and to help you keep track, like:
image intro000 = "images/intro/000.jpg"
then : scene intro000

Finaly, you can have the image definitions in a seperate .rpy file, like an "images.rpy" and define your images there as you render.

There could be other ways to do that, but that's the one I remember.
Thanks a lot Madmanator99 , it is a great help, I will use it. Thanks a lot!
 

dick bullcock

Active Member
Aug 11, 2018
643
2,480
It's a quirk of how images are assigned automatic displayable id tags.

Your game/images/intro/000.png is referenced as 000 not intro 000

Add these two lines somewhere in your code (ideally in the options.rpy file)...

Python:
define config.automatic_images = [ '/', ':', '_', '-' ]
define config.automatic_images_strip = [ "images" ]
This will process the full names of the images (relative to the /game/ folder), including the directory name - while removing specific characters and replacing them with [space]. It'll also remove the "images" directory name from the extracted names for good measure.

... now scene intro 000 with dissolve will work fine.

-or-
Keep all filenames unique, even though they are in different folders.

Edit:
As a slight aside...

The way RenPy organizes displayable tags is that the first tag in it's name can be regarded as the "primary-id" tag.

A group of images like:
  • eileen summerdress happy
  • eileen summerdress neutral
  • eileen summerdress sad
  • eileen jeans happy
  • eileen jeans neutral
  • etc.
Are all primarily eileen. It's important because only one eileen can shown on the screen at a time.

show eileen jeans happy at left
... will be replaced when ...
show eileen jeans sad at right
... is used

It's why some of the RenPy examples have all background images prefixed as "bg".

I mention it because it might affect how you structure your folder names. A lot of devs end up with folder names like /images/chapter1/ or /images/scene01/, which isn't really how this "auto import all image names" is designed to work. Of course, anything that works is good enough. So maybe consider something like /game/images/bg/scene01/ for example.
Great 79flavors !!!! Your answer is the text I missed in the Ren'Py page, it is just all the info I was looking for.
Thanks a lot!