How to organize 10.000 images in the script.rpy?

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
UserX
Newbie
Posts: 10
Joined: Wed Oct 25, 2017 5:29 pm
Contact:

How to organize 10.000 images in the script.rpy?

#1 Post 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???

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

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

#2 Post 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.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

UserX
Newbie
Posts: 10
Joined: Wed Oct 25, 2017 5:29 pm
Contact:

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

#3 Post 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.

UserX
Newbie
Posts: 10
Joined: Wed Oct 25, 2017 5:29 pm
Contact:

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

#4 Post 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!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

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

#5 Post 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.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

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

#6 Post 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.
Image

Image
Image

AXYPB
Regular
Posts: 95
Joined: Thu Sep 04, 2014 3:04 am
Github: AXYPB
Contact:

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

#7 Post 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.

User avatar
Ibitz
Regular
Posts: 63
Joined: Thu Jul 27, 2017 4:47 pm
Projects: Magical Disarray (WIP)
Organization: Ibitz Visual Novels
Deviantart: http://ibitz.deviant
itch: ibitz
Contact:

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

#8 Post 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.
Image

Ibitz is a self-taught coder/artist who works alone on their games. All games I create are freeware. If you need any help with coding or creating your game, just let me know. I'd be more than happy to help.

Post Reply

Who is online

Users browsing this forum: Alex