0 votes
by (150 points)
I've gotten a report back on one of my games where they've mentioned that because the game saves the history build up, whenever they load that save, it locks up their browser. Is there a way of clearing that history so that this situation can be avoided? And would doing so interfere with code like <<if visited ("Passage")>>?

2 Answers

0 votes
by (23.6k points)

You can use Config.history.maxStates to keep the games history from growing to a size where it would cause problems.

0 votes
by (159k points)

Every time the Reader moves from one Passage to the next a new Moment is added to the story's History system, and by default the History system stores (up to) the last 100 moments. A Moment contains the Name of the Passage that is about to be shown, as well as a copy of the current value of all known variables as they were before the contents of the next passage is processed.

A Save stores a copy of the current contents of the History system at the time the save was made, and a Load replaces the current History system with the copy held within the save.

Functions like visited() used the current information stored in the History system to determine their results, so if the information stored in History is changed then the result of such functions also changes.

Is the Reader's ability to use the navigation buttons (found at the top of the Left Sidebar) to Undo History inportant in your story?

a. If not then you should set your story's Config.history.maxStates setting to 1, this forces the History system to store only the current Moment.

b. If it is then you should consider changing that setting's default value of 100 down to something like 10, this would still allow the Reader to undo the last 10 passage transitions while dramatically reducing the max size of History & Saves.