
A modern & lightweight HTML5 game engine
melonJS is an open-source 2.5D game engine for indie developers — perspective and orthogonal cameras, GPU-accelerated tilemap rendering, 3D mesh support, Light2d, and polygon-accurate physics. Runs on WebGL or Canvas2D, tree-shakeable, and ~150 KB minzipped of vanilla JS/TS.
Fast
Modern ES6 architecture. WebGL renderer with Canvas fallback. Web Audio with 3D spatial sound.
Free
Released under the permissive MIT License. No cost. Forever.
Standalone
Zero dependencies. Compatible with all major browsers and mobile devices. ~150 KB minzipped — tree-shakeable, so you only pay for what you use.
Why melonJS?
melonJS is designed so you can focus on making games, not on graphics plumbing.
Canvas2D-Inspired API
If you've used the HTML5 Canvas, you already know melonJS. The rendering API
(save, restore, translate, rotate, setColor, fillRect, ...)
follows the same familiar patterns — no render graphs, no shader pipelines, no instruction sets to learn.
True Renderer Abstraction
Write your game once, run it on WebGL or Canvas2D with zero code changes. The engine handles all GPU complexity behind a unified API, with automatic fallback when WebGL is not available. Designed to support future backends (WebGPU) without touching game code.
Complete Engine, Minimal Footprint
Physics, tilemaps, audio, input, cameras, tweens, particles, UI — a full game stack in a single tree-shakeable ES module. No dependency sprawl, no library stitching.
Tiled as a First-Class Citizen
Deep Tiled integration built into the core: orthogonal, isometric, hexagonal and staggered maps, animated tilesets, collision shapes, object properties, compressed formats — all parsed and rendered natively.
Batteries Included
Get started in minutes with minimal setup. Sprites, animations, 3D mesh rendering, built-in & custom shaders, spatial audio and particle effects — ready to use out of the box.
Hackable by Design
ES6 classes throughout, a plugin system for engine extensions, and a clean architecture that's easy to extend without fighting the framework. Go as deep as you need.
Powerful Level Design
Design your levels visually with the Tiled map editor. melonJS natively supports orthogonal, isometric, and hexagonal maps with multiple layers, parallax scrolling, and more.
Try it Live
Jump right into a melonJS game — playable in your browser.
Get Started in Seconds
Scaffold a new project with a single command:
npm create melonjs@latest my-game
cd my-game
npm install
npm run dev Or use the API directly for a quick Hello World:
import { Application, Text } from "melonjs";
// create a new melonJS application
const app = new Application(1218, 562, {
parent: "screen",
scale: "auto",
});
// add a text display object
app.world.addChild(new Text(609, 281, {
font: "Arial",
size: 160,
fillStyle: "#FFFFFF",
textBaseline: "middle",
textAlign: "center",
text: "Hello World !",
})); Features
- Fast WebGL & Canvas rendering across desktop and mobile, with automatic fallback
- GPU-accelerated tile rendering for orthogonal Tiled maps under WebGL 2 — one quad per layer, no per-tile loop
- Optional perspective camera (
Camera3d) with frustum culling for 2.5D / projected scenes - 3D mesh rendering with OBJ/MTL loading, multi-material support, and hardware depth testing
Light2das a first-class renderable — multi-light, radial-gradient falloff, illumination-only mode, normal-map sprite shading- Per-camera post-processing with stackable shader effects (Flash, Outline, Glow, CRT, Hologram, ColorMatrix) and custom
ShaderEffectper-sprite fragment effects - Physics: polygon SAT collision, QuadTree/Octree broad-phase (auto-swapped 2D↔3D), 2D & 3D raycasts, plus pluggable adapters (Matter / Planck)
- Full Tiled map editor integration — every feature supported (any map format, animated tilesets, custom properties, parallax layers, native
.asepritetilesets) - Web Audio with 3D spatial sound, stereo panning, and procedural audio primitives (oscillators, noise) for SFX without sample assets
- Multi-input: mouse, touch, keyboard, gamepad & accelerometer
- UI toolkit with drag-and-drop, hover/press buttons, and bitmap-font text
- Tweens, transitions & particle effects
- Spine 4.3 runtime integration via the official plugin
- State manager, asset loader & plugin system
- ~150 KB minzipped — tree-shakeable, zero dependencies
Compatibility
Compatible with all major browsers and mobile devices
| Browser | Version | Status |
|---|---|---|
| Chrome / Edge | 80+ | ✓ |
| Firefox | 80+ | ✓ |
| Safari | 14+ | ✓ |
| Opera | 67+ | ✓ |
| Chrome Mobile | 80+ | ✓ |
| iOS Safari | 14+ | ✓ |