Author Topic: MODULE: SpeechBubble v0.8.0  (Read 6933 times)

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: SpeechBubble v0.8.0
« Reply #40 on: 23 Feb 2018, 06:44 »
All development of this module is on hold while I'm working on the AGS Awards Ceremony client.

To do text in multiple colors you have to break it up into separate strings that you render individually (using DrawingSurface.DrawString()), with the appropriate x and y offsets. There's an outline of how you might do it here.

To see how you're meant to be changing the tail, check out this post. Unfortunately there's a bug in the module which means you have to edit the internal initSpeechBubble() function instead, as shown in the post above.

The tail flipping depending on character angle is a feature I've been meaning to add, but it's not implemented. Basically, in renderBubble32() there are two calls to drawPixelArray(). The last two arguments are whether to flip the array horizontally or vertically, and both are set to false. If you set the second-to-last to true in both calls, it will flip it. So I would add a bool argument to renderBubble32(), and pass that along to drawPixelArray(). Then in the calls to renderBubble32() in realSayAtBubble(), SayBubble() and SayBackgroundBubble() you would set the argument depending on which way the character is facing.

Narehop

  • Posts: 47
  • Solodev on @Outline_team
Re: MODULE: SpeechBubble v0.8.0
« Reply #41 on: 07 Mar 2018, 19:04 »
How i can to set a custom background?

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: SpeechBubble v0.8.0
« Reply #42 on: 08 Mar 2018, 21:45 »
You can set a background color with SpeechBubble.BackgroundColor. You cannot set a background graphic.

Narehop

  • Posts: 47
  • Solodev on @Outline_team
Re: MODULE: SpeechBubble v0.8.0
« Reply #43 on: 01 Apr 2018, 19:07 »
You can set a background color with SpeechBubble.BackgroundColor. You cannot set a background graphic.

you'll be update with this option?

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: SpeechBubble v0.8.0
« Reply #44 on: 01 Apr 2018, 22:58 »
Sure, when I find time to work on it. I think TotalLipSync is first in line for an update, though.

bx83

  • Posts: 258
  • Get 'Er Doooooone
MODULE: SpeechBubble v0.8.0
« Reply #45 on: 27 Jun 2018, 08:13 »
Snarky, can you give us an ETA on 'ThinkBubble' function?
I would guess you just run speechbubble, but with 1 parameter change: to display the 3 bubbles going to the rounded corner box, instead of the angled-line going from the round corner box.
« Last Edit: 27 Jun 2018, 08:57 by Snarky »

bx83

  • Posts: 258
  • Get 'Er Doooooone
MODULE: SpeechBubble v0.8.0
« Reply #46 on: 27 Jun 2018, 08:26 »
Too late, I wrote some shitty poorly tested code! :P

This is the same code as SayBubble, but with one parameter change (from true to false) on line 10:
Code: [Select]
void ThinkBubble(this Character*, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...")
    this.SB_sayImpl(message);
  else
  {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, false);  //<--- SETTING THIS TO FALSE WAS ALL I HAD TO DO
    // Position bubble over character head
    int x = this.x - GetViewportX() - bubbleSprite.Width/2;
    x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
    int y = this.y - GetViewportY() - bubbleSprite.Height - this.GetHeight() - (_heightOverHead - _talkTailHeight + 1);
    y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);

    this.realSayAtBubble(x, y, message, bubbleGui, bubbleSprite);
  }
}
« Last Edit: 27 Jun 2018, 08:57 by Snarky »

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: SpeechBubble v0.8.0
« Reply #47 on: 27 Jun 2018, 09:20 »
Snarky, can you give us an ETA on 'ThinkBubble' function?

Well, it's part of the API I outlined when you contracted me to develop this module, so if you really need it I will make it a priority.

I would guess you just run speechbubble, but with 1 parameter change: to display the 3 bubbles going to the rounded corner box, instead of the angled-line going from the round corner box.

There's a little bit more to it than that if it's to work fully like AGS's Character.Think(), but a simple version shouldn't be too hard.

The main work is to complete and test the 8.9 rewrite, since I don't want to maintain two entirely separate branches going forward.

bx83

  • Posts: 258
  • Get 'Er Doooooone
Re: MODULE: SpeechBubble v0.8.0
« Reply #48 on: 27 Jun 2018, 11:20 »
My code works, but perhaps not in all situations.
All good, I'm happy with it so far, take your time :)

Ray

  • Posts: 18
  • Alien from planet Earth
Re: MODULE: SpeechBubble v0.8.0
« Reply #49 on: 24 Jul 2018, 00:01 »
Thank you very much! Definitely will see to use this module in my game :)

bulka_tarta

  • Posts: 51
Re: MODULE: SpeechBubble v0.8.0
« Reply #50 on: 20 Nov 2018, 11:14 »
Hey! I really like this module, but I have a small hiccup with it recently. Occasionally, the dialogue skips lines waaaay too fast and it's very frustrating. Because it happens only every now and then, it's hard to determine why and when it occurs. I was wondering if anyone else has this issue, or if I messed something up at some stage.

In general settings I've set "Allow speech to be skipped by which events" to Mouse or keyboard. I've tried setting Game.IgnoreUserInputAfterTextTimeoutMs to ridiculous values, but it doesn't change anything. I also played around with some values in the module itself but to no avail.

