Hii... It's me again. ^^"
If you don't mind, I'd like to ask a question.
Are there ways to retrieve a cached image by integer?
I've already used two ways to do similar things, in the past.
Like naming the actual files as the corresponding integers, then I can convert the integer to a string and it accesses the file directly from the integer. That does make the filenames harder to understand though.
And I've also used a list of the filenames, and pass the index to it to get the actual filename. Which works, except it's additional work, and feels redundant since renpy already caches the images.
...Now that I think about it, though, I haven't seen anything to suggest that renpy even assigns an integer id to images.
Does any of you have any thoughts about this?
Retrieving cached images?
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.
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.
Retrieving cached images?
Phoenix Star - Persistence, perseverance, ambition.
...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Deviant Art: ...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Discord: saltome
Itch: Phoenix Start
Re: Retrieving cached images?
What's the advantage of using integers instead of strings?
Re: Retrieving cached images?
Well, in most cases integers require less memory. Which also leads to performance increase.
As far as normal use of renpy goes it really isn't worth worrying about.
But if you go and make something more intensive, it slowly adds up.
As far as normal use of renpy goes it really isn't worth worrying about.
But if you go and make something more intensive, it slowly adds up.
Phoenix Star - Persistence, perseverance, ambition.
...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Deviant Art: ...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Discord: saltome
Itch: Phoenix Start
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Retrieving cached images?
I think there's a faulty premise here. Ren'Py uses filenames, not integers, to represent images.
in general, this is a case of premature optimization. A VN has a lot of things that take up memory - images, music files, etc. (Images have to be stored in RAM at 4 bytes per pixel, while the buffering of a music file will take up .5 MB per track.) Unless you're doing something completely absurd involving generated code, saving a few bytes per show and hide statement won't matter.
in general, this is a case of premature optimization. A VN has a lot of things that take up memory - images, music files, etc. (Images have to be stored in RAM at 4 bytes per pixel, while the buffering of a music file will take up .5 MB per track.) Unless you're doing something completely absurd involving generated code, saving a few bytes per show and hide statement won't matter.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Who is online
Users browsing this forum: No registered users