Ren'Py [solved] Stop transitions from affecting BG layer

Lou111

Active Member
Jun 2, 2018
538
680
I feel like I just took 100 steps backwards in my coding progress...
I have assigned a new layer underneath the "master" layer which houses the BG image via a simple screen that updates based on the variable tracking the player's current location.

Using:
Python:
show image "imagename.jpg" as img1 at truecenter with dissolve
consumes ALL and dissolves the BG with that delicious checker-board background.

Of course, I want it to stop doing that...
Using the screen outside of my game loop has the same effect...

Sorry for the 101 question guys but I've been at it for a while.


Edit:

Here's the screen for the BG image just incase.
If there's a less clammy way to display a screen on a specific layer that'd also be good to know...
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

Lou111

Active Member
Jun 2, 2018
538
680
My Background Image Journey
While I wait for someone to swoop in and save my ass from my plight I'd though I'd include how I reached this point.
Read at your own risk.
This will probably not add any value to your life unless you're in the same boat or if you find amateur coder struggles amusing.
Assume that everything I say is, in one way or another, incorrect.

My experience with using scene, show image and screens for BG images specifically with games that utilize media files and images.

Scene
Using scene is by far the most simple and most popular use for creating a background from my experience. This is fine for the average game but loses more and more of it's value as my games grew more complicated. What I learned is that scene isn't a cute a fluffy word that creates a new scene for me, in reality, it's a tool of destruction and malice used to wipe all existence away. It takes an argument for a new BG but it should really be named annihilation...

I had to stop using this when I needed videos to continue to play seamlessly even after changing locations or backgrounds. I could just as easily change the BG during the scene using show image but then... why was I using scene to begin with again? Which enabled me to transition to my next method:

Show Image
Just show the BG as image! Using something like show image "imagename.jpg" as bgimage is pretty simple and interactive... I can just swap out the BG by typing in a new name as bgimage and it even continues to show behind the images that are on top of it. Pretty neat. There were times when the BG showed over my images for one reason or another and had to include the behind argument when showing the image. Very interactive and easy to use for beginners but something about it clashed with my style... and it's a lot of writing. But anything is better than scene, right? That's when I followed someone's guide and discovered that I can cut out the writing by using screens!

Screens
Make a screen, add the BG... Done! Except you BG is now on the "screens" layer. Good luck showing my images and videos now because they'll all take place behind the BG. Now I've got a whole new bag of shit to deal with. No worries... I'll just display my images and videos on the screen layer! True story bro, I made and entire game demo using this method, my driving factor being to make this work somehow. It was a disaster. I'm sure there's a way to use transitions within screens and all that but after 4 weeks of learning how to manipulate what used to be as simple as show into some crazy ass screen syntax only to find that I'm restricting my content and pushing myself to the limit because all I want is a screen to display my freakin BG....

I mean whatever. Let's just say using that method isn't for kids and it's beyond my scope right now. ALL I WANT... is a screen with my BG. So I drank some coffee and brought out my darkness though I may be damned, and decided that I'll just use one screen and put it on a different layer. First thing I learned is that putting it on the "master" layer (the same layer as my images) but that shows over everything too. Although, I'm pretty sure there's a way to use it there... I instead put the screen on a newly created layer underneath the "master" layer and now... MONTHS later my issue is that it takes on the properties of any transition I use above it. I shouldn't even be here!

So while I feel that if someone provides a solution to my query above that I'll finally be able to settle on an end-all method for displaying BGs, as you can see, there's probably something I have still yet to consider. The journey continues.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,284
Using:
Python:
show image "imagename.jpg" as img1 at truecenter with dissolve
consumes ALL and dissolves the BG with that delicious checker-board background.
To do its transition, Ren'Py need two images. The first one, that will be the starting point of the effect, is the image actually displayed on the given layer. And the second one will be the image provided by the instruction.

If the transition happen with the default background, this probably mean that there's no image actually displayed on the given layer.


