doodle/pkg
Noah 5654145fd8 (Experimental) Run Length Encoding for Levels
Finally add a second option for Chunk MapAccessor implementation besides the
MapAccessor. The RLEAccessor is basically a MapAccessor that will compress
your drawing with Run Length Encoding (RLE) in the on-disk format in the ZIP
file.

This slashes the file sizes of most levels:

* Shapeshifter: 21.8 MB -> 8.1 MB
* Jungle: 10.4 MB -> 4.1 MB
* Zoo: 2.8 MB -> 1.3 MB

Implementation details:

* The RLE binary format for Chunks is a stream of Uvarint pairs storing the
  palette index number and the number of pixels to repeat it (along the Y,X
  axis of the chunk).
    * Null colors are represented by a Uvarint that decodes to 0xFFFF
      or 65535 in decimal.
    * Gameplay logic currently limits maps to 256 colors.
* The default for newly created chunks in-game will be RLE by default.
* Its in-memory representation is still a MapAccessor (a map of absolute
  world coordinates to palette index).
* The game can still open and play legacy MapAccessor maps.
* On save in the editor, the game will upgrade/convert MapAccessor chunks over
  to RLEAccessors, improving on your level's file size with a simple re-save.

Current Bugs

* On every re-save to RLE, one pixel is lost in the bottom-right corner of
  each chunk. Each subsequent re-save loses one more pixel to the left, so what
  starts as a single pixel per chunk slowly evolves into a horizontal line.
* Some pixels smear vertically as well.
* Off-by-negative-one errors when some chunks Iter() their pixels but compute
  a relative coordinate of (-1,0)! Some mismatch between the stored world coords
  of a pixel inside the chunk vs. the chunk's assigned coordinate by the Chunker:
  certain combinations of chunk coord/abs coord.

To Do

* The `doodad touch` command should re-save existing levels to upgrade them.
2024-05-23 23:02:01 -07:00
..
balance (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
branding Doodle++ Code Cleanup 2024-04-18 22:49:12 -07:00
campaign Rename Go module 2022-09-24 15:17:25 -07:00
chatbot Rename Go module 2022-09-24 15:17:25 -07:00
collision Walk up slopes smoothly, texture freeing improvement 2024-02-07 22:14:48 -08:00
cursor TouchScreenMode Fix 2024-04-19 22:42:47 -07:00
doodads Deterministic JavaScript intervals + Code Cleanup 2024-04-27 00:10:28 -07:00
drawtool Level Thumbnails on Story Mode Select 2023-12-09 14:59:31 -08:00
enum Flood Tool, Survival Mode for Azulian Tag 2022-03-26 13:55:06 -07:00
filesystem Rename Go module 2022-09-24 15:17:25 -07:00
gamepad Unit test fixes and code cleanup 2023-12-02 12:33:14 -08:00
keybind Flood Tool, Survival Mode for Azulian Tag 2022-03-26 13:55:06 -07:00
level (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
levelpack Update savegame format, Allow out-of-bounds camera 2023-03-07 21:55:10 -08:00
log Switch github.com/kirsle/golog to git.kirsle.net/go/log 2019-12-22 18:34:31 -08:00
modal Wait Modal 2022-09-24 18:39:02 -07:00
native Code cleanup for TouchScreenMode 2024-04-19 23:13:32 -07:00
pattern SemiSolid Pixels + Icons 2022-10-09 21:39:43 -07:00
physics Rename Go module 2022-09-24 15:17:25 -07:00
plus Doodle++ Code Cleanup 2024-04-18 22:49:12 -07:00
savegame Update savegame format, Allow out-of-bounds camera 2023-03-07 21:55:10 -08:00
scripting Deterministic JavaScript intervals + Code Cleanup 2024-04-27 00:10:28 -07:00
shmem Level Difficulty + UI Polish 2022-03-06 22:20:53 -08:00
sound Level Thumbnails on Story Mode Select 2023-12-09 14:59:31 -08:00
sprites Rename Go module 2022-09-24 15:17:25 -07:00
uix (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
updater Rename Go module 2022-09-24 15:17:25 -07:00
usercfg Fix blockers for v0.14.0 release 2024-05-05 15:59:56 -07:00
userdir Log game output to disk, update deps for 1.14.0 2024-05-04 19:32:40 -07:00
wallpaper Level Thumbnails on Story Mode Select 2023-12-09 14:59:31 -08:00
wasm Level Thumbnails on Story Mode Select 2023-12-09 14:59:31 -08:00
windows Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
cheats.go Add cheat code to send power to all actors 2023-02-18 14:21:07 -08:00
commands.go Walk up slopes smoothly, texture freeing improvement 2024-02-07 22:14:48 -08:00
common_menubar.go Rename Go module 2022-09-24 15:17:25 -07:00
config.go Level Thumbnails on Story Mode Select 2023-12-09 14:59:31 -08:00
doodle.go Deterministic JavaScript intervals + Code Cleanup 2024-04-27 00:10:28 -07:00
editor_scene.go D++ Default Author and Embedded Doodads Error 2024-04-18 22:31:11 -07:00
editor_scene_debug.go Rename Go module 2022-09-24 15:17:25 -07:00
editor_ui.go WIP Doodle++ 2024-04-18 20:23:07 -07:00
editor_ui_doodad.go Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
editor_ui_menubar.go Doodle++ Code Cleanup 2024-04-18 22:49:12 -07:00
editor_ui_palette.go WIP: Chunker size to uint8 and Rectangular Doodads 2023-02-16 21:47:18 -08:00
editor_ui_popups.go Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
editor_ui_toolbar.go Rename Go module 2022-09-24 15:17:25 -07:00
fps.go Dust off WASM build support 2023-12-08 21:52:34 -08:00
guitest_scene.go Rename Go module 2022-09-24 15:17:25 -07:00
main_scene.go Prepare v1.14.0 for release 2024-05-04 18:26:32 -07:00
menu_scene.go Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
play_inventory.go WIP: Chunker size to uint8 and Rectangular Doodads 2023-02-16 21:47:18 -08:00
play_scene.go Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
play_scene_menubar.go Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
play_scene_touch.go TouchScreenMode Fix 2024-04-19 22:42:47 -07:00
player_physics.go Coyote time 2024-02-06 20:56:07 -08:00
scene.go Walk up slopes smoothly, texture freeing improvement 2024-02-07 22:14:48 -08:00
shell.go Cheats Menu UI 2023-01-02 12:36:12 -08:00