Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

What affects the speed and 'lag' of Twine games?

Greetings

I'm wondering on what to avoid in order to not make a Twine game 'slow' in terms of time needed to change a passage, etc. Therefore, I present my questions here, for I didn't find them elsewhere or in satisfying manner.
1. Size file. Is there a noticeable difference between 1 mb .html Twine game and a 50 mb?
2. Array functions. Is indexOf() noticeably slower than accessing a static index in an array? Does making changes to an array of, say, 300 objects take up time depending on whether we push, pluck, or simply change a variable of some property of an object?
3. Passage size. If one passage is extremely long (say 50k words, both macro/function and displayed text), does it take noticeably longer to load than a comparably smaller one (say 1k words)?

Other than that, what else is there? Since I'm slowly building up, the only 'noticeable' as in 300ms difference at most was at creating 5 loops each iterating 500 times and pushing a value onto an array.

Best Regards

Comments

  • As always, you should specify a story format—unless you're fishing for generic answers, which aren't likely to be terribly helpful here. The various story formats—unless we're talking about the Twine 1 vanilla formats—are completely different engines and answers may be different in specific areas.

    Also, you're asking vague questions to which there are no easy answers.

    In general, however:
    1. Aside from possible compilation issues, which would be a compiler problem, the only difference should be to your browser, to which the file's size is unlikely to matter as long as it's able to be loaded at all. Some story formats have more runtime overhead than others, however, that's unlikely to matter.
    2. Yes, using Array object methods will be slower than using a known index. Whether or not it would be noticeable depends on exactly what you're doing. That said, however, it's unlikely to be noticeable under sane usage—certainly, I wouldn't expect to see issues operating on only a few hundred elements.
    3. Yes, it takes longer. Whether or not it would be noticeable depends on exactly what you're doing—i.e. the complexity of the code contained therein. That said, however, it's probably unlikely unless you're doing something pathological.
  • Oh, I didn't know that the story formats had that huge of an impact on optimization.
    Twine 2.0, SugarCube 1. Sorry for not mentioning that.

    Insane or pathological, what defines as such? :)

    Currently, besides the worry of having to do a game in parts because of file size limit, the problem is choosing either an extremely large passage size or a looped for more than 300 iterations array of objects manipulation, which involves indexOf every time.
    Choice being to use a loop of indexOf based manipulation or just manual checks but with more text contributing to greater passage size.

    Thanks.
Sign In or Register to comment.