doodle/pkg/uix
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
..
magic-form ListBoxes Overhaul 2023-04-08 21:26:08 -07:00
actor.go Coyote time 2024-02-06 20:56:07 -08:00
actor_animation.go Rename Go module 2022-09-24 15:17:25 -07:00
actor_collision.go Tweak gravity and player physics 2024-02-06 19:04:47 -08:00
actor_events.go Doodads: Use Key and Working Warp Doors 2021-01-03 15:19:21 -08:00
canvas.go Update savegame format, Allow out-of-bounds camera 2023-03-07 21:55:10 -08:00
canvas_actors.go Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
canvas_cursor.go Rename Go module 2022-09-24 15:17:25 -07:00
canvas_debug.go Finalize Non-square Doodads 2023-02-17 21:09:11 -08:00
canvas_editable.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
canvas_link_tool.go Rename Go module 2022-09-24 15:17:25 -07:00
canvas_memory.go Rename Go module 2022-09-24 15:17:25 -07:00
canvas_present.go Fix doodad properties button hitbox 2024-02-11 17:00:19 -08:00
canvas_scrolling.go Fix touchscreen mode detection 2024-04-19 22:01:33 -07:00
canvas_strokes.go Rename Go module 2022-09-24 15:17:25 -07:00
canvas_wallpaper.go Update savegame format, Allow out-of-bounds camera 2023-03-07 21:55:10 -08:00
canvas_zoom.go Rename Go module 2022-09-24 15:17:25 -07:00
crosshair.go Rename Go module 2022-09-24 15:17:25 -07:00
scripting.go Scripting: Bring Self API up to Actor API parity 2024-04-26 22:34:13 -07:00