Suggestions for a custom speech function in a form of a scrolling subtitles box

Started by Gal Shemesh, Tue 15/08/2023 16:27:32

Previous topic - Next topic

Gal Shemesh

Hi everyone, hope you're all doing good. :)

I'm working on a friend's game from 16 years ago, which was developed in AGS 2.72. The game didn't had subtitles in it and I'm working with the creator to making subtitles to it.

The thing is, many audio files are very long, as there was no need back then to divide the speech to fractions for showing only a few lines on the screen at a time, because as I mention there was no subtitles meant to be in it. So over-head subtitles are not the best option here, as the text in most cases will cover the entrie screen.

So I'm thinking about making a custom speech function in a form of a text box, that will be located at the bottom center part of the screen, and that the text will automatically scroll up within it. The text should also 'feathered' from the bottom and top edges of the text box - very similar to how speech is shown in many RPG games like Diablo. But the text color should still be based on the speech text color that is set for each character.

Attached a screenshot of what I mean:



I would like to know what would be the best way to achieving such custom speech function. But I must mention that due to the age of the source code, I had to tune some compatibility properties in the General Settings, or else the game gives a lot of errors.

These are the backward compatibility settings:
- Allow relative asset resolution: True
- Enable mouse wheel support: False
- Enforce new-style audio scripting: False
- Enfore new-style strings: False
- Left-to-right operator precedence: True
- Script API version: 3.2.1
- Script compatibility level: 3.2.1
- Use low resolution co-ordinartes in script: True
- Use old-style custom dialog options API: True
- Use old-style keyboard handling: True

Many thanks! :)
Gal Shemesh,
goldeng

Snarky

Well, you'll just have to render and animate it yourself, using DrawingSurface functions. To get the feather effect you would need to use DynamicSprite.CopyTransparencyMask() — note that this function is slow, so could potentially cause performance issues (though it will probably be fine).

Honestly, I would suggest not doing this, and instead simply display the subtitles broken up into separate lines. You could, more easily than your proposal, write a function that will take a set of strings and display them one by one (and you could also provide timings if necessary, and possibly even allow them to skip forward in the speech clip). I also think this will be a more pleasant experience for players, since constantly scrolling text will be a distraction and interfere with people's natural reading speed.

Gal Shemesh

Thanks for the info, @Snarky. :) Meanwhile I just position the long strings with the .SayAt and put them at the bottom center.

I would prefer to have the lines showing as a set of strings as you mentioned, but the thing is that I'll have to cut the audio files into separate pieces, right? If not, then I'm not sure how this will behave and how players could skip forward in the speech clip when skipping fractions of the text, if it's a single long audio file, that is. Maybe I'm not aware of such a feature in AGS and you can make this brighter to me? :)
Gal Shemesh,
goldeng

Snarky

Quote from: Gal Shemesh on Wed 16/08/2023 21:11:03I'll have to cut the audio files into separate pieces, right?

Not necessarily. You'd just need a function that displays each part of the subtitle sequentially as the audio plays.

Quote from: Gal Shemesh on Wed 16/08/2023 21:11:03If not, then I'm not sure how this will behave and how players could skip forward in the speech clip when skipping fractions of the text, if it's a single long audio file, that is. Maybe I'm not aware of such a feature in AGS and you can make this brighter to me? :)

Well, this is the trickiest part, but you wouldn't be able to do that with the scrolling subtitles in any case. The relevant function is AudioChannel.Seek() or .SeekMs(), but you may have to play the audio "manually" using Game.PlayVoiceClip() to make it work, and that might not be possible given your script compatibility and API version.

Gal Shemesh

Thanks! I thought there may be issues with newer functions because of the script compatibilities that the game needs in order to run. The great part is - I've just managed to fix all issues when running the game in the Latest Script API version! 8-) There were several places where certain strings were used for variables, which are now reserved for the engine's built-in functions - so I changed them, for example 'Screen' to 'screen', etc. I only left the Script compatibility level setting as 3.2.1, because the game still needs to run old scripts.

Now I'm trying to make the a custom function to play the characters' speaking animation in a non-blocking form, and to have the long string of text to get broken apart, for showing sequentially, while the speech plays. I will appreciate help anyway if you have time. :) Thanks.
Gal Shemesh,
goldeng

SMF spam blocked by CleanTalk