Hiccup(?) Character Transition

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
juunishi master
Regular
Posts: 59
Joined: Sat Oct 31, 2015 12:08 am
Organization: Linemancer Works
Skype: juunishi_master
Location: Indonesia
Contact:

Hiccup(?) Character Transition

#1 Post by juunishi master » Wed Jun 07, 2017 1:46 pm

Hi all,

I recently experimented with character transition using TransitionConditionSwitch (viewtopic.php?f=51&t=26612#p326683) and character tinting when the character isn't speaking (viewtopic.php?f=8&t=34286).

But when my friend and I tested it in PC and Android device, we noticed a "hiccup" in character transition. There are a few times where character seems skipping the dissolve animation when showing up on the screen.

A snippet for the TransitionConditionSwitch I use in my script (as far as I remember, I didn't change anything from the one written in the post about this condition switch):

Code: Select all

####### Transition Condition Switch Experiment #######
init python:
    class TransitionConditionSwitch(renpy.Displayable):
        def __init__(self, transition, *args, **kwargs):
            super(TransitionConditionSwitch, self).__init__(**kwargs)
            self.transition = transition
            self.d = zip(args[0::2], args[1::2])
            self.time_reset = True
            self.old_d = None
            self.current_d = None
            self.ta = None
        def render(self, width, height, st, at):
            if self.time_reset:
                self.time_reset = False
                self.st = st
                self.at = at
            return renpy.render(self.ta, width, height, st-self.st, at-self.at)
        def per_interact(self):
            for name, d in self.d:
                if eval(name):
                    change_to = d
                    break
            if change_to is not self.current_d:
                self.time_reset = True
                self.old_d = self.current_d
                self.current_d = change_to
                if self.old_d is None:
                    self.old_d = self.current_d
                self.ta = anim.TransitionAnimation(self.old_d, 0.00, self.transition, self.current_d)
                renpy.redraw(self, 0)
        def visit(self):
            return [self.ta]
A snippet from my current code:

Code: Select all

define mei = Character('Mei', color="#ffffff")
define mei_expression = "default"

##### Tinted Images
image meitint default = im.MatrixColor("images/characters/mei/default/mei default.png", im.matrix.brightness(-0.3))
image meitint default2 = im.MatrixColor("images/characters/mei/default/mei default2.png", im.matrix.brightness(-0.3))
image meitint smile = im.MatrixColor("images/characters/mei/default/mei smile.png", im.matrix.brightness(-0.3))
image meitint frown = im.MatrixColor("images/characters/mei/default/mei frown.png", im.matrix.brightness(-0.3))
image meitint surprised = im.MatrixColor("images/characters/mei/default/mei surprised.png", im.matrix.brightness(-0.3))
image meitint frown2 = im.MatrixColor("images/characters/mei/default/mei frown2.png", im.matrix.brightness(-0.3))
image meitint angry = im.MatrixColor("images/characters/mei/default/mei angry.png", im.matrix.brightness(-0.3))
image meitint sad = im.MatrixColor("images/characters/mei/default/mei sad.png", im.matrix.brightness(-0.3))
image meitint cocky = im.MatrixColor("images/characters/mei/default/mei cocky.png", im.matrix.brightness(-0.3))

##### Default
image mei default = TransitionConditionSwitch(Dissolve(0.3, alpha=True),
    # when speaking
    "mei_expression == 'default' and _last_say_who == 'mei'", "images/characters/mei/default/mei default.png",
    "mei_expression == 'default2' and _last_say_who == 'mei'", "images/characters/mei/default/mei default2.png",
    "mei_expression == 'smile' and _last_say_who == 'mei'", "images/characters/mei/default/mei smile.png",
    "mei_expression == 'frown' and _last_say_who == 'mei'", "images/characters/mei/default/mei frown.png",
    "mei_expression == 'surprised' and _last_say_who == 'mei'", "images/characters/mei/default/mei surprised.png",
    "mei_expression == 'frown2' and _last_say_who == 'mei'", "images/characters/mei/default/mei frown2.png",
    "mei_expression == 'angry' and _last_say_who == 'mei'", "images/characters/mei/default/mei angry.png",
    "mei_expression == 'sad' and _last_say_who == 'mei'", "images/characters/mei/default/mei sad.png",
    "mei_expression == 'cocky' and _last_say_who == 'mei'", "images/characters/mei/default/mei cocky.png",
    
    # when not speaking
    "mei_expression == 'default' and not _last_say_who == 'mei'", "meitint default",
    "mei_expression == 'default2' and not _last_say_who == 'mei'", "meitint default2",
    "mei_expression == 'smile' and not _last_say_who == 'mei'", "meitint smile",
    "mei_expression == 'frown' and not _last_say_who == 'mei'", "meitint frown",
    "mei_expression == 'surprised' and not _last_say_who == 'mei'", "meitint surprised",
    "mei_expression == 'frown2' and not _last_say_who == 'mei'", "meitint frown2",
    "mei_expression == 'angry' and not _last_say_who == 'mei'", "meitint angry",
    "mei_expression == 'sad' and not _last_say_who == 'mei'", "meitint sad",
    "mei_expression == 'cocky' and not _last_say_who == 'mei'", "meitint cocky"
)
There are 4 characters (each has +/- 7 expression each) with 3 different outfit and all of them are full body sprite (not body and expression in separated files). In total, there are about ... 4x7x3 ... 84 sprites.

Also, I use im.MatrixColor to do the tinting.

I'm using renPy 6.99.12.4.

- Is this issue caused by too many processing I put when showing character sprite?
- If it should be okay to have this many processing, I'd be grateful if someone could point out what's wrong in which part

(I'm not new with programming, but isn't really familiar with renPy in depth. Plus, I kinda have hard times determining what's the suitable keyword to put into Google search because English isn't my native language.)

Thanks in advance!

TL;DR version: my character transition is hiccup-ed, I probably made a mess by combining TransitionConditionSwitch and tinting character that's not talking; please help me. orz

User avatar
PyTom
Ren'Py Creator
Posts: 15223
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Hiccup(?) Character Transition

#2 Post by PyTom » Thu Jun 08, 2017 1:12 am

- Is this issue caused by too many processing I put when showing character sprite?
Almost certainly. Especially when Ren'Py can't predict what your code is doing.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
juunishi master
Regular
Posts: 59
Joined: Sat Oct 31, 2015 12:08 am
Organization: Linemancer Works
Skype: juunishi_master
Location: Indonesia
Contact:

Re: Hiccup(?) Character Transition

#3 Post by juunishi master » Fri Jun 09, 2017 12:04 pm

*looking around the sub-forum

I think I posted the question in the wrong place too. orz I'm sorry. :oops:

A bit update on what I've done after reading that the hiccup is caused by too much processiong: I stripped the TransitionConditionSwitch and change ...

Code: Select all

define mei = Character('Mei', image="mei", who_color="#ffffff", what_prefix='"', what_suffix='"')
now making use of Say with Image Attributes (which why I didn't find/read/notice earlier)
.
I control the tinting manually instead using _last_say_who anymore. Going to rewrite a lot, but since I try to achieve something close to Fate/Grand Order cutscene, it serves the purpose well.

Thank you again for the help. :D

And sorry for posting in the wrong place. :|

Post Reply

Who is online

Users browsing this forum: No registered users