Open BlackRam-oss opened 1 week ago
hello @blurymind sorry if I ask so many questions.
do you know of any libraries that I could use to manage the game's storage or do you know the solution to this problem?
I found a bunch of options out there, but decided to write my own in order to avoid adding yet another dependency to yarn https://github.com/blurymind/YarnClassic/blob/master/src/js/classes/storage.js#L3 funnily enough it ends up being dependent on idb :rofl:
I took inspiration from a codepen. The browser's db api is much more confusing than localStorage imo. I found it much harder to set up than it, so the intention of the class I wrote in yarn was to allow me to replace usages of localstorage https://codepen.io/blurymind/pen/mdgpYBj
Ok thanks I'll take a look to "take inspiration" (copy).
Anyway I found out the error had nothing to do with the processes it was my stupid mistake.
I was looking especially for a library that also has a chrome extension to view and modify the values. like the one from pixijs https://chromewebstore.google.com/detail/pixijs-devtools/aamddddknhcagpehecnhphigffljadon?pli=1 , but instead of modifying a canvas it modifies the storage
``Currently the game storage uses ram. Meaning it uses a static variable inside a class. https://github.com/DRincs-Productions/pixi-vn/blob/main/src/managers/StorageManagerStatic.ts#L5
This creates problems when multiple processes write to it. (This bug is especially noticeable when using '<>' of ink.) The problem I encountered can be explained as follows (it coincides with the narration.goNext of the library):
the result I expect is that the dialogue is equal to '"ABC"', but it is not so because it is equal to '"C"'.
The reason is not clear to me, but putting a log
getVariableStorage("dialogue")
ingoNext
, and the values the logs are as follows:"A"
"AB"
"ABC"
.I don't understand why if I put a log at the end of
start()
the result is"C"
.the simplest solution that comes to mind is to use localStorage. but I would avoid it because it has a maximum space limit and is a bit slow.
I was wondering if there were better solutions. The constraints are as follows:
get
andset
must not be asynchronous