AllureOfTheStars / Allure

Allure of the Stars is a near-future Sci-Fi roguelike and tactical squad combat game written in Haskell; please offer feedback, e.g., after trying out the web frontend version at
http://allureofthestars.com
GNU Affero General Public License v3.0
213 stars 16 forks source link

In the browser version use JS library lz-string to compress savegames more than 4-fold #90

Closed Mikolaj closed 3 years ago

Mikolaj commented 5 years ago

In the native binary version we use zlib, but it's not available in JS, it compresses worse and it doesn't solve the problem of needing to store only the valid UTF16 characters in the browser's Local Storage. We have FFI available for JavaScript code, so we can distribute or embed the lz-string library and call it at will.

https://github.com/pieroxy/lz-string

The compression would be inserted in this line, instead of or after decodeLatin1:

https://github.com/LambdaHack/LambdaHack/blob/12e6ad779117fcd31dcc671a83e5e1c446079afa/Game/LambdaHack/Common/JSFile.hs#L32

Mikolaj commented 3 years ago

Implemented.