My brain have been fried by my morning meeting, and I've a mod to works on, so I let someone else figure the solution. It shouldn't be too difficult, but I guess it need a rewrite of your code.
 
  • Love
Reactions: Lou111

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,989
6,998
My Background Image Journey
While I wait for someone to swoop in and save my ass from my plight I'd though I'd include how I reached this point.
Read at your own risk.
This will probably not add any value to your life unless you're in the same boat or if you find amateur coder struggles amusing.
Assume that everything I say is, in one way or another, incorrect.

My experience with using scene, show image and screens for BG images specifically with games that utilize media files and images.

Scene
Using scene is by far the most simple and most popular use for creating a background from my experience. This is fine for the average game but loses more and more of it's value as my games grew more complicated. What I learned is that scene isn't a cute a fluffy word that creates a new scene for me, in reality, it's a tool of destruction and malice used to wipe all existence away. It takes an argument for a new BG but it should really be named annihilation...

I had to stop using this when I needed videos to continue to play seamlessly even after changing locations or backgrounds...
Have you ever tried to use start_image and image parameters the way Ren'Py Wiki describes and Rich suggests here to make video transitions seamless?

The problem with using show statement instead of the scene is that when you transition from one video directly to the next one and want to make that transition seamless and you don't "annihilate" the previous video in the process, you will have two full screen, possibly HD videos playing at the same time and it will put a lot of stress on somewhat older computers, making the top video to start to drop frames, stutter until you hide the video that plays behind the top video.
Using scene will ensure that you end up having only the last video playing, but if you don't use a start image, you may see the transparent background checkerboard for a few frames, until the video starts to play. A start image will eliminate that transition problem.
Using image parameter helps you to end up with an image after playing a video that doesn't loop (loop = False), so you could play the video as a scene, not an image on top of a scene.
 
Last edited:
  • Love
Reactions: Lou111

Lou111

Active Member
Jun 2, 2018
538
680
If the transition happen with the default background, this probably mean that there's no image actually displayed on the given layer.
Don't work too hard!

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.


I think I may have answered my own question by typing this out like this... it's the scene line isn't it?...
Perhaps a blank png background will work...
 
Last edited:

Lou111

Active Member
Jun 2, 2018
538
680
Have you ever tried to use start_image and image parameters the way Ren'Py Wiki describes and Rich suggests here to make video transitions seamless?

The problem with using show statement instead of the scene is that when you transition from one video directly to the next one and want to make that transition seamless and you don't "annihilate" the previous video in the process, you will have two full screen, possibly HD videos playing at the same time and it will put a lot of stress on somewhat older computers, making the top video to start to drop frames, stutter until you hide the video that plays behind the top video.
Using scene will ensure that you end up having only the last video playing, but if you don't use a start image, you may see the transparent background checkerboard for a few frames, until the video starts to play. A start image will eliminate that transition problem.
Using image parameter helps you to end up with an image after playing a video that doesn't loop (loop = False), so you could play the video as a scene, not an image on top of a scene.
Thank you, Penfold! I have more to add here but I'm late for work! :LOL:
I'll clarify once theyre finished working me into the ground
 

Lou111

Active Member
Jun 2, 2018
538
680
I think I may have answered my own question by typing this out like this... it's the scene line isn't it?...
Perhaps a blank png background will work...
Negative. Blank png still shows the checkerboard...
 

Lou111

Active Member
Jun 2, 2018
538
680
Penfold Mole

So to clarify,
I don't have an issue with transitioning from one video to another, what I meant was transitioning from one background to another while the video continues to play without interruption. Using scene stops all videos, and if one is playing within a screen, it restarts it in some cases. I had a game where a real-time event was taking place in a side-bar and the MC was able to traverse to different locations in the meantime... scene made it impossible to stomach. Me and scene don't get along.
 

Lou111

Active Member
Jun 2, 2018
538
680
What a hot mess...
I found a way to get it to stop getting all dissolvy on me but it isn't pretty.


