ludic/selfhost/backend/stdlib
Orkuncakilkaya ce5bf0fe0e feat(pack): asset packs, so a built game is a thing you can hand someone
A Ludic game opened its assets by a path relative to the working directory, so
`build/mygame` ran only from the project root and there was nothing to give
anyone but "the binary, and also this whole tree". A game is not one file, but
shipping it has to be.

`ludic pack` writes a .lpak: a header, a name-sorted entry table, a name heap
and the blobs, 16-byte aligned. Entries are stored rather than compressed - PNG,
JPEG and glTF binary arrive compressed already, and a decompressor on the load
path would spend CPU to make the file no smaller.

The reader is spliced into the compiler at the one place every asset in a Ludic
program comes through: file_open. gltf_load, tex_load, Audio.load, Fs.read_text
and the renderer's own shader loads all bottom out there, so routing it through
@lp_pak_open reaches every one of them without any of them knowing. A read of a
packed path becomes an fmemopen over the mapped bytes; everything else is the
fopen it always was. Fs.exists and Fs.size consult the packs too, so a game that
guards a load with Fs.exists keeps finding its assets once they are packed.

The pack is mmap'd rather than read: 165 MB of textures costs one syscall at
boot and pages in only what is touched. @lp_pak_boot runs from
@llvm.global_ctors, before main, so a pack is mounted before the game's first
line - and it reads packs.index, a plain list, so the mount order is explicit
and a later pack shadows an earlier one.

Without a packs.index nothing mounts and every open goes to the filesystem
exactly as before, which is every `ludic run` during development. Packing is a
shipping step and is invisible until you ship.

The compiler reproduces itself byte-exactly and the C-free bootstrap from the
seed still holds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 16:37:23 +03:00
..
emit_anim.ludic feat(anim): animation ergonomics — named clips, Anim.play/Motion.to, frame events, fluent Tween handles (#48) 2026-08-31 16:53:16 +03:00
emit_color.ludic refactor(cli)!: split the contributor tool out of the ludic CLI 2026-09-05 23:15:12 +03:00
emit_colorfn.ludic refactor(selfhost): reorganise into concern-based subdirectories 2026-08-31 00:26:02 +03:00
emit_crypto.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_datetime.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_ease.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_fs.ludic feat(pack): asset packs, so a built game is a thing you can hand someone 2026-09-10 16:37:23 +03:00
emit_hash.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_ivec.ludic feat(engine): #90 atlas-aware Sprite component, #91 become from listeners, 0.3.x ergonomics batch 2026-09-04 01:36:08 +03:00
emit_key.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_list.ludic feat(engine): #90 atlas-aware Sprite component, #91 become from listeners, 0.3.x ergonomics batch 2026-09-04 01:36:08 +03:00
emit_log.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_math.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_net.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_noise.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_os.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_pak.ludic feat(pack): asset packs, so a built game is a thing you can hand someone 2026-09-10 16:37:23 +03:00
emit_rect.ludic feat(types): IVec2 + Rect 2D value types (#1) 2026-08-31 18:29:41 +03:00
emit_text.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_text_prelude.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_time.ludic refactor(selfhost): reorganise into concern-based subdirectories 2026-08-31 00:26:02 +03:00
emit_unicode.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_uuid.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
emit_vector.ludic feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00