Ren'Py Previous image appearing at the beginning of the next image

Scapest

Newbie
Jul 8, 2017
98
56
Hi guys, I'm having a problem where, when I call another scene, the previous image appears for a brief moment.
Am I referencing the images incorrectly? I always refer to the location where the image is, because I think it's easier to know what I'm doing that way.
Is it because I'm using labels? This is the way I learned.

Here's an image button for the character. When you click it, it starts the quest.
You don't have permission to view the spoiler content. Log in or register now.


This is what happens when it's clicked.
You don't have permission to view the spoiler content. Log in or register now.



Here's where the quest scenes are displayed.
You don't have permission to view the spoiler content. Log in or register now.

Here's where the problem starts: when I try to display another scene, it shows the last image from the previous scene.
You don't have permission to view the spoiler content. Log in or register now.


Is the way I'm calling the images wrong? Am I showing the entire path to the folder, or do I need to do something before changing the labels? Do I need to somehow end the previous label? It's like there's a buffer, and I'm not removing it.
Thank you in advance.
 
Last edited:

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,180
3,620
You will generally be better off using the "scene" command, not "show", for background images.

"scene" will show an image (or any displayable) on the background layer. subsequent calls to "scene" will replace the previous image.

"show" will show an image on a foreground layer. the next "show" will not replace the previous image (unless you use alias or tags to do so - this is a bit more complicated but is covered in the docs), instead it will just render another image in front of all the previous shown images. This is why you would need to manually "hide" images as well.

The intention in Renpy for it's original Japanese "Renai" Visual Novel purpose was to have "scene" for the static backgrounds, and "show" for the character sprites (tachi-e) in the foreground.

In many recent western renpy games with 3d daz etc images, every image is a fullscreen render including the characters in the image, so using just "scene" to replace these one after another is a valid and effective way to do it.
 
  • Like
Reactions: Twistty

Scapest

Newbie
Jul 8, 2017
98
56
You will generally be better off using the "scene" command, not "show", for background images.

"scene" will show an image (or any displayable) on the background layer. subsequent calls to "scene" will replace the previous image.

"show" will show an image on a foreground layer. the next "show" will not replace the previous image (unless you use alias or tags to do so - this is a bit more complicated but is covered in the docs), instead it will just render another image in front of all the previous shown images. This is why you would need to manually "hide" images as well.

The intention in Renpy for it's original Japanese "Renai" Visual Novel purpose was to have "scene" for the static backgrounds, and "show" for the character sprites (tachi-e) in the foreground.

In many recent western renpy games with 3d daz etc images, every image is a fullscreen render including the characters in the image, so using just "scene" to replace these one after another is a valid and effective way to do it.
I understand. I only used "show" on the idle, but I can change that. However, this problem happens even if I just put the two label codes (Part3 and Part 4) in another empty project. Here's the video showing what's happening.

 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,180
3,620
I still believe the flash of image is related to the use of "show" and not properly hiding those images before showing new images with "scene". Stick to "scene" everywhere unless there is a need to specifically show something over the top.

Secondly:

I appreciate that you're working hard on this stuff, but I think you have kind of backed yourself into a corner with the way you are building the quest progress and jumping around from label to label. It's totally normal for a beginner game developer to progress from "simple linear story" to "using flags and jumps", and it works fine for mainly linear simple games with a few choices... but that structure is not going to work for a complex game.

A better design is to use a series of "decision hub" style labels that determine where your next step will lead along various quest lines. Then in your menus, rather than jumping to a new label and having conditionals (which will get VERY complex as time goes by), you should set flags (or even better change the state of a quest state machine) to indicate the next step in that quest. and at the end return to the "hub" to decide what label to jump to show the next progress.

If you have an open-world/sandbox design as well as a quest based story, it gets a bit more complex as you need to call to an "event detector" as well whenever your character enters relevant locations. But it is possible (even perhaps mandatory to control the complexity!) to combine all of these systems - hub based navigation, per-location event detectors, statemachine quest tracking.

This comment captures part of what I am trying to say:

Another approach is to find some successful games that are doing what you want to see gameplay wise, and using Unren to decompile them and read the code to learn how it works.

Also, I will place a bet with 95% confidence that Annonymous is going to appear in this thread and destroy your code examples, and then give you much better examples on how to do it :ROFLMAO:
 
  • Like
Reactions: Scapest

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,263
15,073
Here's where the problem starts: when I try to display another scene, it shows the last image from the previous scene.
Code:
label show_mc_message:
        $ unclickable = True
        $ renpy.pause (0.5, hard=True)
        scene image "Home/MCRoom/McRoom1.jpg" with dissolve
        n "I should check the computer; maybe I can find a place that's available for rent."
        $ unclickable = False
        jump mc_room
I must have misunderstood the issue, because I don't see why someone would be surprised that the previous image is shown for half a second, when the code he wrote explicitly ask Ren'Py to wait half a second before replacing the previous image.



A better design is to use a series of "decision hub" style labels that determine where your next step will lead along various quest lines. Then in your menus, rather than jumping to a new label and having conditionals (which will get VERY complex as time goes by), you should set flags (or even better change the state of a quest state machine) to indicate the next step in that quest. and at the end return to the "hub" to decide what label to jump to show the next progress.
Or, for an approach that don't rely on condition, name the quest step and rely on Ren'Py dynamism:
Python:
define questWhatever  = None

label bedroomHub:
    if questWhatever and renpy.has_label( "bedroom_" + questWhatever ):
        jump expression "bedroom_" + questWhatever
    else:
        jump bedroom_default

