Async asset preloading + a loading phase/scene (splash) so first render doesn't stall #82
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Assets are loaded synchronously inside Boot/Start (
png_load,Audio.load), stalling the first frame(s) as content grows, and there is no built-in loading phase or way to show a splash/progress while assets load.Proposal: an asset preload step (ideally async/streamed) and a first-class loading scene/phase pattern (or
@Preload) with progress, so a game shows a loading screen and only enters play once assets are ready. Pairs with the namespaced asset/spritesheet API issue.Shipped in
f2cb3cd(full suite 117/0, goldens byte-identical, fixpoint intact).Adds an incremental asset preload queue (over the #81 atlas), the deterministic no-threads form of async preloading — the work is spread across frames instead of stalling one:
Assets.enqueue(name, path)— queue a named image file without loading itAssets.pump(max) -> int— load up tomaxqueued assets this frame (returns how many it loaded); call it each frame in a loading scene with a smallmaxso the frame stays shortAssets.total()/Assets.loaded()/Assets.ready()/Assets.progress()(0..100 percent) — drive a progress barThe loading-scene pattern: a
scene LoadingRender handler pumps a few assets, drawsAssets.progress()as a bar, andbecomes the play scene onceAssets.ready()— so the game shows a responsive loading screen and only enters play once content is ready. Loaded assets are reachable by name viaAssets.get/Sprite.named. Deterministic: the same enqueue+pump order loads the same assets in the same order every run (lockstep/replay-safe).Verified by
examples/library/preload.ludic: enqueue 3, pump incrementally (progress 0 -> 33 -> 66 -> 100),readyflips, andAssets.get("hero")resolves after load — prints3 0 0 0 1 33 66 1 100 1. 6 docs pages.On 'ideally async/streamed': Ludic has no OS threads by design (determinism), so true background streaming isn't on the table — this per-frame incremental loader is the deterministic equivalent, and it composes with the existing Jobs cooperative scheduler if a game wants to pump from there.