Text output far away from character

  • #1, by LebosteinTuesday, 07. July 2015, 12:00 9 years ago
    If the centered text block above the character does not fit between character and top of the screen, the text output jumps far away from the character (a strange position in my eyes). I think the text should stay centered...

    Key Killer

    621 Posts


  • #2, by afrlmeTuesday, 07. July 2015, 12:05 9 years ago
    Allow the maximum width of the text block to be longer or use the textPosition Lua hook function to manually specify a position. Personally I'm not a big fan of text being displayed above / near characters unless it's done in a more tasteful way, such as: in a speech bubble or text block of some kind.

    I think with your graphic style that you could probably get away with creating some kind of scroll looking graphic to display your text in at the bottom of the screen.

    Imperator

    7278 Posts

  • #3, by LebosteinTuesday, 07. July 2015, 12:08 9 years ago
    Is this a bug or not? And if not, why the text is displayed on the right side of the screen now?

    Personally I'm not a big fan of text being displayed above / near characters unless it's done in a more tasteful way, such as: in a speech bubble or text block of some kind.

    That is your opinion. I am not a fan of speech bubbles and I do not like the speech boxes of the Sierra Adventures for example. And longer lines are hard to read. Compact text blocks with short lines are easier to read (look at the Visionaire forum for example with the limited width).

    Key Killer

    621 Posts

  • #4, by afrlmeTuesday, 07. July 2015, 12:51 9 years ago
    Yes I never claimed it wasn't my opinion. wink

    I'm guessing it's probably a bug, or just something that happens when there's not enough room between the character & the edge of the screen. I believe the text is displayed on top of the top most pixel (minus text height) of the character images & when you are forcing the max width of the text lines it has to take into consideration the text itself & the space between each line.

    I don't have a clue why it shoved the text so far over to the right hand side of the screen, mind.

    Does it also shove the text if the character is too close to the left or right hand sides of the scene?

    Imperator

    7278 Posts

  • #5, by LebosteinTuesday, 07. July 2015, 19:07 9 years ago
    If it is enough space, the text is displayed centered above the character (image 1). If I go some pixels left, the space seems to small now and the text is displayed on an undefined position (image 2). Very strange...

    Key Killer

    621 Posts

  • #6, by afrlmeTuesday, 07. July 2015, 19:09 9 years ago
    Must just be a coping mechanism the engine uses to make sure text is always displayed in a way that it can be read. I don't have a clue why it's pushing it so far to the side though. You would think if it can't display above that it would display directly to one side or beneath the character instead.

    Imperator

    7278 Posts

  • #7, by LebosteinWednesday, 08. July 2015, 12:00 9 years ago
    I found out the reason of that behaviour. It is the size of the talking animation images. All my character animation frames had a size of 600 x 600 pixels (I need the width for sleeping animations and so on). It seems the text output is oriented exactly at the size of the talking frames (see pink rectangles in images).

    Now I have auto-cropped all my animation images (+ small python script to correct all frame positions in the *.ved file automatically wink ). Now it looks good and the text is near the character (see green rectangle) - a side effect: I need less video memory.

    Key Killer

    621 Posts

  • #8, by afrlmeWednesday, 08. July 2015, 13:14 9 years ago
    Nice one. Yeah I knew the text on top position was based on the top most pixel of your sprite. I didn't realize you had set the width of the animation frames so wide. It's only really each unique animation that needs to have each frame the same width & height. You could crop each animation differently. The only real benefit of having each animation the same width & height is that it speeds up positioning & getting the animation center correct for aligning the characters animations.

    If you crop each animation differently then you will just have to use the animation studio (harmonizer) tool to align the animation to another one facing the same direction.

    Imperator

    7278 Posts

  • #9, by LebosteinWednesday, 08. July 2015, 13:55 9 years ago
    Yes. After auto-cropping, each frame has its own size (as small as possible). The auto crop tool that I use (convert -trim from ImageMagick) saves the crop position inside the png metadata. My small python script checks every sprite image linked in the ved file (I mark cropped images with a # in the filename: opened_door_#.png), reads the offset from the metadata and write it to the position x="..." y="..." element inside the ved:

    # -*- coding: utf-8 -*-
    from xml.dom import minidom
    from commands import getstatusoutput
    import codecs
    
    vedname_in = 'mygame.ved' # your game file
    vedname_out = 'mygame_out.ved' # result file
    
    print 'Read %s...' % vedname_in
    xmldoc = minidom.parse(vedname_in)
    
    # update sprite positions
    for setup in ['SpriteSprite', 'InterfaceSprite', 'SceneSprite', 'sprite']:
        objects = xmldoc.getElementsByTagName(setup)
        print 'CHECK %ss (%d)...' % (setup, len(objects))
        for sid in objects:
            picpath = sid.attributes['path'].value
            if not '#' in picpath: continue # skip all not #-marked files
            posfeld = sid.getElementsByTagName('position')
            ox = int(posfeld[0].attributes['x'].value)
            oy = int(posfeld[0].attributes['y'].value)
            status, output = getstatusoutput('convert %s -format "%%X %%Y" info:' % (picpath))
            px, py = map(int, output.split())
            if ox != px or oy != py:
                posfeld[0].attributes['x'].value = str(px)
                posfeld[0].attributes['y'].value = str(py)
                print '** --> image %s moved to (%d, %d)' % (picpath, px, py)
    
    print 'Save %s...' % vedname_out
    file_handle = codecs.open(vedname_out, 'w', 'utf-8')
    xmldoc.writexml(file_handle, encoding='UTF-8')
    file_handle.close()
    

    Key Killer

    621 Posts

  • #10, by afrlmeWednesday, 08. July 2015, 15:46 9 years ago
    Interesting. I've still not gotten round to looking into python. I believe David wrote a python script (I think it was python) that allows you to batch convert all media files associated with your .ved to webP (images), mkv (videos) & ogg or opus (don't remember which, for audio). Also the parameters in the cfg could be changed. I don't know if he plans on sharing it with the community or not. If he does then I'll add it to the wiki with some instructions, as I think it would be a pretty useful tool.

    Imperator

    7278 Posts