How to make the typewriter effect faster? (problem)

I want to include the typewriter effect in my game, as seen on the Twine Cookbook page. However, I have a huge number of characters on one page and it takes forever for the effect to finish to finish typing.
Could it be possible to make it write more quickly, let’s say 3x as fast, if yes, how?
(I’m using Harlowe 3.1.0)

Any help will be greatly appreciated!

The resulting time delay you see (between the displaying of each letter) when using the “Typewriter Effect”: Harlowe (v2.0) recipe is a result of a couple of things.

  1. The 20ms (millisecond) argument being passed to the (live:) macro call. This adds a 1/50 th of a second delay between each execution of the (live:) macro’s associated hook.
  2. The time it takes the (append:) macro call to find and then update the contents of target Named Hook.
  3. The time it takes to process & execute the other code within the (live:) macro’s associated hook.

Of the three above reasons the 2nd one is likely to be the main cause of any delay you might be seeing, it is also the hardest to optimise due to Harlowe’s deliberate limited support for using JavaScript to extend the core functionality of it’s engine.

You could try reducing the 20ms (millisecond) argument being passed to the (live:) macro call, but after a certain point any reduction of that value will likely have no effect because of the time required to process & execute the contents of the associated hook.

I see. Would be possible to make it that it places 2 or 3 characters per loop, rather than 1?

I wonder if you’re not overusing it? I find it can be really frustrating to wait for unusual type to load (although I’m a very fast reader, I think a lot of people feel that way). Could you use it more sparingly for a short passage in the middle of the page?
Apologies if this isn’t helpful at all.


I agree. I think I’d be sitting there thinking “Yeah, yeah, I get the point, already!” as the page slowly displayed. Having, say, the first sentence type itself and then the rest fade in would be enough to let me know that in the game world this was being written live without forcing me to actually experience it.

Of course there may be some particular plot-reason for you choosing to have the page slowly load (the lifeboat plunging ever deeper into the atmosphere as the auto-pilot, programmed on the assumption that the survivors would be unlikely to include a skilled astrogator, explains the bloody obvious with chirpy, idiot cheerfulness.) In which case ignore what I just said! :slight_smile:

Thanks everyone, for the responses. Reducing the 20ms delay definitely improved the speed. Plus I thought of couple of tricks, one of them being splitting the text in half and having two typewriters typing it out at the same time (which worked nicely).

On the occasions I sit down with a visual novel, the first thing I do set set the type speed to “instant”.

I don’t mind it occasionally for effect, such as the player receiving a teletype or morse-code message that is actually loading at that speed, but not for all the text through the whole game.

I know what you mean by ‘‘overdoing’’. I was planning to use in a few ‘‘loading screens’’ that would occur during the game