Skip to content

Releases: melonjs/melonJS

v18.3.0

06 Apr 23:48
2f42bbb

Choose a tag to compare

What's New in melonJS 18.3.0

New Features

  • Bezier curve drawing β€” bezierCurveTo(), quadraticCurveTo(), and arcTo() path methods, matching the Canvas 2D API. WebGL renderer tessellates via Path2D.
  • Gradient fills β€” createLinearGradient() and createRadialGradient() methods for both Canvas and WebGL renderers, usable with all fill methods
  • Dashed lines β€” setLineDash() and getLineDash() for stroke operations on both renderers
  • Tiled object factory registry β€” extensible registerTiledObjectFactory() and registerTiledObjectClass() APIs for plugins to register custom Tiled object handlers without modifying engine code

Changed

  • Application as entry point β€” new Application(width, height, options) auto-calls boot(), making it a standalone entry point. video.init() is deprecated.
  • Game singleton decoupled β€” internal modules no longer import from the barrel index.js; game singleton uses setDefaultGame pattern
  • Stage lifecycle β€” onResetEvent(app, ...args) and onDestroyEvent(app) now receive the Application instance as first parameter
  • Container defaults β€” dimensions default to Infinity (no intrinsic size, no clipping), removing dependency on game.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 Infinity bounds (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/bezierCurveTo startPoint reference bug and adaptive segment count
  • Application β€” fix settings mutation, white flash on load, pool cleanup errors
  • WebGLRenderer β€” fix setBlendMode premultipliedAlpha tracking
  • Text β€” fix multiline textBaseline y offset, power-of-two texture sizes

Performance

  • BitmapText β€” precompute glyphMinTop/glyphMaxBottom once in font parsing; cache measureText results in setText/resize

v18.2.2

29 Mar 13:41
a9147da

Choose a tag to compare

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

29 Mar 13:21
b4d6a68

Choose a tag to compare

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

29 Mar 10:26
37eaf7f

Choose a tag to compare

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 Batcher subclasses with configurable maxVertices, 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, isCollection flag
  • 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.net instead of esm.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 a premultipliedAlpha parameter for correct blending with non-premultiplied textures
  • Renderer β€” add base setBlendMode() and GPURenderer property to fix TypeScript casts
  • Plugin β€” plugin.register() now uses pluginClass.name for 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() throwing TypeError when searching by name with no match
  • Events β€” fix duplicate BLUR entry (was missing FOCUS)
  • UIBaseElement β€” fix isDraggable JSDoc and released default
  • Application β€” fix constructor options not being optional, fix getUriFragment() unsafe cast
  • CanvasRenderer β€” setProjection() now properly applies the projection matrix as a canvas 2D transform

Spine Plugin

  • @melonjs/spine-plugin migrated into the monorepo β€” custom SpineBatcher with two-color tinting, indexed drawing, expanded example with 17 official Spine characters

v18.1.0

23 Mar 04:19
b444554

Choose a tag to compare

What's New in melonJS 18.1.0

New Features

  • ShaderEffect class β€” simplified custom shader API that only requires a fragment apply(color, uv) function. Vertex shader, uniforms, and texture sampling boilerplate are handled automatically. Silently disabled in Canvas mode.
  • create-melonjs CLI β€” scaffold a new game project in seconds with npm 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/onError deprecated in favor of events
  • TMX β€” refactored TMXUtils into reusable decode.ts and xml.ts modules
  • Compositor β†’ Batcher β€” Compositor, QuadCompositor, PrimitiveCompositor renamed to Batcher, 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_NEAREST vs GL_LINEAR) on all bound textures (#1279)
  • createPattern leak β€” clean up previous GPU texture when repeat mode changes (#1278)
  • Custom shader support β€” properly flush and restore default shader per draw call, fix setUniform using wrong GL program, reset sampler uniform on shader switch
  • TMX β€” fix hexagonal pixelToTileCoords mutation, 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, drawVertices vertex count, resize setAntiAlias corruption
  • 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, fillPolygon now generate geometry directly, bypassing path2D and earcut
  • WebGL batching β€” quad rendering uses gl.drawElements with 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/getChildByType instead 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

10 Mar 07:46

Choose a tag to compare

What's New in melonJS 18.0.0

New Features

  • Color constructor β€” now also accepts another Color object as parameter
  • Renderer β€” new backgroundColor property for clearing background between frames
  • Pool system β€” new type-safe createPool() API with improved performance; destroy renamed to release

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 β€” anchorPoint now uses the lighter ObservablePoint class instead of ObservableVector2d
  • Math β€” namespace Math is now deprecated and renamed to math for 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; fix setVertices() fallback creating Point instead of Polygon
  • Camera β€” fix moveTo() upper bound clamping; fix focusOn() double-counting position
  • Container β€” fix addChildAt() rejecting valid index; fix getNextChild() returning wrong child; fix removeChildNow() 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 OffscreenCanvas type for TextureAtlas constructor
  • Video β€” fix implicit global reference to HTMLVideoElement
  • Docs β€” fix floating default 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() and insert()
  • Observable vectors β€” rewritten for better performance
  • Color β€” faster clone() method
  • Pool β€” optimized implementation

New Contributors

Full Changelog: 17.4.0...18.0.0

v17.4.0

22 Jun 00:57

Choose a tag to compare

Added

  • Renderer: new lineJoin property to set the line join style (only support "round" for now in WebGL mode)
  • Renderer: add support for line thickness for strokePolygon and strokeRect operations 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

04 Jun 08:11

Choose a tag to compare

Added

  • Renderer: add support for line thickness when using strokeLine() in WebGL

Changed

  • Renderer: the setLineWidth() method is now deprecated and replaced by a lineWidth class 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, and Application constructor parameter

v17.2.0

21 Apr 23:45

Choose a tag to compare

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 unload implementation 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

29 Mar 00:15

Choose a tag to compare

Added

  • Audio: added/exposed 3D Spatial Audio method (stereo(), position(), orientation() and panner())
  • Loader: image resources can now take an array of src urls with different format (preparing for later usage)
  • Math: added a isPowerOfFour() method
  • Renderer: new renderTarget property specifying the default CanvasRenderTarget to use when rendering

Changed

  • Renderer: CanvasTexture is now deprecated and replaced by a new CanvasRenderTarget class

Fixed

  • Core: prevent multiple temporary canvas creation when calling isWebGLSupported multiple times