Questions about SnowBlossom and how to optimize it? (Solved)

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
User avatar
DarkChibiShadow
Regular
Posts: 67
Joined: Mon Jul 11, 2016 3:33 pm
Completed: Tomai (BxB), Disaster Log C (GxG), One-Eyed Lee P.1 (Point-and-click)
Projects: Solanaceae: After All
Tumblr: dcsart
Deviantart: DarkChibiShadow
itch: darkchibishadow
Contact:

Questions about SnowBlossom and how to optimize it? (Solved)

#1 Post by DarkChibiShadow »

Hey there!

This is my first time ever posting in the Ren'py Questions section of this forum, so hopefully what I write will make sense and be clear.
I'm an amateur coder who has finished 5+ games in Ren'py, and I like to use very simple coding to get stuff done, I don't really need many bells and whistles to accomplish what I want, especially since most of my games are kinetic novels/limited choice games.

That said, I do focus quite a lot on visuals, which has me using SnowBlossom more and more as well as custom transforms.

On to the specifics of the problems I'm having!

Firstly, Snowblossom shows behind images when I want it to show on top of images. (But I don't want it to show in front of busts!)
Specifically it shows on top of images that are "clickable" like a house or door you can click to enter a new area to explore.

Here's the code I'm currently using for most of my SnowBlossom effects (this is located in my first script file):

Code: Select all

image snowing:
    contains:
        SnowBlossom(("snow1"), count=20, border=100, xspeed=(40, 50), yspeed=(70, 100), start=5, fast=False, horizontal=False)
    contains:
        SnowBlossom(("snow2"), count=15, border=100, xspeed=(40, 50), yspeed=(50, 70), start=7, fast=False, horizontal=False)
    contains:
        SnowBlossom(("flake1v1"), count=10, border=100, xspeed=(40, 50), yspeed=(100, 50), start=5, fast=False, horizontal=False)
    contains:
        SnowBlossom(("flake2v2"), count=10, border=100, xspeed=(40, 50), yspeed=(30, 50), start=7, fast=False, horizontal=False)
And here's the code I use for my "clickables" (this is located in my screens file):

Code: Select all

screen ex_fennellib():
    imagebutton auto "arrow down_%s" action Jump("extown1_1") focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
I figure showing the SnowBlossom above the clickable is quite easy, but just something I've missed along the way. Keep in mind, I am a baby coder who only knows what I need to get by, so even if you think something might be obvious, tell me anyways, because it could help me.

Ideally I'm hoping the solution to this is easy and won't require me to overhaul a bunch of code, but if I have to, I will!

Secondly; I've noticed a lot of performance issues with SnowBlossom in general. Is my code simply not optimized, or does having Layeredimage busts cause problems with this specifically? I've noticed the performance with SnowBlossom is especially bad when using transforms like "moveinleft" or "moveinright" where the effect will jerk and stop when this happens.

Any clarification you have on SnowBlossom and how I can make it work better would be much appreciated.

Please be patient with me, as coding tends to take me a while to understand, but I am willing to learn and implement new things and really appreciate anyone who responds to this thread. Thank you!
Last edited by DarkChibiShadow on Sun May 31, 2020 5:24 pm, edited 1 time in total.
Image

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Questions about SnowBlossom and how to optimize it?

#2 Post by rayminator »

so you want it show in front of the image you would want use zorder

there a lot info here about zorder here
https://www.renpy.org/doc/html/search.h ... ea=default

User avatar
DarkChibiShadow
Regular
Posts: 67
Joined: Mon Jul 11, 2016 3:33 pm
Completed: Tomai (BxB), Disaster Log C (GxG), One-Eyed Lee P.1 (Point-and-click)
Projects: Solanaceae: After All
Tumblr: dcsart
Deviantart: DarkChibiShadow
itch: darkchibishadow
Contact:

Re: Questions about SnowBlossom and how to optimize it?

#3 Post by DarkChibiShadow »

rayminator wrote: Fri May 29, 2020 6:35 pm so you want it show in front of the image you would want use zorder

there a lot info here about zorder here
https://www.renpy.org/doc/html/search.h ... ea=default
Thank you for replying!

Do you have any examples of how zorder is used? How would I apply this to fix my problem?
Would I write something like, "show snow at zorder 1"?

I simply have no idea how to use this without seeing an example, and I cannot find any specific examples in the documentation, unless I missed something?
Image

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Questions about SnowBlossom and how to optimize it?

#4 Post by rayminator »

I will help you tomorrow cause I'm drunk right now not in less someone else help you to understand

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Questions about SnowBlossom and how to optimize it?

#5 Post by Per K Grok »

DarkChibiShadow wrote: Fri May 29, 2020 8:55 pm
----

Do you have any examples of how zorder is used? How would I apply this to fix my problem?
Would I write something like, "show snow at zorder 1"?
----
Almost, it should be;

show snow zorder 1

and you would want a high number for the image to go on top of all other images, so maybe;

show snow zorder 100


But you also need to consider that ren'py uses layers

https://www.renpy.org/doc/html/displaying_images.html

which means that stuff in the screen layer will always go on top of images rendered in the masters layer. Since some of the stuff you want to be behind snow is imagebuttons you might consider putting snow as an image in a screen.

Code: Select all


screen its_snowing():
    zorder 100
    
    add "snow"

User avatar
DarkChibiShadow
Regular
Posts: 67
Joined: Mon Jul 11, 2016 3:33 pm
Completed: Tomai (BxB), Disaster Log C (GxG), One-Eyed Lee P.1 (Point-and-click)
Projects: Solanaceae: After All
Tumblr: dcsart
Deviantart: DarkChibiShadow
itch: darkchibishadow
Contact:

Re: Questions about SnowBlossom and how to optimize it?

#6 Post by DarkChibiShadow »

Per K Grok wrote: Sun May 31, 2020 2:00 am
DarkChibiShadow wrote: Fri May 29, 2020 8:55 pm
----

Do you have any examples of how zorder is used? How would I apply this to fix my problem?
Would I write something like, "show snow at zorder 1"?
----
Almost, it should be;

show snow zorder 1

and you would want a high number for the image to go on top of all other images, so maybe;

show snow zorder 100


But you also need to consider that ren'py uses layers

https://www.renpy.org/doc/html/displaying_images.html

which means that stuff in the screen layer will always go on top of images rendered in the masters layer. Since some of the stuff you want to be behind snow is imagebuttons you might consider putting snow as an image in a screen.

Code: Select all


screen its_snowing():
    zorder 100
    
    add "snow"
Thank you so much for this! I really appreciate the example, and I think I'm starting to understand!

I also go the snow to go over the ImageButtons by simply re-arranging the order of my screen, which I can't believe is something I didn't think to do sooner!

Original code was like this:

Code: Select all

screen ex_wcentrance():
    add "snowing"
    imagebutton auto "wcgaurd_%s" action Jump("wcgaurd") focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
    imagebutton auto "arrow down_%s" action [Play("music","sound/main.ogg", fadein=5), Jump("exmap_1")] focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
    imagebutton auto "wcdoor_%s" action Jump("wintercress1") focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
    
New code is like this:

Code: Select all

screen ex_wcentrance():
    imagebutton auto "wcgaurd_%s" action Jump("wcgaurd") focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
    imagebutton auto "arrow down_%s" action [Play("music","sound/main.ogg", fadein=5), Jump("exmap_1")] focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
    imagebutton auto "wcdoor_%s" action Jump("wintercress1") focus_mask True activate_sound "sound/arrow.ogg" hover_sound "sound/hover.wav"
    add "snowing"
Not sure how I didn't try this sooner, I may have thought I tried it and thusly didn't try again, but regardless for now it seems like a very simple fix for this problem, if anyone else is setting up their screen with a SnowBlossom like I am.

I've also been aware that the jittering I see SnowBlossom experience when sprites move around may have to do with Ren'py's ability to render, and may just require an update in the future to fix. Which is fine, I'll find ways around this!

Thanks for your time everyone!
Image

Post Reply

Who is online

Users browsing this forum: barsunduk, Google [Bot]