Speech Center Plugin

Questions, remarks, etc. on the VSB project.
Post Reply
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Speech Center Plugin

Post by SpeechCenter »

Hello VSB and other game developers,

I have noticed you are working on adding speech to your game and I thought I would like to share with you information about a recent plugin I wrote that covers speech capability and text review within AGS Editor.

The plugin has the ability to scan the scripts (dialogs, global scripts and room scripts), and display all the speech line it finds in those scripts (such as the text used in the character Say function). You can double click the line to go directly to the corresponding script line.
You can sort, filter and search through the lines using the interface.

If the lines are numbered then it offers additional functionality:
The Speech directory is scanned for each line and provides info on the file status. You can playback the speech from the editor itself. You can also mark whether those lines are correct (there are 2 checkboxes for each line, one for the voice file and the other text).

To make sure the plugin is as non-intrusive as possible, it only loads the data if you click on the refresh button, thus it should not affect something you do, unless you are actually doing something at the plugin screen. It should also have the capacity to handle thousands of lines, which should cover even text-heavy games.

I would greatly appreciate it if you tried it with your game and provide feedback on whether or not it assists you and also if there are any other needs this plugin can covre.
It is downloadable from this link:
https://skydrive.live.com/redir.aspx?ci ... K4Z8fEy_9I

Here are a couple of images to show what this plugin is all about:
Image

Image

PS, I posted this in bigbluecup, I apologize if you already read this.
User avatar
mjomble
Writer / Efficiency Facilitator
Writer / Efficiency Facilitator
Posts: 2416
Joined: Sun May 11, 2003 4:44 am
Location: Estonia

Re: Speech Center Plugin

Post by mjomble »

Ooh, looks nice.

I got an error, though, when I loaded up the VSB project, opened Speech Center and pressed Refresh:
rule variables_with_assign
Source: Antlr3.Runtime
Target Site: System.Object NextCore()
Stack Trace:
at Antlr.Runtime.Tree.RewriteRuleElementStream.NextCore()
at Antlr.Runtime.Tree.RewriteRuleElementStream.NextTree()
at AGSScriptParser.variable_definition()
at AGSScriptParser.implementation_command()
at AGSScriptParser.command_or_block()
at AGSScriptParser.internal_implementation()
at AGSScriptParser.implementation()
at AGSScriptParser.function_definition()
at AGSScriptParser.script_command_definition()
at AGSScriptParser.script_command()
at AGSScriptParser.script_implementation()
at AGSScriptParser.parseScript()
at AGS.Plugin.SpeechCenter.SpeechLineFinder.AddSpeechLines(String strScriptText)
at AGS.Plugin.SpeechCenter.SpeechLineFinder.Populate()
at AGS.Plugin.SpeechCenter.SpeechCenterPane.btnRefresh_Click(Object sender, EventArgs e)
If you need more details for reproducing the issue, let me know.

You might also be interested in the custom solution I created for handling VSB's voice scripts, to provide more context for the voice actors and also to catch various special cases that the regular AGS voice script generator misses.
The output can be seen here: http://www.sqvsb.com/upload/voice_scripts/
"Man, we're gonna get so much pie when all these droids start coming back."
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Re: Speech Center Plugin

Post by SpeechCenter »

Thanks, yes, I may need more info, it's obviously a problem reading a line in one of the scripts, but it should have been caught earlier and given a more detailed message. I'll try to find why this happened.
The voice script looks great, in fact, some asked me to add exporting voice script capabilities, which will most likely be redundant if you intend to release your solution.
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Re: Speech Center Plugin

Post by SpeechCenter »

I have uploaded a new version which should catch the error better, apparently I missed a type of exception.
https://skydrive.live.com/redir.aspx?ci ... STHrHvkWfA

(note, the zip file name is labeled with the version 0.9.2.1)

You should see a window that reports the name of the scripts that caused problems. There's also a detailed info button that should show the lines that caused this.

If it's a script you can send me, that would be the easiest. If not, then please see which line(s) had an error and try to let me know what's written there.

Thanks for your help.
User avatar
mjomble
Writer / Efficiency Facilitator
Writer / Efficiency Facilitator
Posts: 2416
Joined: Sun May 11, 2003 4:44 am
Location: Estonia

