Create and Fuck your AI Cum Slut –70% OFF
x

Tool HTML Sugarcube IndexedDB engine mod

5.00 star(s) 1 Vote

Lichdoom

Newbie
Jun 26, 2025
18
6
3
I got increasingly frustrated with the fact that SugarCube passage navigation got increasingly slower as the size of the state history got larger.
Much of if is due to the compression of session data, which is necessary because of the size limits of localStorage and sessionStorage. (5 MiB each)

So I decided to implement IndexedDB which has a size limit of 10GiB (Firefox) / 60% of total disk size (Chromium)

I also removed a few unnecessary clone() calls when Config.history.maxStates == 1 to further speed things up.

Before my changes, with 10k test objects, passage navigation took over 2sec, over 1.5sec of which was from compressing session state.
With my changes passage navigation is now under 100ms.

Any feedback is welcome.

NOTE: you will have to export your saves before using my SugarCube mod.

PS. currently this mod is only for the version 2.37.3 of SugarCube, if there is interest I might look into adding support for other versions.

Changelog:
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:
  • Like
Reactions: Karatus

Karatus

Newbie
Apr 27, 2017
40
60
241
You are a godsend, I was getting crazy trying to develop a game using indexedDB in sugarcube mostly because I couldn't manage to make the save/load function work fine
 

Karatus

Newbie
Apr 27, 2017
40
60
241
Is there anything I need to do to set up this correctly? I builded my game with this format.js but I still see the variables in
SugarCube.State.variables I thought I had to access them asynchronously
 

Lichdoom

Newbie
Jun 26, 2025
18
6
3
Is there anything I need to do to set up this correctly? I builded my game with this format.js but I still see the variables in
SugarCube.State.variables I thought I had to access them asynchronously
You don't need to do anything, everything still work synchronously through a cache.
 

Karatus

Newbie
Apr 27, 2017
40
60
241
Is there anything I need to do to set up this correctly? I builded my game with this format.js but I still see the variables in
SugarCube.State.variables I thought I had to access them asynchronously
found my issue, it turned out tweego was reading another format.js in another directory
 
5.00 star(s) 1 Vote