How Ren'Py handles the memory?
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.
- killdream
- Veteran
- Posts: 325
- Joined: Wed Nov 05, 2008 1:05 pm
- Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
- Deviantart: robotlolita
- Github: robotlolita
- Location: World's End (aka Brazil)
- Contact:
How Ren'Py handles the memory?
Actually it's a lousy title, sorry i.i
Well, I was playing with the particles factory to create a falling snow effect. Particles should fade over the course of time, and since I couldn't do that with At functions I decided to put a im.alpha to change the alpha in every frame (yes, a lousy workaround as well). It works just perfecly, but it's not much memory effective.
Does Ren'Py caches every result of a im function? (That would explain why memory keeps increasing as long as the particles are on screen) And if it does, is there some way of actually turning this cache function off?
Well, I was playing with the particles factory to create a falling snow effect. Particles should fade over the course of time, and since I couldn't do that with At functions I decided to put a im.alpha to change the alpha in every frame (yes, a lousy workaround as well). It works just perfecly, but it's not much memory effective.
Does Ren'Py caches every result of a im function? (That would explain why memory keeps increasing as long as the particles are on screen) And if it does, is there some way of actually turning this cache function off?
Re: How Ren'Py handles the memory?
From the documentation:
Caching. By default, image manipulators are cached in memory before they are loaded. Supplying the cache=False argument to an image manipulator will prevent this caching. This should only be used when an image manipulator is never used directly (such as by an image statement).
Re: How Ren'Py handles the memory?
On second thought, maybe should NOT disable caching, because renpy would have to apply alpha to each particle every time it is drawn, and that could cause performance problems. How about pre-computing the different faded versions of the particles? This is going to use more memory than not caching at all, but on the other hand it could be smoother than blending particles every time.
Re: How Ren'Py handles the memory?
But then, if you're - say - doing a rotation based on how long the displayable has been displayed, you rapidly run out of memory as Ren'Py caches millions of ever-so-slightly-different result images just on the very unlikely off-chance that it's going to be able to re-use one of them again later.Cynebeald wrote:On second thought, maybe should NOT disable caching, because renpy would have to apply alpha to each particle every time it is drawn, and that could cause performance problems.
Serously, the naïve approach to this ran my 2GB Windows machine out of memory in about 2.5 seconds, when I was working with zooming an 800x600 graphic.
(And speaking of gaps in the documentation, since each of the im.* manipulators has its own page, it would be a good idea to mention the cache and rle parameters on those pages - or at least mention that there are other params common to all manipulators which aren't described on that page. I'd just gone straight to the im.FactorZoom page and missed that there was a cache parameter at all, originally.)
Server error: user 'Jake' not found
- killdream
- Veteran
- Posts: 325
- Joined: Wed Nov 05, 2008 1:05 pm
- Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
- Deviantart: robotlolita
- Github: robotlolita
- Location: World's End (aka Brazil)
- Contact:
Re: How Ren'Py handles the memory?
Hm, yep, I changed it to precompute all possible images in an array in the particles factory, it works very nice since the particles are really small, thanks for the advice ^^
And yeah, I always go to the function index reference too, so I didn't found out about the caching/rle stuff. But well, Ren'Py documentation is a wiki after all, so I think anyone can workaround this in their free-time (guess I'll write some doc examples later)
Hm, and actually SDL can manage some effects in real-time without caching stuff - I used some in my tetris game, they'd work just fine besides the fact of pygame being really high-level (maybe it'll be better when they change to pygame 2.0, implementing SDL gfx would help, but I think using OpenGL would make Ren'Py _really_ better * support to 3d transforms in a 2d enviroment would be nice for lots of effects *)
And yeah, I always go to the function index reference too, so I didn't found out about the caching/rle stuff. But well, Ren'Py documentation is a wiki after all, so I think anyone can workaround this in their free-time (guess I'll write some doc examples later)
Hm, and actually SDL can manage some effects in real-time without caching stuff - I used some in my tetris game, they'd work just fine besides the fact of pygame being really high-level (maybe it'll be better when they change to pygame 2.0, implementing SDL gfx would help, but I think using OpenGL would make Ren'Py _really_ better * support to 3d transforms in a 2d enviroment would be nice for lots of effects *)
-
- Eileen-Class Veteran
- Posts: 1314
- Joined: Mon Sep 19, 2005 2:15 am
- Completed: Controlled Chaos / Sum of the Parts / "that" Midna game with ZONEsama
- Projects: Sparse Series/Oddments Shop original cartoon in Pevrea; Cybernetic Duels (fighting game); Good Vibin'
- Organization: Watercolorheart Studios
- IRC Nick: BCS
- Tumblr: adminwatercolor
- Deviantart: itsmywatercolorheart
- Github: Watercolordevdev
- Skype: heartnotes
- Soundcloud: Watercollider
- itch: watercolorheart
- Location: Florida
- Contact:
Re: How Ren'Py handles the memory?
I wish I could find a tutorial for particles in Ren'Py.... I keep on trying to learn how to use them in Ren'Py, failing miserably, and then use another program to make them and export an image series or some such .... like 10 frames for water, 5 frames for rain behind a window, 8 frames for fire flickering...
The documentation on the factories and what each tuple is leaves me more confused than it did before I even tried to make, say, bubbles or rain.
The documentation on the factories and what each tuple is leaves me more confused than it did before I even tried to make, say, bubbles or rain.
I'm not even the same person anymore
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: How Ren'Py handles the memory?
This.BCS wrote:The documentation on the factories and what each tuple is leaves me more confused than it did before I even tried to make, say, bubbles or rain.
Until then, SnowBlossom is good enough for snow, rain, leaves, mists, etc. Coupled with randomness and different spline movement per particle (is this even possible?), you can have some really cool effects. For example, snowflakes don't drop horizontally on the ground, they wiggle in all directions before they drop to the floor. I sense that a combination of low-frequency sine and cosine curves (one used for horizontal, one for vertical direction), would give enough wiggleness for that. A random wiggle curve would probably be even better.
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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: How Ren'Py handles the memory?
It's possible with Particles but not SnowBlossom.
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
- killdream
- Veteran
- Posts: 325
- Joined: Wed Nov 05, 2008 1:05 pm
- Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
- Deviantart: robotlolita
- Github: robotlolita
- Location: World's End (aka Brazil)
- Contact:
Re: How Ren'Py handles the memory?
Well, actually the only thing you really need is to apply wind's force in the particles (you apply random window force so it looks more real, without sine/cosine based curves that are really not efficient and not needed too), so they seem more real. In my case I needed particles of different sizes (that looks like it have some depth, as particles falling far from the screen will appear smaller than those falling near the screen) and that faded as they felt (I don't remember why I wanted it, though, I already changed the main menu alot .-.).
If someone wants it, I can comment better the code and share it.
This is more or less how the effects look, actually (aside that it falls faster in mine, but the logic is pretty much the same)
http://www.kirupa.com/developer/flash8/snow.htm
If someone wants it, I can comment better the code and share it.
This is more or less how the effects look, actually (aside that it falls faster in mine, but the logic is pretty much the same)
http://www.kirupa.com/developer/flash8/snow.htm
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: How Ren'Py handles the memory?
Cookbook it?killdream wrote:If someone wants it, I can comment better the code and share it.
This is more or less how the effects look, actually (aside that it falls faster in mine, but the logic is pretty much the same)
http://www.kirupa.com/developer/flash8/snow.htm
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
- jack_norton
- Lemma-Class Veteran
- Posts: 4085
- Joined: Mon Jul 21, 2008 5:41 pm
- Completed: Too many! See my homepage
- Projects: A lot! See www.winterwolves.com
- Tumblr: winterwolvesgames
- Contact:
Re: How Ren'Py handles the memory?
Nice effect, yes I think could be a valuable addition to the cookbook.
- killdream
- Veteran
- Posts: 325
- Joined: Wed Nov 05, 2008 1:05 pm
- Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
- Deviantart: robotlolita
- Github: robotlolita
- Location: World's End (aka Brazil)
- Contact:
Re: How Ren'Py handles the memory?
Cookbook'd =D
I took a while to comment/rewrite the code in a more generic way. Things are pretty much chaotic here, since the dead line for the demo of my first commercial project is comming closer and... there's loooot of work to do i.i (though, I'm not the most doomed one, since I'm doing just programming)
I took a while to comment/rewrite the code in a more generic way. Things are pretty much chaotic here, since the dead line for the demo of my first commercial project is comming closer and... there's loooot of work to do i.i (though, I'm not the most doomed one, since I'm doing just programming)
- jack_norton
- Lemma-Class Veteran
- Posts: 4085
- Joined: Mon Jul 21, 2008 5:41 pm
- Completed: Too many! See my homepage
- Projects: A lot! See www.winterwolves.com
- Tumblr: winterwolvesgames
- Contact:
Re: How Ren'Py handles the memory?
What game are you making? a normal one or a hentai game?
- killdream
- Veteran
- Posts: 325
- Joined: Wed Nov 05, 2008 1:05 pm
- Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
- Deviantart: robotlolita
- Github: robotlolita
- Location: World's End (aka Brazil)
- Contact:
Re: How Ren'Py handles the memory?
I can't do this kind of games, I'm a christian protestant guy after all. And although I don't mind reading/playing games that can have sexual content if the story is great, I'm not a fan of it myself and wouldn't put it just for fanservice.jack_norton wrote:What game are you making? a normal one or a hentai game?
The commercial project is an hybrid VN/RPG game. Can't say much about the story and such for now
And, no, the game doesn't have christian/whatever messages in it =D
Re: How Ren'Py handles the memory?
=OCynebeald wrote:From the documentation:Caching. By default, image manipulators are cached in memory before they are loaded. Supplying the cache=False argument to an image manipulator will prevent this caching. This should only be used when an image manipulator is never used directly (such as by an image statement).
Can you select to prevent caching for entire UI widgets / layers ? I couldn't find anything about it in the UI functions docs.
Also, is there a way to lower the graphics cache limit ?
Who is online
Users browsing this forum: Majestic-12 [Bot]