Side Image transition & Position: Issue/Bug (?) with config.side_image_same_transform / _change_transform

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
Ophey
Newbie
Posts: 4
Joined: Fri Nov 19, 2021 1:17 pm
Contact:

Side Image transition & Position: Issue/Bug (?) with config.side_image_same_transform / _change_transform

#1 Post by Ophey »

Hello,
I have a problem with Side Images transitions which I believe might be a bug(?) because I use code directly from the documentation and it results in the problem. Of course user error is always possible (I would love if this were user error and someone could correct me into having this working haha.)

The problem is that when setting up config.side_image_same_transform, suddenly my side images 'forget' about the xoffset I gave them, and move around.
Scroll down to the animated gif image below to see this in action.


I have found very little info about this function in general, other than some obscure reports of similar issues, which I will link below, but first let me explain.

The set-up in question for sprites, side images and transitions.
I am using LayeredImages for sprites, and define my side images as shown in the documentation. Here is the documentation example:

Code: Select all

image side augustina = LayeredImageProxy("augustina", Transform(crop=(0, 0, 362, 362), xoffset=-80))
I am then setting up a transition for when the side image of a character (same character) changes for a change of expression, with config.side_image_same_transform. I am doing it exactly as shown in the documentation (as it turns out the 0.2 dissolve is also the transition I use for my full sprites). Here are the relevant bits from the documentation:
Transforms and Transitions

The config.side_image_same_transform and config.side_image_change_transform transforms are called with two arguments – old and new side image displayables – each time the side image is displayed. These can be used to move around side images, or use a transition to go between side images.

This causes the side image to slide in and out when the character associated with that image changes:

Code: Select all

transform change_transform(old, new):
    contains:
        old
        yalign 1.0
        xpos 0.0 xanchor 0.0
        linear 0.2 xanchor 1.0
    contains:
        new
        yalign 1.0
        xpos 0.0 xanchor 1.0
        linear 0.2 xanchor 0.0

define config.side_image_change_transform = change_transform
This is used to dissolve between old and new side images when the character remains the same. (For example, when the character changes emotion.) For the Dissolve to work correctly, both side images must be the same size.

Code: Select all

transform same_transform(old, new):
    old
    new with Dissolve(0.2, alpha=True)

define config.side_image_same_transform = same_transform
The problem in this situation.
To sum up - I am using the same code as the documentation and, the result is that my side images move around - whatever xoffset I applied to them when defining them is thrown out the window when config.side_image_same_transform is set to anything other than None. Once they have moved, they transition properly, but in the wrong place, and not the place I gave them through xoffset. The offset is 'seen' by the game, as when 'rolling back' in the conversation by using the scroll wheel, the side image will temporarily show at the right offset; they will also show at the right offset for their first line of dialogue (ie before the side image refreshes, I guess) but then will 'move' again to the wrong spot.

Here's a visual (animated gif image) to show you what it looks like, from the quick test whose code is shown below also.

Image

(Gif image uploaded here in full resolution if low res is hurting your eyes: https://s1.gifyu.com/images/lambdasprite.gif)

How this was tested / issue replication.
To show that it's not anything else in my projects causing this, and to have an easy way to have others replicate the issue in the exact same circumstance, I plopped down this code in "The Question" project that comes with Ren'Py.
If anyone wanted to try to replicate this issue, one could always do the same thing and see if they suddenly observe the same phenomenon.
The below code is exactly the same as the documentation re. those elements mentioned above, except I made the offset different so the problem I am talking about is more visible. I have had this issue in all projects I tried this in.
Here is the code I added to "The Question" for the example visually shown above (I am attaching my lambdasprite images to this as well):

Code: Select all

define ls =Character("Lambda", image="lambdasprite")

layeredimage lambdasprite:
    always:
        "lambda_base"
    group expressions:
        attribute smile default:
            "lambda_smile"
        attribute annoyed:
            "lambda_annoyed"

transform same_transform(old, new):
    old
    new with Dissolve(0.2, alpha=True)

define config.side_image_same_transform = same_transform
# if you comment out the line above, or change    = same_transform      to    = None    , the problem does not happen.
# Of course, no transition happens either anymore without this line.

##########--- SPRITES -- ########
image side lambdasprite = LayeredImageProxy("lambdasprite", Transform(crop=(0, 0, 362, 362), xoffset=-160))

# The game starts here.
label start:

    # Start by playing some music.
    play music "illurock.opus"

    scene bg lecturehall
    with fade

    ls "HELLO"
    ls annoyed "Oh, I moved to the wrong spot."
    ls "That's not cool."
    ls "Why?!"

Posts that seemed to have similar problems with this:
viewtopic.php?t=48731
viewtopic.php?t=45126

To Conclude: What I actually am trying to do:
1. I would like to know if I'm doing something wrong, in which case, your help would be greatly appreciated, and this could be helping others in the future too - or if this is a bug, in which case, this would be an attempt at reporting it.
2. If anyone is willing to give this a shot - realization of #1 might include getting confirmation through someone else trying it or sharing their experience with this function, so I'd love to hear if it has been working fine for you under the same or similar circumstances to what I have.
3. Most of all, I would like a way to have a dissolve transition between expression changes for same character side images, but one that wouldn't mess with my offsets. My side images each have different offsets, so I can't use the trick of setting a general offset in the say screen (which does 'combat' this transition problem). Any suggestions?

Thank you all very much for your time.

______________________________________________

Here are the lambdasprite test files I used for this example:
Lambda base:
lambda_base.png
Smile:
lambda_smile.png
(8.21 KiB) Not downloaded yet
Annoyed:
lambda_annoyed.png
(9.44 KiB) Not downloaded yet
All together in one zip:
lambdasprite.zip
(28.16 KiB) Downloaded 13 times

User avatar
KuroOneHalf
Regular
Posts: 129
Joined: Fri Apr 25, 2014 6:18 pm
Completed: Cuttlebone
Projects: Somewhere In The Shade
Deviantart: KuroOneHalf
itch: kuroonehalf
Contact:

Re: Side Image transition & Position: Issue/Bug (?) with config.side_image_same_transform / _change_transform

#2 Post by KuroOneHalf »

Dunno if you're still looking for the fix, but if so, I think it could have to do with config.side_image_null not being set. You should set it to the size of your sprite, like

Code: Select all

define config.side_image_null = Null(width=2000, height=3300)
Went through the problem myself this week.

Ophey
Newbie
Posts: 4
Joined: Fri Nov 19, 2021 1:17 pm
Contact:

Re: Side Image transition & Position: Issue/Bug (?) with config.side_image_same_transform / _change_transform

#3 Post by Ophey »

KuroOneHalf wrote: Sun Mar 06, 2022 11:30 pm Dunno if you're still looking for the fix, but if so, I think it could have to do with config.side_image_null not being set. You should set it to the size of your sprite, like

Code: Select all

define config.side_image_null = Null(width=2000, height=3300)
Went through the problem myself this week.
Absolutely still looking for a fix yes, so, thank you for this! I will give it a try & report back.

Ophey
Newbie
Posts: 4
Joined: Fri Nov 19, 2021 1:17 pm
Contact:

Re: Side Image transition & Position: Issue/Bug (?) with config.side_image_same_transform / _change_transform

#4 Post by Ophey »

Unfortunately, that did not work for me; it made no difference :/
Did you get it to work?

Post Reply

Who is online

Users browsing this forum: Google [Bot]