Python:
screen BG_IMAGE():
    # I randomly added this out of frustration and it worked...
    layer "bglayer"
    add BG_image at truecenter

Python:
label start:
    # Remove that black screen, no idea how it's there
    scene blank_1
    # Show the screen in the script rather than attaching it to another screen
    show screen BG_IMAGE 
    # works
    show image "images/misc/delete.jpg" as img1 at truecenter
    "..."
    # and works
    show image "images/misc/delete2.jpg" as img1 at truecenter with dissolve
    "..."
-Using any screen to show the BG screen didn't work
-Using a screen to show the screen on a specific layer didn't work

-Changing the current location variable automatically updated the screen and the BG changed

My concern now is what issues should I anticipate if I simply show the screen at the start of the game?
Something doesn't feel right... Is the case solved?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,284
I found a way to get it to stop getting all dissolvy on me but it isn't pretty.

I'm totally not sure if dictionary transition would works here, but what if you try something like this ?
Code:
define dissolveWithBg = { "bglayer": Dissolve( 1.0 ), "master": Dissolve( 1.0 ) }

label whatever:
    show screen BG_IMAGE
    show image "images/misc/delete.jpg" as img1 at truecenter
    "..."
    show image "images/misc/delete2.jpg" as img1 at truecenter with dissolveWithBg
    "..."

Now, like I initially said, and as far as I understood your intent, a small rewrite of your code should fix the issue more surely:
Python:
# Contain the name of the background actually displayed.
# Note that it's just its name, the path should NOT be included.
default BG_image = "background1.jpg"

label whatever:
    # Display the background as a dynamic image.
    # It rely of the same kind of text interpolation that for the dialog. Therefore
    # "[BG_image]" will be replaced by the value of /BG_image/.
    # But the real interest come later...
    scene image "images/background/[BG_image]"
    # Show your sprite.
    show image "images/misc/delete.jpg" as img1 at truecenter
    "..."
    # Replace it with a transition.
    show image "images/misc/delete2.jpg" as img1 at truecenter with dissolve
    # Here come the interest of text interpolation into an image declaration:    
    # The image change in real time when the value of the variable change.
    $ BG_image = "background2.jpg"
    "Hey ! The background changed."
 
  • Love
Reactions: Lou111

Lou111

Active Member
Jun 2, 2018
538
680
I'm totally not sure if dictionary transition would works here, but what if you try something like this ?
Code:
define dissolveWithBg = { "bglayer": Dissolve( 1.0 ), "master": Dissolve( 1.0 ) }

label whatever:
    show screen BG_IMAGE
    show image "images/misc/delete.jpg" as img1 at truecenter
    "..."
    show image "images/misc/delete2.jpg" as img1 at truecenter with dissolveWithBg
    "..."

Now, like I initially said, and as far as I understood your intent, a small rewrite of your code should fix the issue more surely:
Python:
# Contain the name of the background actually displayed.
# Note that it's just its name, the path should NOT be included.
default BG_image = "background1.jpg"

label whatever:
    # Display the background as a dynamic image.
    # It rely of the same kind of text interpolation that for the dialog. Therefore
    # "[BG_image]" will be replaced by the value of /BG_image/.
    # But the real interest come later...
    scene image "images/background/[BG_image]"
    # Show your sprite.
    show image "images/misc/delete.jpg" as img1 at truecenter
    "..."
    # Replace it with a transition.
    show image "images/misc/delete2.jpg" as img1 at truecenter with dissolve
    # Here come the interest of text interpolation into an image declaration:   
    # The image change in real time when the value of the variable change.
    $ BG_image = "background2.jpg"
    "Hey ! The background changed."
I'm going to name my first child after you.
I had no idea that I could use transitions on layers like that.
But the biggest takeaway for me is that I need to chill and keep it simple... I'm trying to do big-boy stuff with kiddy-fingers.
The example you've given me is with within my understanding and should serve my purposes.
Thanks as always!