melonjs 20.13.0 → 20.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -22
- package/build/application/application.d.ts +6 -1
- package/build/application/application.d.ts.map +1 -1
- package/build/application/header.d.ts.map +1 -1
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/settings.d.ts +13 -8
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +8 -4
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/playback.d.ts +2 -2
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/spatial.d.ts.map +1 -1
- package/build/audio/types.d.ts +15 -5
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +10 -9
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +11 -8
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/geometries/path2d.d.ts +9 -8
- package/build/geometries/path2d.d.ts.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +40993 -39738
- package/build/index.js.map +4 -4
- package/build/input/keyboard.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +2 -1
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +13 -3
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +1 -0
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +7 -3
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +55 -0
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/cache.d.ts +146 -97
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/internal-types.d.ts +69 -0
- package/build/loader/internal-types.d.ts.map +1 -0
- package/build/loader/loader.d.ts +584 -292
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/audio.d.ts.map +1 -1
- package/build/loader/parsers/fontface.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/tmx.d.ts.map +1 -1
- package/build/math/color.d.ts +4 -0
- package/build/math/color.d.ts.map +1 -1
- package/build/math/noise.d.ts +16 -16
- package/build/math/noise.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +64 -25
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +9 -0
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts +25 -3
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/world.d.ts +40 -10
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -0
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/draggable.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +16 -14
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +62 -5
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +5 -0
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/uibaseelement.d.ts +8 -1
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uicheckbox.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -2
- package/build/system/device.d.ts.map +1 -1
- package/build/system/fullscreen.d.ts.map +1 -1
- package/build/system/pool.d.ts.map +1 -1
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +16 -14
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/canvas_factory.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +127 -0
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs/SKILL.md +38 -14
- package/skills/melonjs-20-migration/SKILL.md +50 -7
- package/skills/melonjs-3d/SKILL.md +138 -38
- package/skills/melonjs-3d-assets/SKILL.md +83 -33
- package/skills/melonjs-audio/SKILL.md +55 -14
- package/skills/melonjs-camera-and-drawing/SKILL.md +95 -8
- package/skills/melonjs-deployment/SKILL.md +92 -14
- package/skills/melonjs-display-and-scaling/SKILL.md +8 -3
- package/skills/melonjs-effects-and-shaders/SKILL.md +46 -15
- package/skills/melonjs-events/SKILL.md +3 -2
- package/skills/melonjs-getting-started/SKILL.md +5 -0
- package/skills/melonjs-input/SKILL.md +65 -15
- package/skills/melonjs-lighting/SKILL.md +13 -1
- package/skills/melonjs-loading-assets/SKILL.md +202 -27
- package/skills/melonjs-math/SKILL.md +12 -5
- package/skills/melonjs-particles-and-trails/SKILL.md +7 -3
- package/skills/melonjs-performance/SKILL.md +18 -8
- package/skills/melonjs-physics/SKILL.md +385 -127
- package/skills/melonjs-plugins/SKILL.md +45 -11
- package/skills/melonjs-renderables/SKILL.md +24 -7
- package/skills/melonjs-renderer-backends/SKILL.md +38 -17
- package/skills/melonjs-scenes-and-state/SKILL.md +30 -5
- package/skills/melonjs-sprites-and-animation/SKILL.md +23 -2
- package/skills/melonjs-tilemaps/SKILL.md +56 -18
- package/skills/melonjs-ui-and-text/SKILL.md +120 -25
|
@@ -18,8 +18,13 @@ await app.init();
|
|
|
18
18
|
plugin.register(DebugPanelPlugin, "debugPanel");
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
It reports
|
|
22
|
-
shapes and
|
|
21
|
+
It reports update and draw time, FPS, heap and object counts, and can overlay
|
|
22
|
+
collision shapes, bounds, velocities and the quadtree. Its `#draws` is the
|
|
23
|
+
number of the world's direct children drawn this frame, **not** GPU draw
|
|
24
|
+
calls. Draw calls are usually the number that matters, and nothing in the
|
|
25
|
+
engine counts them: on WebGL, count them the way the `linkProgram` counter
|
|
26
|
+
below counts programs, by wrapping `drawElements` and `drawArrays` (and
|
|
27
|
+
their `Instanced` forms) on `WebGL2RenderingContext.prototype`.
|
|
23
28
|
|
|
24
29
|
## Batching: the biggest lever
|
|
25
30
|
|
|
@@ -180,8 +185,8 @@ between, which reads as a bad texture rather than as a transform bug.
|
|
|
180
185
|
- On top of that, the **built-in physics adapter** gates body integration and
|
|
181
186
|
narrow-phase collision on the same `inViewport || alwaysUpdate` — so an
|
|
182
187
|
off-screen body stops simulating even if something else calls its `update`.
|
|
183
|
-
The planck and
|
|
184
|
-
regardless of the camera.
|
|
188
|
+
The planck, matter and Rapier adapters have no such gate: they step the
|
|
189
|
+
whole world regardless of the camera.
|
|
185
190
|
- Set `alwaysUpdate = true` on anything that must keep moving off-screen, and
|
|
186
191
|
accept the cost. On many objects it removes the saving entirely.
|
|
187
192
|
- `floating = true` does **not** disable culling — it moves the test into screen
|
|
@@ -227,10 +232,14 @@ queries one at a time, usually not. See `melonjs-3d` for the decision table.
|
|
|
227
232
|
when first played.
|
|
228
233
|
- `pool` on an audio clip sizes the reuse pool for finished instances — it is
|
|
229
234
|
**not** a concurrency cap.
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
- Free a level's assets when the player leaves it: load them as a bundle
|
|
236
|
+
(`{ common: [...], level1: [...] }` passed to `loader.preload()`), then
|
|
237
|
+
`loader.unload("level1")` once the next level is in. An asset another loaded
|
|
238
|
+
bundle lists stays; `loader.unloadAll()` drops everything. Either way a
|
|
239
|
+
freed image also frees the GPU texture uploaded from it (since 20.14; before,
|
|
240
|
+
only the loader's reference went), and a shader its program — so an effect
|
|
241
|
+
that outlives a level belongs in a bundle that outlives it, such as
|
|
242
|
+
`common`. See `melonjs-loading-assets`.
|
|
234
243
|
|
|
235
244
|
## The first frame of a scene is not like the others
|
|
236
245
|
|
|
@@ -363,6 +372,7 @@ In rough order for a typical 2D game:
|
|
|
363
372
|
|
|
364
373
|
| symptom | cause |
|
|
365
374
|
|---|---|
|
|
375
|
+
| the game stops updating for good after a long hitch, or freezes on the first frame of a new state, while `requestAnimationFrame` keeps running (20.12 and 20.13) | one update slower than ten frames made the next step need more saved time than the loop keeps: update |
|
|
366
376
|
| high draw-call count | the texture-unit pool overflows, or primitives/meshes are interleaved with sprites |
|
|
367
377
|
| draw calls jump when one effect is enabled | a custom shader on the quad batcher disables multi-texture batching |
|
|
368
378
|
| frame time spikes and GC pauses | allocating per frame instead of pooling |
|