Open DrSensor opened 2 years ago
It's going to be stored only on IndexedDB because it support any structured clone object. So no need for serialization like JSON.stringify(), TLV buffer, or whatever.
arr[0]
will store static/global valuesarr[1:]
will store instance values
Not to be confused with Qwik Resumability 😅
Well, the idea is that all changes in class
propertyaccessor will write the data into a snapshot. The snapshot is stored into persisted medium either at debounced eventful write or at regular interval when in @frameloop. To avoid the cost of serialization, the change should be incremental. Storing the snapshot should only costconcatenation + casting the value into string (or maybe TLV format)nothing! (thanks to structuredClone() algorithm in IndexedDB). The real cost is when you load then parse the snapshot at startup.This bring several benefits:
Save game state as html. The experience might be similar with "Quick save states" in Gameboy emulator.not possible since it only stored in IndexedDBThis is similar on how ECS being utilized in multiplayer game. However, it only need the snapshot, no need to store that snapshot into persisted medium.Most likely has similar approach on how PouchDB replication works.Relevant:
40
TODO- [ ] implementclass IncrementalJsonWriter extends Map
- [ ] implement generic snapshot (possible medium: localStorage, sessionStorage, inline inside html page)