How does AGS determine how long to show character speech?

Started by Humbolt Steelwheels, Sat 19/07/2008 03:26:21

Previous topic - Next topic

Humbolt Steelwheels

Hello,

Does anyone know what algorithm AGS uses to determine how long to show character speech during dialog? For example, a line of speech like:
Ego: Yum, a bagel!
will obviously display for a much shorter period of time than a line of speech like:
Ego: There I was, devouring all the food on the Orient Express. As I munched my way through the dining car, I reflected that the only person capable of stopping my eating-related rampage was the famed Belgian detective, Hercule Poirot. Luckily, I knew that he had elected to take Pan Am! I chortled gleefully.

I don't want to change this algorithm (the fact that it's in AGS by default is great), but I'm really curious as to how it determines the amount of time to show each line of speech (I'd imagine it's related to the number of words and the length of each word). I'm working on a silent film-style project (as well as an unrelated AGS game, which is why I thought to post here) and I'd love some algorithmic method to determine how long to show each caption card.

Any information would be much appreciated!

monkey0506

#1
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=14364.msg174988#msg174988

Code: ags
String text = "this is some text!";
int gameloops = ((text.Length / game.text_speed) + 1) * GetGameSpeed();


The game.text_speed variable controls how fast/slow text is "said" in your game. The default is 15. Higher numbers means faster speaking, i.e. the text is displayed for a shorter time, and vice versa.

So basically you take the length of the text and divide by the text speed. Since the length of the text may possibly be less than game.text_speed we have to add 1 to this value. Otherwise short lines would never get displayed at all! Then we multiply this by GetGameSpeed() to show it for X seconds where X is our previous value of ((text.Length / game.text_speed) + 1).

Humbolt Steelwheels

Excellent - that's just what I needed. Thanks, monkey_05_06.

SMF spam blocked by CleanTalk