Page 1 of 1

How to organize 10.000 images in the script.rpy?

Posted: Sun Oct 29, 2017 7:14 pm
by UserX
Currently I'm using 1000 images in my script but at the end of the game there gonna be about 10.000! How can I folder them inside the script.rpy so that I don't have 1000000 lines at the end???

Re: How to organize 10.000 images in the script.rpy?

Posted: Sun Oct 29, 2017 8:20 pm
by Imperf3kt
I'll ignore the reason why you have so many and just suggest you create a new "images.rpy" and define your images in that.

Re: How to organize 10.000 images in the script.rpy?

Posted: Sun Oct 29, 2017 8:38 pm
by UserX
Ok, but how do I open that special "images.rpy"? I'm using Atom and it creates only "untitled" new tabs! I don't know how to rename them. If this is the right way at all.

Re: How to organize 10.000 images in the script.rpy?

Posted: Sun Oct 29, 2017 8:47 pm
by UserX
Never mind. I've just copied the screens.rpy and renamed to images.rpy. Moved all the image files in images.rpy and it worked!

Re: How to organize 10.000 images in the script.rpy?

Posted: Sun Oct 29, 2017 9:05 pm
by Imperf3kt
You could name it anything, 'images' was just a fitting name.
You could also break up your game this way, it is commonly used to separate chapters.

Additionally, an .rpy file is actually just a .txt file with a custom extension. You could create 'myfile.txt' and then rename it 'myfile.rpy' and it would work.
Its the .rpyc (RenPY Compiled) files that matter, which renpy makes automatically.

Re: How to organize 10.000 images in the script.rpy?

Posted: Sun Oct 29, 2017 11:41 pm
by noeinan
Since a few updates ago, Ren'Py automatically defines your images if you go into your game folder and create a new folder called "images". You just have to put all the image files in there, and name them according to how you would define them. It is okay if they are in multiple folders, too.

For example, I have game/images/bg for my backgrounds, then the file names are like "bg forest". I can then type "scene bg forest" in the code, without having to define the images at all.

Re: How to organize 10.000 images in the script.rpy?

Posted: Mon Oct 30, 2017 12:12 am
by AXYPB
I use a battery of im.Composite() manipulators to produce variations in facial expressions as a means to reduce image file size. Character images are created in two parts: one of the character's body without any facial features, and many more containing only eyes, mouth, nose, and other such features. These images are composed two at a time to create the emotions of a single character, rather than many images that share a large amount of redundant data. It is a very effective technique that can reduce the total file size of a project significantly, but all such files must be defined manually. A file that I name define.rpy contains hundreds of image statements that I would not need to edit or review after confirming that they display correctly. If you want to sort these image names alphabetically in your script, advanced text editors such as Notepad++ and EditPad have functions to sort select lines in that manner. I use the professional edition of the latter for all of my scripting tasks, as it is much more feature-rich than the text editors packaged with Ren'Py.

Re: How to organize 10.000 images in the script.rpy?

Posted: Tue Oct 31, 2017 2:38 am
by Ibitz
Notepad is going to be your friend. I use notepad and, in my case, an unusable file in Editra that I write up all my images in. For my current demo, I have 501 images total. I separated them into categories (SFX/CGS/Menus/Sprites/Backgrounds, etc.) and then further categorized them (by character, route, chapter, etc.). Using # (which can't be read by Ren'Py as part of your script) is a good way to bounce back and forth between categories and to find images in your code. I use those and then, in the unusable Editra file, basically make a list of all the images I use and their shortcut codes. I also do the same thing, but split up images by category, in Notepad. I have all of these things open while I work on my game. It seems like a lot of work, but it's actually worth it. I just finished my first of 3 demos in a few months (which is good, since I work alone) and having the ability to copy and paste quickly, really helped get me there.