Re: Speech Center Plugin

Post by mjomble »

Love the new error window :D

It seems to have trouble in two places. The first was this dialog:

Code: Select all

@6 // optBarmanGreyPoupon
BARMAN: &22 Ain't heard of that drink before.
BARMAN: &23 How do you make it?
EGO: &128 I... don't know.
BARMAN: &24 Well, I've got ice water.
  if (dBarman.GetOptionState(optBarmanAnotherWater) == eOptionOn) {
    cEgo.Say("&129 That you do.");
    cBarman.Say("&25 Aye... that I do.");
  }
  else {
BARMAN: &26 You want ice water?
EGO: &130 Ooh - yeah, that sounds good.
BARMAN: &27 Comin' right up.
  CallRoomScript(eDrinkWater308);
option-off 2 // optBarmanAnotherCup
option-on 3 // optBarmanAnotherWater
  }
return
It crashed on the line right after the "else {", probably not expecting the special format dialog lines to be used inside a block.

The other one was from the global script, on this line:

Code: Select all

revealCharName = new int[Game.CharacterCount];
SpeechCenter wrote:The voice script looks great, in fact, some asked me to add exporting voice script capabilities, which will most likely be redundant if you intend to release your solution.
Our solution isn't actually very releasable - it was intentionally designed to be used on just one or two games (VSB and possibly Incinerations) where requiring a lot of manual tweaking is acceptable and this allowed for building the system very rapidly.
To make it something more public that anyone could use, I'd pretty much have to rewrite it from scratch and put a lot more thought in it :P

So I think you should definitely add voice script capabilities to your system, it would be a very natural fit.
The main thing to borrow from our system would probably be the output format - a separate script for each character that contains only the scripts relevant for them, with lines from other characters also shown, but greyed out.
It also supports comments for acting cues or references, some examples can be found in Beatrice's script - search for "Comment".
One thing I've been meaning to improve on it is information about the cast - currently it's just got a boolean for each character, but it could also show the name of the actor and in some cases like Tent Furkunz or Random Apeman, they actually represent multiple characters and can be partially cast.

Another thing I can help out with is a set of examples of the kind of special hacky speech lines that are difficult to detect automatically and are missed by the AGS auto-numberer.
Support for custom Say functions is a good start, but to cover all special cases, it'd probably be necessary to add a feature for manually tagging lines somehow.
If you're interested, I'll gather some of those examples.
"Man, we're gonna get so much pie when all these droids start coming back."
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Re: Speech Center Plugin

Post by SpeechCenter »

Yep, reproduced both problems. Thanks!
The global script issue should be easier to fix, as for the dialog, I didn't consider this use case, I'll work on it.

As for voice scripts, the format does look very convenient and should be relatively easy to generate.
Someone already suggested I add another column for comments and perhaps another user-editable column should go for multiple casts, what would be the possible values for a character, say Random Apeman?
I prefer to refrain from reading code comments as that's even more complex than reading the code, but if additional columns won't be a good alternative, I'll probably do javadoc style comment parser or something similar.

Anyway, I'm currently focusing on bringing the initial functionality to work and be more useful before introducing new features, so I'm going to work on the bugs you found. Please also send the cases where custom functions are not enough, even if it's as complex as you describe, it's still beneficial for me to know of these usages, and maybe I'll still be able to expand the capabilities.
User avatar
mjomble
Writer / Efficiency Facilitator
Writer / Efficiency Facilitator
Posts: 2416
Joined: Sun May 11, 2003 4:44 am
Location: Estonia

Re: Speech Center Plugin

Post by mjomble »

SpeechCenter wrote:Someone already suggested I add another column for comments and perhaps another user-editable column should go for multiple casts, what would be the possible values for a character, say Random Apeman?
Could you rephrase the question? :P
SpeechCenter wrote:I prefer to refrain from reading code comments as that's even more complex than reading the code, but if additional columns won't be a good alternative, I'll probably do javadoc style comment parser or something similar.
Our starting point was comments with a special prefix, e.g.

Code: Select all