The only settings I changed for the dialogues are below, although I highly doubt they would have an impact on skipping the lines since they're purely aesthetic changes.
Code: Adventure Game Studio
  1.   // Lowers the dialog options a little bit
  2.   game.dialog_options_x = 10;
  3.   game.dialog_options_y = 10;
  4.   // Changes the colour of highlighted dialogue option
  5.   game.dialog_options_highlight_color = 19695;
  6.   // Edit the Speech Bubble Module
  7.   SpeechBubble.BorderColor = Game.GetColorFromRGB(10,12,14);
  8.   SpeechBubble.BackgroundColor = Game.GetColorFromRGB(10,12,14);
  9.   SpeechBubble.BackgroundTransparency = 0;
  10.   SpeechBubble.PaddingTop = 8;
  11.   SpeechBubble.PaddingBottom = 8;
  12.   SpeechBubble.PaddingLeft = 8;
  13.   SpeechBubble.PaddingRight = 8;
  14.   SpeechBubble.MaxTextWidth = 230;
  15.   SpeechBubble.CornerRoundingRadius = 0;
  16.   SpeechBubble.HeightOverHead = 8;
  17.   SpeechBubble.TextAlign = eAlignCentre;

The only other thing I've changed in the module is this:
Code: Adventure Game Studio
  1. bool animateSpeech(this Character*, String message)
  2. {
  3.   if(this.Moving)
  4.     this.StopMoving();
  5.  
  6.   if(this.SpeechView > 0)
  7.   {
  8.     this.LockView(this.SpeechView);
  9.     if(Game.GetFrameCountForLoop(this.SpeechView, this.Loop) > 1)
  10.       this.Animate(this.Loop, this.SpeechAnimationDelay, eRepeat, eNoBlock, eForwards);
  11.   }
  12.  
  13.   int speechDuration = calculateDuration(message);
  14.   if(BlockSpeech(speechDuration, true) == eBlockTimeOut)
  15.   {
  16.     //this.UnlockView();                          <---------------------- Commented this out
  17.     int speechPause = calculateSpeechPause();
  18.     return (BlockSpeech(speechPause, false) != eBlockTimeOut);
  19.   }
  20.   else
  21.   {
  22.     //this.UnlockView();                          <---------------------- Commented this out
  23.     return false;
  24.   }
  25. }
When the above wasn't commented out, the characters would keep unlocking the view, so they always went back to idle/talking view when new line of dialogue appeared, so I couldn't get characters to talk while in a special animation (someone sitting on the ground and talking for example). Still, I don't think this would impact skipping the dialogue?

I'm using v0.8.0.

I'm really stuck with this issue and I'm not sure if this is AGS thing or the module or if there could be something else affecting the dialogues. If anyone has any ideas how to go about fixing the dialogue skipping problem, please let me know! Many thanks.

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: SpeechBubble v0.8.0
« Reply #51 on: 20 Nov 2018, 19:18 »
Yes, I noticed this when I tested your game. ;)

I'm fairly sure it's a problem with the custom blocking script. I don't have time to look into it right now, but you should try setting a transparent font. That will bypass all the custom blocking code and rely on the normal AGS speech blocking instead.

bulka_tarta

  • Posts: 51
Re: MODULE: SpeechBubble v0.8.0
« Reply #52 on: 21 Nov 2018, 11:11 »
You've given me quite a lot of feedback, so my Trello board is now full of things to change/fix/improve! (laugh)

I followed the instructions on the lip sync found in the Header of the script to find out how to set this up:
Code: Adventure Game Studio
  1.   /*
  2.   Note that to get text-based lip sync to work, you need to provide an invisible font,
  3.   and set the SpeechBubble.InvisibleFont property accordingly. You may download one here:
  4.                                                                                          
  5.   http://www.angelfire.com/pr/pgpf/if.html
  6.   */

After importing the font to AGS I simply added this to game_start()
Code: Adventure Game Studio
  1. SpeechBubble.InvisibleFont = eFontInvisibleFont;

After some testing I didn't (yet) notice any line skipping, but I might have been just (un)lucky. There is definitely a noticeable change to the dialogue though. Before I've set the invisible font, you could have held down the left mouse button and the dialogue would skip automatically after around one second on each line. After setting the invisible font, nothing happens when you hold down the LMB, so hopefully things will be fixed now.

Is this all there is to it or did I miss something big time? It looks suspiciously too simple to bypass the custom blocking code. Thank you for the response!

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: SpeechBubble v0.8.0
« Reply #53 on: 21 Nov 2018, 11:21 »
No, that's all there is to it.

If it works for you, great! If not... I'm not sure when I'll have time to look into it, I'm afraid. Others have had problems related to the same part of the code, but I don't have any immediate ideas about what the problem might be. The ideal solution would be to extend the AGS Wait() API to cover all the cases you need for dialogue blocking.

bulka_tarta

  • Posts: 51
Re: MODULE: SpeechBubble v0.8.0
« Reply #54 on: 22 Nov 2018, 07:06 »
Great! Thank you for the help!

I will let you know if the problem persists. It's just hard to tell straight away.

Creamy

  • Posts: 600
    • I can help with animation
    • I can help with characters
    • I can help with story design
    • I can help with translating
    • Creamy worked on a game that was nominated for an AGS Award!
      Creamy worked on a game that won an AGS Award!
Re: MODULE: SpeechBubble v0.8.0
« Reply #55 on: 01 Dec 2018, 20:52 »
Hi Snarky,

Great module you have here.
It's easy to set up and works like a charm...except for one room where my game crashes:

Quote
Error: ScriptOverlay::Remove: overlay is not there

EDIT: nevermind, I've figured it out. If you change room before the bubble has disappeared, the game will crash as soon as you call Saybubble in the next room.
« Last Edit: Yesterday at 21:35 by Creamy »