label bedroom_default:
    [default scene when there's no quest in progress]

label bedroom_firstEncounter:
    [scene corresponding to the quest stage name "firstEncounter"]

label bedroom_firstKiss:
    [scene corresponding to the quest stage name "firstKiss"]

[...]

Also, I will place a bet with 95% confidence that Annonymous is going to appear in this thread and destroy your code examples, and then give you much better examples on how to do it :ROFLMAO:
And what if instead I destroy your writing of my nickname ? :cautious: :D


This said, I only took a real look at the "it's where it happen". Yet I noticed two things.

Firstly, the implicit jumps. This is not really a good idea for a complex game.

Secondly I wonder why the use of "unclickable".
Python:
               $ unclickable = False
                call screen mai_room
The buttons only exist when the screen is displayed, and the screen is displayed only during the time it's called, while stopping to exist the instant you Jump out of it.
 
  • Like
Reactions: Scapest

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
867
1,868
You put a hard pause right before your scene... that's probably causing the momentary blink.

Also, why are you doing the scene statements using image and then a full path? And why are you putting game images outside the default image directory?

If you put those images anywhere in your game/images/ folder, renpy will find them automatically and you only need to use their file name and not even their extension. You can still separate and sort them using nested directories... as long as they are under game/images/

So instead of scene image "Home/MaiRoom/Maiara3.jpg" ...

you could put those images in game/images/home/mailroom/Maiara3.jpg and then just call them like this...

scene Maiara3

That's a lot less typing and I am a firm believer in less is more.
 
  • Red Heart
Reactions: Scapest

Scapest

Newbie
Jul 8, 2017
98
56
@osanaiko

I must have misunderstood the issue, because I don't see why someone would be surprised that the previous image is shown for half a second, when the code he wrote explicitly ask Ren'Py to wait half a second before replacing the previous image.





Or, for an approach that don't rely on condition, name the quest step and rely on Ren'Py dynamism:
Python:
define questWhatever  = None

label bedroomHub:
    if questWhatever and renpy.has_label( "bedroom_" + questWhatever ):
        jump expression "bedroom_" + questWhatever
    else:
        jump bedroom_default

label bedroom_default:
    [default scene when there's no quest in progress]

label bedroom_firstEncounter:
    [scene corresponding to the quest stage name "firstEncounter"]

label bedroom_firstKiss:
    [scene corresponding to the quest stage name "firstKiss"]

[...]



And what if instead I destroy your writing of my nickname ? :cautious: :D


This said, I only took a real look at the "it's where it happen". Yet I noticed two things.

Firstly, the implicit jumps. This is not really a good idea for a complex game.

Secondly I wonder why the use of "unclickable".
Python:
               $ unclickable = False
                call screen mai_room
The buttons only exist when the screen is displayed, and the screen is displayed only during the time it's called, while stopping to exist the instant you Jump out of it.
Hi, good afternoon, the $ unclickable, i was trying to lock the code, to see if that was something outside of this part not working, but there's no need because i'm comparing two variables. I wil remove everything.

Let me show you what i'm talking. I think it is indeed because of the jump.
As I told before, it's not the "show".
Here a simplified code, I removed everything, and the same thing happens.

Code:
label start:
declaration of variables.


label next:
    scene image"College/College1.jpg" with fade
    n "hi"
    call screen overworld_map

screen overworld_map:
Navigation trough the map and goes to the screen below

screen mai_room:
    imagemap:
        declaration of images

if time_of_day == 'MORNING' and mai_idle_day == 0:
declaration of images
action Jump("mai_idle")

label mai_idle: 
      scene image "Home/MaiRoom/Maiara2.jpg" with dissolve
        n "Hi"
When the code gets to the second label where I'm showing another scene, it shows the first one. Even without the pause, and removing all the shows and hide in the code.
It is just the way label works? And Yes I'm using Unren and looking codes to understand more.


That's why, I was asking if there is a buffer, because it happens when i change labels, and calls for another "scene"
then previous scene appears for a brief moment. I can bypass that using a black screen everytime I end a scene, but I don't know if i'm coding wrong.
The only thing between those two it is the jump :cry:
So to resume
I use a scene in a label, then call a screen, then use another scene.
There where the problem happens.
The first scene appears when, I call the other one.
 
Last edited:

Scapest

Newbie
Jul 8, 2017
98
56
Hi everyone, I think I found the problem. I removed all the transitions, left the "pauses" and the "shows/hides," and it stopped happening. I think I was using transitions incorrectly. I always put "scene Image with dissolve" or "with fade" at the end of the line. Removing the "with dissolve" and "with fade" stopped the undesired effect.

I will study more the transictions to use then right. At least I'm happy that was not my logic.
Thank you all.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,263
15,073
Code:
label mai_idle:
      scene image "Home/MaiRoom/Maiara2.jpg" with dissolve
        n "Hi"
When the code gets to the second label where I'm showing another scene, it shows the first one.
*sigh*

: "The transition effect is applied between the contents of the screen at the end of the previous interaction (with transient screens and displayables hidden), and the current contents of the scene, after the show and hide statements have executed."

Remove the with dissolve, that force Ren'Py to display the previous image, and you fixed your bug...
 

Scapest

Newbie
Jul 8, 2017
98
56
*sigh*

: "The transition effect is applied between the contents of the screen at the end of the previous interaction (with transient screens and displayables hidden), and the current contents of the scene, after the show and hide statements have executed."

Remove the with dissolve, that force Ren'Py to display the previous image, and you fixed your bug...
Yes, I just discovered this now, as I posted above, thank you. :ROFLMAO: