melonjs-20-migration
यह क्या करती है
यह बताती है कि melonJS वर्शन 20 में क्या बदला और कौन से पुराने फ़ंक्शन अब काम नहीं करते। यह melonJS ब्राउज़र गेम इंजन इस्तेमाल करने वाले गेम डेवलपर्स के लिए है।
कब इस्तेमाल करें
- ✓जब डेवलपर वर्शन 19 या पुराने से melonJS गेम अपग्रेड कर रहा हो।
- ✓जब डेवलपर melonJS कोड लिखे और कोई अपेक्षित मेथड मौजूद न हो।
- ✓जब डेवलपर melonJS गेम शुरू करे और सेटअप के बाद स्क्रीन खाली रहे।
Skill का लिंक
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-20-migration/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“अपग्रेड के बाद मेरा melonJS गेम खाली स्क्रीन दिखा रहा है। वर्शन 20 में क्या बदला है?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल मुख्य बदलाव संभावना के क्रम में सूचीबद्ध करती है, जैसे ऐप सेटअप पर ज़रूरी await, और बताती है कि कौन से पुराने export हट गए या नाम बदल गए।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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.
अक्सर पूछे जाने वाले सवाल
सबसे आम गलती कौन सी है?
स्किल कहती है कि अपग्रेड के बाद ऐप इनिशियलाइज़ेशन पर ज़रूरी await छूट जाना सबसे आम समस्या है।
खाली स्क्रीन क्यों आती है?
वर्शन 20 में ऐप बनाने से वह शुरू नहीं होता, इसलिए जब तक इनिशियलाइज़ेशन का await न हो, कुछ नहीं बनता।
क्या यह WebGPU विकल्प कवर करती है?
हाँ। यह WebGL 2 बेसलाइन और WebGPU बैकएंड का उल्लेख करती है।
जानकारी
लेखक का मूल विवरण
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
लोकप्रियता
- GitHub स्टार
- 6.4k
- रैंकिंग में स्थान
- #14194
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
melonjs-3d-assets
6.4kआपके एजेंट को glTF, GLB और OBJ जैसे 3D मॉडल melonJS ब्राउज़र गेम में लोड करने में मदद करती है, scale और lighting विकल्पों के साथ।
melonjs-3d
6.4kआपके एजेंट को melonJS ब्राउज़र गेम में 3D या 2.5D दृश्य बनाने में मदद करती है, जिसमें कैमरा, मेश, लाइट और गहराई शामिल हैं, इंजन के अपने axis नियमों के साथ।
melonjs-audio
6.4kआपके एजेंट को melonJS गेम में साउंड इफ़ेक्ट और संगीत जोड़ने में मदद करती है, जिसमें ऑडियो सेटअप, बैकग्राउंड ट्रैक, वॉल्यूम नियंत्रण और स्थानिक ध्वनि शामिल हैं।
melonjs-camera-and-drawing
6.4kआपके एजेंट को melonJS गेम का कैमरा नियंत्रित करने में मदद करती है, जैसे खिलाड़ी का पीछा करना, और गेम के अंदर अपने आकार व लाइनें बनाना।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।