Log inGet started
World

Save Point

Branchmain
Branchesmain
Commit8937fc8d08

README.md

framecodec

Packs an emulator's RGBA framebuffer into a small text payload for multiplayer.send, and unpacks it back. A frame becomes a palette of the colours it uses (up to 255; past that, colours drop to 5 bits per channel, which every Game Boy Color frame already is) plus runs of one colour as (index, length) bytes, base64 encoded so it travels as plain text. A typical Game Boy frame packs to 1–6 KB.

local Codec = require("stations.framecodec")
local text = Codec.encode(fb, 160, 144)          -- fb: buffer, width*height*4 RGBA
local ok = Codec.decode(text, outBuffer)          -- writes RGBA into outBuffer (same size); false if malformed