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