Releases: melonjs/melonJS
Releases Β· melonjs/melonJS
v18.3.0
What's New in melonJS 18.3.0
New Features
- Bezier curve drawing β
bezierCurveTo(),quadraticCurveTo(), andarcTo()path methods, matching the Canvas 2D API. WebGL renderer tessellates via Path2D. - Gradient fills β
createLinearGradient()andcreateRadialGradient()methods for both Canvas and WebGL renderers, usable with all fill methods - Dashed lines β
setLineDash()andgetLineDash()for stroke operations on both renderers - Tiled object factory registry β extensible
registerTiledObjectFactory()andregisterTiledObjectClass()APIs for plugins to register custom Tiled object handlers without modifying engine code
Changed
- Application as entry point β
new Application(width, height, options)auto-callsboot(), making it a standalone entry point.video.init()is deprecated. - Game singleton decoupled β internal modules no longer import from the barrel
index.js;gamesingleton usessetDefaultGamepattern - Stage lifecycle β
onResetEvent(app, ...args)andonDestroyEvent(app)now receive the Application instance as first parameter - Container defaults β dimensions default to
Infinity(no intrinsic size, no clipping), removing dependency ongame.viewport - EventEmitter β native context parameter support on
on()/once(), eliminating.bind()closure overhead
Bug Fixes
- BitmapText bounding box β width uses last glyph visual extent; height uses actual glyph extents instead of
capHeight; baseline shifts use real glyph metrics for all baselines; y offset starts at first visible pixel - BitmapText multiline baseline β shift applied once for entire text block instead of per-line (which caused accumulating offsets)
- Camera2d β floating containers with
Infinitybounds (e.g., HUD) are now always visible, fixing a regression where HUD elements stopped rendering - Sprite flicker β time-based flickering (~15 flashes/sec) replaces per-draw-call toggle that broke with multi-camera setups
- Path2D β fix
quadraticCurveTo/bezierCurveTostartPoint reference bug and adaptive segment count - Application β fix settings mutation, white flash on load, pool cleanup errors
- WebGLRenderer β fix
setBlendModepremultipliedAlpha tracking - Text β fix multiline textBaseline y offset, power-of-two texture sizes
Performance
- BitmapText β precompute
glyphMinTop/glyphMaxBottomonce in font parsing; cachemeasureTextresults insetText/resize
v18.2.2
What's Changed
melonJS Team
- Chore: fix missing README on the npm release (58a534d)
- Copy root README into melonjs package during dist (6ef58cd)
- Bump spine-plugin to 2.0.1 (501de1f)
Full Changelog: 18.2.1...18.2.2
v18.2.1
What's Changed
melonJS Team
- Fix loading screen logo persisting after preload completes (3f0be6f)
Full Changelog: 18.2.0...18.2.1
v18.2.0
What's New in melonJS 18.2.0
New Features
- Multi-camera support β stages can now have multiple cameras for split-screen, minimaps, and multi-viewport layouts
- Extensible batcher system β custom
Batchersubclasses with configurablemaxVertices, indexed drawing (settings.indexed), and custom projection uniform names (settings.projectionUniform) - Tiled 1.8β1.12 full support β oblique maps, capsule shapes, list properties, embedded base64 images, tile sub-rectangles,
tilerendersize/fillmode, layer blend modes, per-object opacity/visibility,repeatx/repeaty,parallaxoriginx/parallaxoriginy, class-type properties,isCollectionflag - RoundRect as collision shape β can now be used for SAT collision via polygon-approximated rounded corners
- Expanded blend modes β Canvas: overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion; WebGL2: darken, lighten via
gl.MIN/gl.MAX
Changed
- TypeScript β converted plugin, camera, particles emitter, state, audio, application, input, UI, and pointer modules to TypeScript
- CDN URLs β README now uses
cdn.jsdelivr.netinstead ofesm.run(which is still in beta)
Bug Fixes
- WebGLRenderer β
setBatcher()now rebinds the shared vertex buffer when switching batchers, allowing custom batchers with their own GL buffers - WebGLRenderer β
setBlendMode()now accepts apremultipliedAlphaparameter for correct blending with non-premultiplied textures - Renderer β add base
setBlendMode()andGPURendererproperty to fix TypeScript casts - Plugin β
plugin.register()now usespluginClass.namefor reliable name derivation - TMXTileset β fix animation key using first frame tile ID instead of the tile's own ID
- CanvasRenderer β replace bezier ellipse approximation with native
context.ellipse()(with polyfill) - Plugin β fix
plugin.get()throwingTypeErrorwhen searching by name with no match - Events β fix duplicate
BLURentry (was missingFOCUS) - UIBaseElement β fix
isDraggableJSDoc andreleaseddefault - Application β fix constructor
optionsnot being optional, fixgetUriFragment()unsafe cast - CanvasRenderer β
setProjection()now properly applies the projection matrix as a canvas 2D transform
Spine Plugin
@melonjs/spine-pluginmigrated into the monorepo β customSpineBatcherwith two-color tinting, indexed drawing, expanded example with 17 official Spine characters
v18.1.0
What's New in melonJS 18.1.0
New Features
ShaderEffectclass β simplified custom shader API that only requires a fragmentapply(color, uv)function. Vertex shader, uniforms, and texture sampling boilerplate are handled automatically. Silently disabled in Canvas mode.create-melonjsCLI β scaffold a new game project in seconds withnpm create melonjs my-game- Inline source code viewer β examples now have a "Show Code" button to view syntax-highlighted source alongside the running game
- API docs landing page β new home page with quick start, feature overview, and common tasks
- API docs categories β sidebar organized into 14 categories (Rendering, Physics, Input, etc.)
Changed
- Physics β collision response is now mass-proportional; overlap and velocity correction are split based on relative mass
- Entity β deprecated in favor of Sprite/Renderable + Body (#1008)
- Loader β modernized with Promise-based asset loading for improved parallel performance;
onload/onProgress/onErrordeprecated in favor of events - TMX β refactored TMXUtils into reusable
decode.tsandxml.tsmodules - Compositor β Batcher β
Compositor,QuadCompositor,PrimitiveCompositorrenamed toBatcher,QuadBatcher,PrimitiveBatcher(old names still work with deprecation warnings)
Bug Fixes
- Texture cache overflow β flush and rebatch when GPU texture units are exhausted instead of throwing (#1280)
setAntiAliasβ now controls GL texture filtering (GL_NEARESTvsGL_LINEAR) on all bound textures (#1279)createPatternleak β clean up previous GPU texture when repeat mode changes (#1278)- Custom shader support β properly flush and restore default shader per draw call, fix
setUniformusing wrong GL program, reset sampler uniform on shader switch - TMX β fix hexagonal
pixelToTileCoordsmutation, canvas memory leak, collision shape dimensions, XML parsing crash, GC pressure from vector allocations - Sprite β fix body-renderable misalignment with trimmed atlas frames, visual vibration on flip, jumping on rotated frames (#1201, #1214)
- Path2D β fix SVG arc parsing and ellipse rotation (#1198)
- WebGLRenderer β fix polygon corruption from vertex mutation, scissor restore,
drawVerticesvertex count, resizesetAntiAliascorruption - Z-ordering β fix reset during collision response
Performance
- TMX loading β ~20-40% faster via tileset caching, pre-allocated decode buffers, and fast path for base64 data
- WebGL rendering β
fillRect,fillEllipse,fillArc,fillRoundRect,fillPolygonnow generate geometry directly, bypassing path2D and earcut - WebGL batching β quad rendering uses
gl.drawElementswith index buffer (33% less vertex data), redundant sampler calls eliminated, zero-allocation save/restore stacks - Collision β index-based pool access instead of array push/pop in SAT detection
- Container β O(n) accumulator pattern in
getChildByProp/getChildByTypeinstead of O(nΒ²)
Developer Experience
- 74 JSDoc typo and grammar fixes across 32 files
- Coin glow shader example in the platformer demo
- Updated typescript-boilerplate and plugin-template for melonJS 18
- Archived es6-boilerplate with redirect notice
Full Changelog: 18.0.0...18.1.0
v18.0.0
What's New in melonJS 18.0.0
New Features
- Color constructor β now also accepts another Color object as parameter
- Renderer β new
backgroundColorproperty for clearing background between frames - Pool system β new type-safe
createPool()API with improved performance;destroyrenamed torelease
Changed
- Build system β replaced rollup with esbuild (@hornta)
- Documentation β replaced webdoc with typedoc (@hornta)
- Test framework β replaced mocha and puppeteer with vitest in browser mode (@hornta)
- TypeScript β extensive conversion across the codebase: color, math, geometry, platform, DOM, keyboard, timer, application settings, pool, and more (@hornta)
- Monorepo β migrated to pnpm workspaces with turbo (@hornta)
- Renderable β
anchorPointnow uses the lighterObservablePointclass instead ofObservableVector2d - Math β namespace
Mathis now deprecated and renamed tomathfor consistency - Deprecated API removal β all classes and methods deprecated since version 15 and lower have been removed (see Upgrade Guide)
Bug Fixes
- Body β fix
setCollisionType()not accepting numeric values; fixsetVertices()fallback creating Point instead of Polygon - Camera β fix
moveTo()upper bound clamping; fixfocusOn()double-counting position - Container β fix
addChildAt()rejecting valid index; fixgetNextChild()returning wrong child; fixremoveChildNow()crash when not attached to root - Physics β fix collision response velocity projection; fix shapes tunneling through polyline junctions; fix persistence for child bodies during reset (@Vareniel); fix
step()crash with undefined ancestor - Renderable β fix Light2D color blending in Canvas mode (@Vareniel)
- CanvasRenderTarget β fix arguments passed to
convertToBlob()(@hornta) - TypeScript β fix missing
OffscreenCanvastype for TextureAtlas constructor - Video β fix implicit global reference to HTMLVideoElement
- Docs β fix
floatingdefault shown for UI elements (@SergioChan)
Performance
- Collision β pre-built SAT function dispatch lookup table; reduced hot path overhead
- Container β cache camera references outside per-child update loop
- Physics β reduced iteration overhead in
world.step() - QuadTree β reduced array allocations in
retrieve()andinsert() - Observable vectors β rewritten for better performance
- Color β faster
clone()method - Pool β optimized implementation
New Contributors
- @SergioChan made their first contribution
Full Changelog: 17.4.0...18.0.0
v17.4.0
Added
- Renderer: new
lineJoinproperty to set the line join style (only support "round" for now in WebGL mode) - Renderer: add support for line thickness for
strokePolygonandstrokeRectoperations in WebGL
Changed
- Chore: Update to TypeScript 5.5
Fixed
- Renderer: fix
fillEllipse()method in WebGL mode (that was stroking the ellipse instead) - TypeScript: fix most (if not all) missing declarations
v17.3.0
Added
- Renderer: add support for line thickness when using
strokeLine()in WebGL
Changed
- Renderer: the
setLineWidth()method is now deprecated and replaced by alineWidthclass property
Fixed
- Renderer: fix animation when using multi-texture atlas in WebGL mode
- TMX: fix tsx file type import when using a React / Vue build step (thanks @customautosys)
- Typedef: fix missing definition for
video.init()settings parameter, andApplicationconstructor parameter
v17.2.0
Added
- Audio: add missing optional id parameter to 3D / Spatial audio methods
- Core: add platform detection if running as a standalone web app
- Loader: add missing
unloadimplementation for font assets
Fixed
- Loader: properly return an error when attempting to load FontFace assets on non-browser platforms
- Renderer: fix a regression when a global canvas is available (e.g. webapp adapter for wechat)
- Renderer: fix a regression when forcing WebGL1 rendering mode (leading to an exception)
- Renderer: fix a regression when using the canvas rendering mode where antialias setting was not being applied on cached tinted elements
v17.1.0
Added
- Audio: added/exposed 3D Spatial Audio method (
stereo(),position(),orientation()andpanner()) - Loader: image resources can now take an array of
srcurls with different format (preparing for later usage) - Math: added a
isPowerOfFour()method - Renderer: new
renderTargetproperty specifying the defaultCanvasRenderTargetto use when rendering
Changed
- Renderer:
CanvasTextureis now deprecated and replaced by a newCanvasRenderTargetclass
Fixed
- Core: prevent multiple temporary canvas creation when calling
isWebGLSupportedmultiple times