Download Latest Version v18.2.2 source code.tar.gz (26.0 MB)
Email in envelope

Get an email when there's a new version of melonJS

Home / 18.1.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-03-23 3.4 kB
v18.1.0 source code.tar.gz 2026-03-23 20.7 MB
v18.1.0 source code.zip 2026-03-23 21.1 MB
Totals: 3 Items   41.7 MB 0

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 → BatcherCompositor, 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 renderingfillRect, 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: https://github.com/melonjs/melonJS/compare/18.0.0...18.1.0

Source: README.md, updated 2026-03-23