melonjs 20.9.0 → 20.10.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/build/application/settings.d.ts +12 -8
- package/build/application/settings.d.ts.map +1 -1
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1616 -225
- package/build/index.js.map +4 -4
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +6 -0
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/squish.d.ts +74 -0
- package/build/video/effects/squish.d.ts.map +1 -0
- package/build/video/renderer.d.ts +16 -3
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +5 -0
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +21 -0
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/deletable.d.ts +15 -0
- package/build/video/webgl/buffer/deletable.d.ts.map +1 -0
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -1
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -1
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -1
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -1
- package/build/video/webgpu/texture/store.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs-effects-and-shaders/SKILL.md +50 -6
- package/skills/melonjs-loading-assets/SKILL.md +22 -4
- package/skills/melonjs-performance/SKILL.md +7 -3
|
@@ -111,13 +111,31 @@ the assets are in and **before** `LOADER_COMPLETE` fires, so it happens while
|
|
|
111
111
|
the progress bar is still up. Every `preload()` warms, not just the first, so a
|
|
112
112
|
per-level preload warms whatever that level brought with it.
|
|
113
113
|
|
|
114
|
-
The one precondition: **a game that never calls
|
|
115
|
-
|
|
114
|
+
The one precondition for this part: **a game that never calls
|
|
115
|
+
`loader.preload()` does not get it**. If you load assets another way, call
|
|
116
116
|
`await app.renderer.prewarm()` yourself. On
|
|
117
117
|
WebGL that links the mesh batchers' variants, for the unlit tier and the lit
|
|
118
118
|
one that inherits from it; on WebGPU it compiles the
|
|
119
|
-
WGSL module of every shader the loader holds
|
|
120
|
-
|
|
119
|
+
WGSL module of every shader the loader holds, and the mip-chain blitter when
|
|
120
|
+
textures are filtered.
|
|
121
|
+
|
|
122
|
+
**4. Everything that depends on the renderable — warmed as you build, since
|
|
123
|
+
20.10.** The rest cannot be done at preload, because it depends on what draws:
|
|
124
|
+
on WebGPU a *pipeline* is keyed by blend mode, culling, transparency and the
|
|
125
|
+
format of the target as well as by shader, and that compile is the expensive
|
|
126
|
+
part (tens of milliseconds, up to 140ms measured, per effect). So, behind the
|
|
127
|
+
same `prewarm` setting, the engine warms a renderable when it gains an effect
|
|
128
|
+
(`addPostEffect`, or assigning `shader`) and when it is added to the world:
|
|
129
|
+
its effect pipelines, its own draw, the render targets its chain composites
|
|
130
|
+
through, the advanced-blend shader if it uses one. Inline effects are covered
|
|
131
|
+
too; on WebGL that means linking a mesh-hosted effect's spliced program.
|
|
132
|
+
|
|
133
|
+
That work starts after your code has run and finishes off the frame, so it
|
|
134
|
+
needs **at least a frame between setting a renderable up and drawing it**. The
|
|
135
|
+
pattern that gets it for free is the one you want anyway: build pools (and
|
|
136
|
+
attach their effects) when the stage starts, then show and hide them during
|
|
137
|
+
play. Something created and drawn in the same frame still compiles on that
|
|
138
|
+
frame.
|
|
121
139
|
|
|
122
140
|
Cost to a game that uses none of it is about 60ms of preload on a desktop GPU.
|
|
123
141
|
Set it to `false` only for a target where linking is slow enough that the
|
|
@@ -245,9 +245,12 @@ Since 20.6 the engine's own programs are built during `preload()` instead —
|
|
|
245
245
|
`loader.preload()` calls `renderer.prewarm()` itself, on every call, when the
|
|
246
246
|
application's `prewarm` setting is on, which is the default. So on a current
|
|
247
247
|
version this is one cause you can rule out before looking further, **unless the
|
|
248
|
-
game does not use the preloader at all**, which is the one way to miss it — see `melonjs-loading-assets`.
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
game does not use the preloader at all**, which is the one way to miss it — see `melonjs-loading-assets`. Since 20.10 the
|
|
249
|
+
pipelines that depend on the renderable (effects, blend modes, render targets)
|
|
250
|
+
are warmed when an effect is attached or a renderable is added to the world, as
|
|
251
|
+
long as that happens at least a frame before it is drawn: a pool built at stage
|
|
252
|
+
start is covered, an object created and drawn in the same frame is not. None of
|
|
253
|
+
this covers the rest of what a first frame pays for, below.
|
|
251
254
|
|
|
252
255
|
How to tell them apart, all from the page:
|
|
253
256
|
|
|
@@ -364,6 +367,7 @@ In rough order for a typical 2D game:
|
|
|
364
367
|
| memory grows with long music | missing `stream: true` |
|
|
365
368
|
| slow only on some machines | Canvas fallback — no GPU tilemap path |
|
|
366
369
|
| a freeze the first time a level shows, never again | shader variants linking on first draw — warm them behind the loading screen |
|
|
370
|
+
| a freeze the first time an effect appears mid-play (a shield, a hit flash) | the effect attached in the same frame it is drawn — attach it when the pool is built, so the warm-up has a frame to finish |
|
|
367
371
|
| the same scene stutters once per entry | a derived texture rebuilt per stage: the texture cache keys on the image object, so each rebuild is a new upload |
|
|
368
372
|
|
|
369
373
|
## Related skills
|