Screen Cleanup During Animation

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
Poorman65
Newbie
Posts: 12
Joined: Fri Apr 20, 2018 2:36 am
Contact:

Screen Cleanup During Animation

#1 Post by Poorman65 » Mon May 21, 2018 11:22 am

Running into some problems trying to play a movie due to the delay in loading and starting the movie. I've tried quite a few things to mitigate the problem but I still don't have a solution.

An example scenario is that I have a bus sitting on the left side of the screen and a say message displayed. When the user clicks on the screen and dismisses the say message, I want the animation of the bus moving across the screen to the right and disappearing off the screen. Obviously I only want the animation to run once. To do this I create a Screen with a Timer set to the length of the Animation. I pass in a list of Displayables that usually would contain the Background first, followed by any overlaid images followed by the Animation which will run on Top.

My Movie Animations are Masked so that just the moving figure is in the Movie. In the case below, it contains only the moving Bus.

Code: Select all

screen playMovie(movieLen, *displayables):
    for displayablesName in displayables:
        add displayablesName
    timer movieLen action Hide("playMovie") repeat False
    key "dismiss" action [[]]

show screen playMovie(3,  "myBackground", "myAnimation")    
The problem that I run into is that the Movie takes a second to start, which leaves the Bus missing from the screen for that second. I've tried putting the Image of the Bus as one of the Displayables but then I can't figure out how to hide it when the Movie actually starts.

Is there some technique I can use to resolve this or some way to pre-load the Movie so that there isn't a noticible delay?

(My game will be using this repeatedly)
Last edited by Poorman65 on Mon May 21, 2018 12:43 pm, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Screen Cleanup

#2 Post by kivik » Mon May 21, 2018 11:49 am

Not really sure what's going on necessarily but it sounds like you're overcomplicating things by using a screen.

You can create the movement by using a transform:

Code: Select all

transform move_right:
    linear 3.0 xoffset 2500 yoffset -200 zoom 0.7

...


show bus at left
"Hi! I'm a bus!"
show bus at move_right
"Bye! I'm now a moving bus!"

Poorman65
Newbie
Posts: 12
Joined: Fri Apr 20, 2018 2:36 am
Contact:

Re: Screen Cleanup

#3 Post by Poorman65 » Mon May 21, 2018 12:40 pm

The problem with that Solution is that it won't take into account the changing perspective. When the Animation starts, the viewer can see the front Headlights of the Bus. The headlights will be less visible as the bus moves to the right and eventually the tail lights would start to become visible. There are also changes in light reflection as the Animation moves although that is not a critical element in this particular Animation.

FYI - The bus takes up most of the screen when it is in the middle. It is not just a small sprite.

In many cases I will have an Animated character that doesn't simply move from one point to another.

Any other ideas?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Screen Cleanup During Animation

#4 Post by kivik » Mon May 21, 2018 12:51 pm

Can you show us a screenshot / screen recording of what's actually meant to happen to better understand it? I'm struggling to visualise the end result.

Is one of your displayables a video?

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: Screen Cleanup During Animation

#5 Post by Empish » Mon May 21, 2018 12:55 pm

I'd say try combining the movie and ATL together?

Code: Select all

image bus_movie:
    "bus_still"
    0.1
    "bus_movie_raw" #this is your movie sprite
Or maybe combine the still bus image with the background and then after a split second have it switch to the without bg?

Poorman65
Newbie
Posts: 12
Joined: Fri Apr 20, 2018 2:36 am
Contact:

Re: Screen Cleanup During Animation

#6 Post by Poorman65 » Mon May 21, 2018 1:20 pm

Sorry that it wasn't clear. My Animation is a webm video. This is how I load it:

Code: Select all

image Bus S01_Movie_Bus_Leaving_Night = Movie(channel="animation1", play="Ch 01/Assets/Animations/Greyhound Bus Leaving - Night.webm", mask="Ch 01/Assets/Animations/Greyhound Bus Leaving - Night-mask.webm")
The first part of the video is just a Still image of the bus overlaid on the Background image. After clicking on the first say message it goes to the Screen that shows the Animation video of the Bus. You'll notice a brief time where the bus disappears prior to moving.

Let me know if you have trouble with this link:
http://i.imgur.com/HOZBX7J.mp4

Primantis
Newbie
Posts: 1
Joined: Sun May 27, 2018 12:00 am
Contact:

Re: Screen Cleanup During Animation

#7 Post by Primantis » Sun May 27, 2018 12:11 am

This happens to me as well and has caused me a good deal of grief trying to figure it out..

For whatever reason there seems to be a 'dead' frame or two whenever Ren'Py loads up an animation. It does this for both movie sprites and fullscreen movies in my experience as well. Completely botching the 'dissolve' effect when transitioning between movie sprite animations. Causing a jarring flickering effect as the new movie is invisible then suddenly pops in.

I have messed with it for hours trying different codecs, FPS settings, you name it. I have 0 idea what causes the problem and just chalk it up to some sort of loading issue on Ren'pys side of things.

Might I suggest loading the animation out of bounds ,then using ATL to move it inward or some such. That might be able to alleviate the issue.

Poorman65
Newbie
Posts: 12
Joined: Fri Apr 20, 2018 2:36 am
Contact:

Re: Screen Cleanup During Animation

#8 Post by Poorman65 » Tue May 29, 2018 8:02 pm

Maybe PyTom can help with a solution?

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], tacoen, xxmissarichanxx