// VOICE: This is a comment
cEgo.Say("Blah blah");
and then I gathered all comments with that prefix.
As for an implementation detail, I handled comments as separate lines (having two types, SpeechLine and CommentLine, both extending a generic Line), rather than additional data attached to the lines (which a separate column would do). This could be tricky to handle with the filtering, though.
SpeechCenter wrote:Please also send the cases where custom functions are not enough, even if it's as complex as you describe, it's still beneficial for me to know of these usages, and maybe I'll still be able to expand the capabilities.
Although I remembered there being a larger variety, I had a look and it seems there were actually mostly just two cases where tweaking was needed (apart from custom function names):

1. Parameter for Say or Display picked/generated dynamically, for example:

Code: Select all

    String RogerResponses[5];
    RogerResponses[0] = "&3030 It's you, Roger Wilco, apparently a guy with too much time on his hands.";
    RogerResponses[1] = "&3031 It's you, Roger Wilco, lean, mean, cleaning machine.";
    RogerResponses[2] = "&3032 It's you, Roger Wilco, doofus of all doofi.";
    RogerResponses[3] = "&3033 It's you, Roger Wilco, janitor extraordinaire and space adventurer mediocre.";
    RogerResponses[4] = "&3034 It's you, Roger Wilco, blatantly stalling when you should be extricating yourself from the wretched mess you've landed yourself in. Not that I'm complaining, it's quality entertainment.";
    Display(RogerResponses[Random(4)]);
Cases like this can be impossible to always handle properly just via static analysis, so I think the most reasonable solution would be an option to mark these lines manually. Or just not manage those with this plugin :P

2. Mismatched characters.
For example, when Roger picks up the note left by Never Kenezer, the text is shown with Display(), which assigns it to the Narrator, but we actually want it to be voiced by Never and show up in his script rather than the Narrator's. So we manually tweaked the voice script data for cases like that.
Other examples like that:
* In addition to Display(), we also have an in-game character for the narrator (cNarr) who shows up in an easter egg and we merged their lines together to the same script.
* Sometimes characters are reused in non-obvious ways. For example, we have a self-destruct announcement by some computer that's implemented as a speech line of an off-screen Beatrice. And in the Furkunz Revolution cutscene on the moon, various apeman and Furkunz characters are reused for displaying generic battle lines. These are mostly cases where the issue could be resolved by creating separate characters for such occasions, though (as long as you don't use up the AGS character limit), and not really this plugin's responsibility.

Another issue was the AGS auto-numberer adding line numbers to various UI elements that didn't need them and we had to clean those up manually, but that might also be outside the scope of this plugin.
"Man, we're gonna get so much pie when all these droids start coming back."
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Re: Speech Center Plugin

Post by SpeechCenter »

Ok, first thing - new version that fixes the aforementioned errors. It works on the code segments you sent me, please let me know if it works or something new has popped up.
https://skydrive.live.com/redir.aspx?ci ... K4Z8fEy_9I
mjomble wrote:As for an implementation detail, I handled comments as separate lines (having two types, SpeechLine and CommentLine, both extending a generic Line), rather than additional data attached to the lines (which a separate column would do). This could be tricky to handle with the filtering, though.
Yes, that's my dilemma, adding a wide column for comments could be bad for readability and adding a row or sub-row may be difficult as well. Another alternative would be to have something viewable/editable only when selected. Might be a non-modal popup window or if AGS would expose this to the plugin - use the properties window. I assume most lines won't have comments so it's possible it's even preferable rather than having a column which is quite empty. Another feedback I got was regarding translations and I thought a similar mechanism would work for that as well.
mjomble wrote: 1. Parameter for Say or Display picked/generated dynamically, for example:

Code: Select all

    String RogerResponses[5];
    RogerResponses[0] = "&3030 It's you, Roger Wilco, apparently a guy with too much time on his hands.";
    RogerResponses[1] = "&3031 It's you, Roger Wilco, lean, mean, cleaning machine.";
    RogerResponses[2] = "&3032 It's you, Roger Wilco, doofus of all doofi.";
    RogerResponses[3] = "&3033 It's you, Roger Wilco, janitor extraordinaire and space adventurer mediocre.";
    RogerResponses[4] = "&3034 It's you, Roger Wilco, blatantly stalling when you should be extricating yourself from the wretched mess you've landed yourself in. Not that I'm complaining, it's quality entertainment.";
    Display(RogerResponses[Random(4)]);
