multiple characters speak at the same time [SOLVED]

Started by zeta_san, Sun 02/03/2025 07:49:59

Previous topic - Next topic

zeta_san

Guys, is it possible to make multiple characters speak at the same time? Like singing in a choir.
I tried both .Say and Display.

AndreasBlack

Yes, i think you could have characters follow another character exactly. They should imitate the main character, but maybe i'm remembering wrong. Anyway you can check it out and try it by typing

player.FollowCharacter in a script and mark FollowCharacter then push F1 you should see instructions.


Snarky

#2
Yes, but you need to be more specific about what effect you want to create to work out how to do it. There are essentially three components that can be involved:

- Text display
- Speech animation
- Speech audio

For simultaneous speech text display (in LucasArts-style) you can use Character.SayBackground(). (There are also other options that involve drawing the text yourself to an Overlay.)

Hopwever, SayBackground doesn't make the character play their speech animation. There are modules that do that, but you can also just animate them manually (non-blocking). Or alternatively, if they are all lined up in predetermined arrangement (as they will often be in a choir) you can make a single character for the whole choir and just animate them together.

Finally, for speech audio, AGS does not allow you to play multiple voice clips at the same time.
Your best bet is to pre-mix the audio to have all their voices in a single voice clip. If you need to be able to add or remove voice dynamically (depending on who is present, for example), you will need to do it not as speech but as regular audio clips. (The tricky part will be to sync them.)

Rik_Vargard

I tried to have two characters speak at the same time with SayBackground but only the second character speaks, the first one is "ignored"/doesn't show the text.

Crimson Wizard

#4
Quote from: Rik_Vargard on Sun 02/03/2025 10:20:01I tried to have two characters speak at the same time with SayBackground but only the second character speaks, the first one is "ignored"/doesn't show the text.

SayBackground works for multiple simultaneous characters, each character has their own background speech.
If that does not work, then please tell which version of AGS were you using and which script did you use?


Quote from: Snarky on Sun 02/03/2025 09:35:38Finally, for speech audio, AGS does not allow you to play multiple voice clips at the same time.

This is stupid, I wish someone pointed me this earlier when Game.PlayVoice was introduced, because there's no technical reason that would prevent that.
I could maybe see to support more voice channels, or passing a channel as an argument.

zeta_san

Quote from: Rik_Vargard on Sun 02/03/2025 10:20:01I tried to have two characters speak at the same time with SayBackground but only the second character speaks, the first one is "ignored"/doesn't show the text.

Exactly

Crimson Wizard

Quote from: zeta_san on Sun 02/03/2025 11:09:00
Quote from: Rik_Vargard on Sun 02/03/2025 10:20:01I tried to have two characters speak at the same time with SayBackground but only the second character speaks, the first one is "ignored"/doesn't show the text.

Exactly

Like I said, it must work. If it does not, then please tell the version of AGS and post your script.

Khris

#7
When a command doesn't work as expected, the first thing to do is to check its manual entry:

Quote from: manualAll background speech is automatically removed when a normal Say command is used (unless you set the global variable game.bgspeech_stay_on_display to 1).

Add the following to game_start:
Code: ags
  game.bgspeech_stay_on_display = 1;

Snarky

#8
Quote from: Crimson Wizard on Sun 02/03/2025 10:24:14This is stupid, I wish someone pointed me this earlier when Game.PlayVoice was introduced, because there's no technical reason that would prevent that.
I could maybe see to support more voice channels, or passing a channel as an argument.

I think because this falls under the larger discussion of the audio system. Passing channel as an argument, for example, would (as the system is currently designed) be even more useful for AudioClips.

The quick fix would probably be to add a function to play voice clips as audio clips.

Rik_Vargard

For me, the AGS version is 3.6.1

I recreated that bit of code:

Code: ags
  cAlien01.Say ("Follow me");
    cAlienBot01.SayBackground("Yes sir."); // THIS doesn't show
    cAlienBot02.Say("Yes sir."); // THIS works fine
    cAlien01.FaceDirection (eDirectionLeft);
    cAlien01.Walk (1500, 580, eNoBlock, eWalkableAreas);
    cAlienBot01.Walk (1500, 580, eNoBlock, eWalkableAreas);
    cProtector.FaceDirection (eDirectionRight);
    cAlienBot02.Walk (1500, 580, eBlock, eWalkableAreas);
    Wait (30);
    cAlien01.ChangeRoom (999);
    cAlienBot01.ChangeRoom (999);
    cAlienBot02.ChangeRoom (999);

Crimson Wizard

#10
Quote from: Rik_Vargard on Sun 02/03/2025 12:25:27
Code: ags
    cAlienBot01.SayBackground("Yes sir."); // THIS doesn't show
    cAlienBot02.Say("Yes sir."); // THIS works fine

But that is not "two characters speak at the same time with SayBackground", that's a 1 character speaking with SayBackground and 1 with Say.

Multiple SayBackgrounds with waiting for player input could be done like:
Code: ags
cAlienBot01.SayBackground("Yes sir.");
cAlienBot02.SayBackground("Yes sir.");
WaitMouseKey();

Anyway, as Khris mentioned, Say removes SayBackgrounds unless you explicitly set an option not to.
https://adventuregamestudio.github.io/ags-manual/Character.html#charactersaybackground

Rik_Vargard

#11
But that is not "two characters speak at the same time with SayBackground", that's a 1 character speaking with SayBackground and 1 with Say.

Multiple SayBackgrounds with waiting for player input could be done like:
Code: ags
cAlienBot01.SayBackground("Yes sir.");
cAlienBot02.SayBackground("Yes sir.");
WaitMouseKey();

Anyway, as Khris mentioned, Say removes SayBackgrounds unless you explicitly set an option not to.
https://adventuregamestudio.github.io/ags-manual/Character.html#charactersaybackground

[/quote]

Oooooh! OK! WaitMouseKey(); did what I expected the normal Say would do after a SayBackground
Thanks a lot for all the explanations, guys. (nod)

zeta_san


SMF spam blocked by CleanTalk