melonjs-20-migration
What it does
It lists what changed in melonJS version 20 and which older functions no longer work. It is for game developers using the melonJS browser game engine.
When to use it
- βWhen a developer is upgrading a melonJS game from version 19 or earlier.
- βWhen a developer writes melonJS code and an expected method does not exist.
- βWhen a developer starts a melonJS game and the screen stays blank after setup.
Skill link
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-20-migration/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMy melonJS game shows a blank screen after I upgraded. What changed in version 20?β
5 new skills a week. 1 minute to read.
How it works
The skill lists the key changes in order of likelihood, such as the required await on app setup, and points out which older exports are gone or renamed.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Migrating to melonJS 20.x
What changed in melonJS 20.x, and which older APIs are gone, deprecated, or renamed. Read this before writing melonJS code from memory β much of what is published about melonJS predates 20.0.
Why this skill exists: most melonJS material in circulation describes 19.x or earlier. Code written from that knowledge looks correct and fails at runtime. The items below are ordered by how likely they are to be reproduced from memory.
1. Application.init() is mandatory and asynchronous
Since 20.0, constructing an Application no longer initialises it.
// β pre-20.x β the constructor called init(width, height, options) for you
const app = new Application(800, 600, { parent: "screen" });
app.world.addChild(sprite); // added, but nothing ever renders
// β 20.x
const app = new Application(800, 600, { parent: "screen" });
await app.init(); // REQUIRED
app.world.addChild(sprite);
init() is async because acquiring a WebGPU device is async. There is no
synchronous alternative, and no automatic fallback that papers over the missing
call. Nothing that then breaks names it: the constructor still builds
app.world, so children can be added and simply never draw β no canvas is
appended, the app never subscribes to the frame tick, and app.renderer /
app.viewport stay undefined β while constructing a Sprite or Text first
throws a TypeError on the unset global game instead.
The signature changed too: 19.x took init(width, height, options), 20.x takes
none, and anything passed is ignored (settings come from the constructor).
video.init(...) no longer exists. The video module now exports only the
four renderer constants (AUTO, CANVAS, WEBGL, WEBGPU) β there is no
init on it to call. Any code shaped like me.video.init(800, 600, {...}) is
from a removed API. Build an Application and await init().
Note that import * as me from "melonjs" still works, so me.Sprite style is
fine. It is the globals bootstrap that is gone, not the namespace import.
2. Post effects replaced the shader property
renderable.shader = β¦ is deprecated since 19.2.0. Use the post-effect API:
// β deprecated
mySprite.shader = new ShaderEffect(app.renderer, glslBody);
// β
mySprite.addPostEffect(new ShaderEffect(app.renderer, glslBody));
Related trap: removePostEffect() destroys the effect β and so does
assigning renderable.shader, which destroys whatever it replaces. Only an
effect carrying shared = true is spared. To turn one off temporarily, toggle
effect.enabled instead: remove-and-re-add hands you back an object whose GPU
resources have already been freed.
3. WebGL 2 is the baseline; WebGPU is the default attempt
video.AUTO now tries WebGPU β WebGL 2 β Canvas. WebGL 1 is gone.
Consequences:
- Which backend runs is a runtime fact. Do not write code that assumes WebGL.
- Custom shaders can carry both GLSL and WGSL in one asset, so one effect runs on either GPU backend.
- Features needing a programmable pipeline are inert on Canvas and warn once rather than throwing.
4. Deprecated exports still present
These resolve but should not be used in new code:
| deprecated | since | use instead |
|---|---|---|
CanvasTexture |
17.1.0 | CanvasRenderTarget |
Compositor |
18.1.0 | WebGLBatcher |
PrimitiveCompositor |
18.1.0 | PrimitiveBatcher |
QuadCompositor |
18.1.0 | QuadBatcher |
Math (capitalised) |
18.0.0 | math (lowercase) |
device.requestFullscreen / exitFullscreen |
19.7.0 | app.requestFullscreen() / app.exitFullscreen() |
renderable.shader = β¦ |
19.2.0 | addPostEffect() |
Entity |
18.1.0 | Sprite / Renderable + a Body |
loader.onload / onProgress / onError |
18.2.0, removed 20.3 | the LOADER_* events, or preload(assets, onloadcb) |
response.overlap / overlapN / overlapV |
β | response.depth / response.normal |
setLineWidth() |
17.3.0 | the lineWidth property |
Two of these deserve emphasis:
Entityis still exported, so code using it compiles and runs while being the wrong shape for 20.x. Compose aSprite/Renderablewith aBodyinstead.- The capitalised
Mathshadows the globalMathif imported carelessly.me.Math.random()from older docs resolves to the deprecated re-export.
5. The global game is not the modern shape
game is still exported, but since 20.
FAQ
What is the most common mistake?
The skill says missing the required await on app initialization is the most common issue after an upgrade.
Why does a blank screen happen?
In version 20, creating the app does not start it, so nothing draws until initialization is awaited.
Does it cover the WebGPU option?
Yes. It notes the WebGL 2 baseline and the WebGPU backend.
Details
Original description by the author
Use this skill when writing melonJS code that may be based on pre-20.x knowledge, when migrating a game from melonJS 19.x or earlier, or when an API you expected does not exist. Covers the mandatory async Application.init(), the WebGL 2 baseline and WebGPU backend, renderable post effects replacing the shader property, and the deprecated exports still present. Triggers on: migration, upgrade, melonJS 19, me.game, me.video.init, renderable.shader, Compositor, CanvasTexture, me.Math, deprecated.
repo: melonjs/melonJS
Popularity
- GitHub stars
- 6.4k
- Ranking position
- #14194
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
melonjs-3d-assets
6.4kHelps your agent load 3D models such as glTF, GLB and OBJ files into a melonJS browser game, with scale and lighting options.
melonjs-3d
6.4kHelps your agent build 3D or 2.5D scenes in a melonJS browser game, covering cameras, meshes, lights and depth, using the engine's own axis rules.
melonjs-audio
6.4kHelps your agent add sound effects and music to a melonJS game, including audio setup, background tracks, volume control and spatial sound.
melonjs-camera-and-drawing
6.4kHelps your agent control a melonJS game camera, such as following a player, and draw custom shapes and lines inside the game.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.