Cases like this can be impossible to always handle properly just via static analysis, so I think the most reasonable solution would be an option to mark these lines manually. Or just not manage those with this plugin :P
Yeah, I agree, I may be able to cover variable initialization like this, but then you can have a wide variety which would make it very difficult to cover all cases. One option of course is to do a random before the text and then if/else, and maybe a function that displays one of these texts, but it may make the code less generic.
mjomble wrote: 2. Mismatched characters.
For example, when Roger picks up the note left by Never Kenezer, the text is shown with Display(), which assigns it to the Narrator, but we actually want it to be voiced by Never and show up in his script rather than the Narrator's. So we manually tweaked the voice script data for cases like that.
Other examples like that:
* In addition to Display(), we also have an in-game character for the narrator (cNarr) who shows up in an easter egg and we merged their lines together to the same script.
* Sometimes characters are reused in non-obvious ways. For example, we have a self-destruct announcement by some computer that's implemented as a speech line of an off-screen Beatrice. And in the Furkunz Revolution cutscene on the moon, various apeman and Furkunz characters are reused for displaying generic battle lines. These are mostly cases where the issue could be resolved by creating separate characters for such occasions, though (as long as you don't use up the AGS character limit), and not really this plugin's responsibility.
I agree that in most cases it can be done with AGS on its own. I'm not sure it's that easy to reach the character limit, but I agree it may be annoying to create a different character just for a the purposes of a different actor. So maybe there should be a way to override for VA, or segmenting based on the line numbering.
mjomble wrote: Another issue was the AGS auto-numberer adding line numbers to various UI elements that didn't need them and we had to clean those up manually, but that might also be outside the scope of this plugin.
It would have been best if the wizard in AGS gave more control on this. I didn't go for script-changing features on purpose, if I'll go that direction (changing line numbers, renaming files, editing text), I'll have to test this for very long time before feeling confident enough to release it.
User avatar
mjomble
Writer / Efficiency Facilitator
Writer / Efficiency Facilitator
Posts: 2416
Joined: Sun May 11, 2003 4:44 am
Location: Estonia

Re: Speech Center Plugin

Post by mjomble »

SpeechCenter wrote:Ok, first thing - new version that fixes the aforementioned errors. It works on the code segments you sent me, please let me know if it works or something new has popped up.
Works like a charm now :y:
SpeechCenter wrote:Yes, that's my dilemma, adding a wide column for comments could be bad for readability and adding a row or sub-row may be difficult as well. Another alternative would be to have something viewable/editable only when selected. Might be a non-modal popup window or if AGS would expose this to the plugin - use the properties window. I assume most lines won't have comments so it's possible it's even preferable rather than having a column which is quite empty. Another feedback I got was regarding translations and I thought a similar mechanism would work for that as well.
Properties window sounds interesting. I also thought the table might have a small 'has comment' indicator for those lines.
"Man, we're gonna get so much pie when all these droids start coming back."
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Re: Speech Center Plugin

Post by SpeechCenter »

mjomble wrote:
SpeechCenter wrote:Ok, first thing - new version that fixes the aforementioned errors. It works on the code segments you sent me, please let me know if it works or something new has popped up.
Works like a charm now :y:
Excellent! :D Please contact me if you run into any new issues or require an improvement.
mjomble wrote:
SpeechCenter wrote:Yes, that's my dilemma, adding a wide column for comments could be bad for readability and adding a row or sub-row may be difficult as well. Another alternative would be to have something viewable/editable only when selected. Might be a non-modal popup window or if AGS would expose this to the plugin - use the properties window. I assume most lines won't have comments so it's possible it's even preferable rather than having a column which is quite empty. Another feedback I got was regarding translations and I thought a similar mechanism would work for that as well.
Properties window sounds interesting. I also thought the table might have a small 'has comment' indicator for those lines.
That's a good idea, thanks.
SpeechCenter
Posts: 7
Joined: Thu Apr 05, 2012 3:01 pm

Re: Speech Center Plugin

Post by SpeechCenter »

Quick update, version 1.0 was recently released. Fixed a few bugs and also added an option to separate the speech line number in custom functions.
I don't think you'll be affected by the changes since it already works, but it's a good idea you'll have the latest one.

The link remains the same, but here it is again for your convenience: download
Post Reply