Sharing save/load tricks (DRY, WASM)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- rust, wasm
- Ambito
- documentation
Direzione di ricerca
Questa issue condivide un'implementazione esterna di salvataggio/caricamento WASM invece di richiedere una modifica specifica. Se la esplori, inizia dalla macro collegata di rktrl_macros/src/lib.rs e dal suo utilizzo in src/systems/saveload.rs, quindi esamina le modifiche menzionate alle feature delle dipendenze in Cargo.toml; l'issue non definisce come sarebbe il completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hey @thebracket! Thank you for the amazing library and book, I'm having a blast following along. This is not so much an "issue", but rather sharing what I learned in case you want to use it in the book at some point. I'll do it tl;dr style to respect your time:
- I've added saving / loading under WASM in https://github.com/abesto/rktrl/commit/b0da9c00125ba9bc2335f0403576b28e56c063f5. Basically it uses local storage (base64 encoded, because I GZip the saved file on the cross-platform code path).
- FWIW, the sentence "Supporting saving via LocalStorage (a browser/JavaScript feature) is planned for a future version of RLTK." confused me for a second - RLTK doesn't explicitly support saving / loading outside the browser either, it's all
serdeandspecs(AFAICT at least).
- FWIW, the sentence "Supporting saving via LocalStorage (a browser/JavaScript feature) is planned for a future version of RLTK." confused me for a second - RLTK doesn't explicitly support saving / loading outside the browser either, it's all
- Reaching for increasingly big hammers, I managed to set up a procedural macro so that for the save / load systems there is zero repetition of the components (check out the macro and its usage). The big idea here is using the macro to split the tuple of components into chunks of at most 16, so that we can then rely on the the
specs_derive-provided implementations for those.- I'm toying with the idea of creating a similar macro to cut down on the boilerplate involved with creating system data structs (but that's less relevant as currently the tutorial doesn't use them)
- Getting things to compile for WASM in the first place was a bit tricky as dependencies pulled in parallel Specs features in their
default-features, which trigger threading. Had to disable them incargo.toml(see https://github.com/abesto/rktrl/commit/72a7a119385ca6ae5c6871dd31d281ba842d0ffe). I guess there might be a better way of doing this (maybe controlling whether a parallel dispatcher is used from code).
Finally, I wanted to add that I know how overwhelming input about big huge changes to writing projects can be, so wanted to explicitly say: no pressure, take these when and if they're useful. Even until then, maybe this will in itself be useful for someone else. Thank you again!
- Lingua principale
- Rust
- Stelle
- 968
- Fork
- 166
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di amethyst/rustrogueliketutorial
-
Wrong typing in chapter 57a Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
[RESOLVED] Wayland Issue Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 45/100
Tutte le issue di amethyst/rustrogueliketutorial
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug core
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Apertafuzz
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ClickHouse/ClickHouse#122114 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
linebender/vello_svg#90 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100