Skip to content

Loading screen: show the bar and the logo together; 20.11.1 - #1776

Merged
obiot merged 1 commit into
masterfrom
fix/loading-screen-logo
Oct 28, 2026
Merged

obiot merged 1 commit into
masterfrom
fix/loading-screen-logo

Conversation

@obiot

@obiot obiot commented Oct 28, 2026

Copy link
Copy Markdown
Member

Description

The default loading screen put its progress bar on screen at once and loaded the melonJS logo in parallel. The logo is decoded a frame or so later, so on some loads the bar was drawn alone first and the logo popped in after it.

Now the bar is built at once, so it still follows the load from the first asset, but goes on screen in the same frame as the logo. It shows alone in two cases:

  • the logo cannot be decoded;
  • the game's assets finish before the logo, so the screen is not left empty while the game sets up or for a state.transition() to fade over. The late logo is still never added, as before.

A bar torn down before it was ever shown is now destroyed directly, which drops its LOADER_PROGRESS subscription (the world would otherwise never destroy it).

Also bumps melonjs and .claude-plugin/plugin.json to 20.11.1, with the changelog entry under the 20.11.1 section #1775 opened. The loading-assets skill now says the bar and logo are added together.

Verification

  • tests/loadingscreen.spec.js: 4 new tests (bar and logo arrive together; bar alone when the logo fails to decode; the bar tracks progress before it is shown; a never-shown bar is destroyed with its subscription). Breaking each rule in the source fails its test (4 of 4).
  • In the browser, frame by frame from boot, with the game's assets held back 1.5 s: on 20.11.0 the bar came up alone first in 2 of 6 runs (about 15 ms before the logo); with this change the bar and logo appeared in the same frame in 10 of 10 runs (WebGPU and WebGL).
  • Root pnpm lint passes.

Type of change

  • Bug fix

🤖 Generated with Claude Code

https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx

The progress bar went on screen at once and the logo, decoded a frame or
so later, popped in after it. The bar is now built at once (it still
follows the load from the first asset) but put on screen in the same
frame as the logo. It shows alone when the logo cannot be decoded, or
when the game's assets finish first so the screen is not left empty for
a transition. A bar torn down before it was ever shown is destroyed,
dropping its LOADER_PROGRESS subscription.

Also bumps melonjs and the Claude plugin to 20.11.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx
Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@obiot
obiot merged commit c045d2d into master Oct 28, 2026
6 checks passed
@obiot
obiot deleted the fix/loading-screen-logo branch October 28, 2026 03:12
hghpublic pushed a commit to hghpublic/melonjs-melonJS that referenced this pull request Nov 19, 2026
…elonjs#1617)

melonJS depended on a third-party audio library. It is now maintained in-tree
under src/audio/backend, which removes the engine's last runtime dependency
besides core-js and fixes a packaging wart along the way: the emitted type
declarations referenced the library, so consumers type-checking with
`skipLibCheck: false` had to install it themselves.

The starting point was that library's unmerged TypeScript rewrite. Upstream's
last release was 2.2.4 in September 2023 and the rewrite has sat open since
November 2025. It carries defects the shipped 2.2.4 does not, and each one is
now pinned by a regression test written against 2.2.4's behaviour:

  - the sound-level and voice-level create hooks shared a name and were
    registered into one object literal, so one silently replaced the other
  - pos(), orientation() and stereo() lost their group-level read path: called
    with no arguments they returned the sound itself, and a set with no instance
    id never recorded the value, so a set could not be read back
  - the audio context was never created before a spatial call, so pos() on a
    clip that had not played yet silently discarded the value
  - loop(loop, id) was unreachable through the types
  - unregistering the spatial plugin threw before cleaning anything up
  - pannerAttr(id) with a numeric argument was undeclared

Eight fixes were also carried over from pull requests that have sat unmerged
against 2.2.4, most of them mobile correctness: panner attributes shared by
reference and leaking between sounds (melonjs#1758), the iOS play-after-pause race
(melonjs#1761), a resume() rejection wedging the engine in "suspended" (melonjs#1764), a
looping clip reporting a position past its loop end (melonjs#1776), headphone unplug
leaving playback dead (melonjs#1551), a null context on low-end iOS (melonjs#1363), a queued
stop() dropping its internal flag (melonjs#1648), and a backgrounded tab never
resuming (melonjs#1770).

Structurally, being in-tree means the layers can be honest. The plugin registry
is gone — it existed so third parties could extend the library, and there was
only ever one plugin, always installed; spatial audio is now part of the engine,
sound and voice paths directly. Audio context creation is idempotent and belongs
to the engine rather than a free function that reached into the singleton with
no guard. The bundled user-agent parser is gone: it duplicated system/platform
less well, missing iPadOS 13+ entirely, and the one check still reachable from
it now lives there as `appleVendor`. CocoonJS support and the iOS 8 fallback are
gone as unreachable.

The loader keeps its own boundary. Audio is registered through a parser in
loader/parsers/ like every other asset type, rather than the loader importing
the audio module directly, so a future backend change cannot ripple into it. The
shared fetch helper moved out of loader/parsers/ to utils/: it is engine
transport, not loader policy, and its placement was the only reason the audio
module had to import the loader at all. That move fixes a real bug — audio was
the last asset type calling fetch() directly, so sound files failed to load when
a game is served from file://, which is a Cordova or Capacitor APK on Android.

Owning the code also makes capability reachable that was always there. Clips can
declare sprite regions, so one download carries many effects; duration(),
playing() and state() are exposed; and pool, rate, mute, preload, format and a
map of lifecycle callbacks can be set at load time. play()'s second argument
accepts either the original loop boolean or an options object, so every existing
call form is unchanged.

The backend keeps its own CHANGELOG and LICENSE, recording that it is a
customized derivative rather than the upstream library.


Claude-Session: https://claude.ai/code/session_012Aa37KGXZcnVrbn1yG4j1N

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants