a modern & lightweight HTML5 game engine
melonJS is an open-source 2.5D game engine designed for indie developers — perspective and orthogonal cameras, GPU-accelerated tilemap rendering, post-processing effects, custom shaders, 3D mesh support, polygon-accurate physics, modern Tiled workflows, and high performance. Runs on WebGPU, WebGL 2 or Canvas2D with automatic fallback. The whole engine is ~250 KB minzipped of vanilla JS/TS, with no dependencies and no toolchain lock-in. Built with modern class syntax and bundled with esbuild.
melonJS is licensed under the MIT License and actively maintained by the team at AltByte in Singapore.
melonJS is designed so you can focus on making games, not on graphics plumbing.
Canvas2D-inspired rendering 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 WebGPU, WebGL 2 or Canvas2D with zero code changes. The engine handles all GPU complexity behind a unified API: the default AUTO mode tries WebGPU first at startup, falls back to WebGL 2 if that is unavailable, and ultimately to Canvas, and the entire feature set renders identically on both GPU backends.
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.
Scenes, loaded in one call — level.load(name) brings an authored scene straight into your world. Tiled is a first-class citizen for 2D — orthogonal, isometric, hexagonal & staggered maps, animated tilesets, collision shapes, object properties, compressed formats, with GPU-accelerated tile rendering on the GPU backends — and glTF / GLB is the equivalent for 3D scenes: author in Blender (or any DCC tool), export a .glb, and the whole scene — meshes, materials, cameras, lights, and node animation — loads under a Camera3d, no per-mesh wiring. Animated models play back through the same animation API as a 2D Sprite.
Batteries included, hackable by design — Get started in minutes with minimal setup. When you need to go deeper: modern class-based architecture, a plugin system for engine extensions, and a clean architecture that's easy to extend without fighting the framework.
melonJS is a fully featured game engine :
Compatibility
Graphics
AUTOantiAlias: true) on both GPU backends — and it survives post-processing, since the offscreen targets a post-effect chain renders into are multisampled to matchNoise (simplex/perlin/value/cellular, fBm / ridged / ping-pong fractal, domain warp; renderer-free and CPU-samplable for heightmaps, terrain, and spawn jitter) and NoiseTexture2d — bake a noise field into a sprite image, a Gradient color ramp, or a live-animated tangent-space normal map for lit water and surfaces; unified under a new Texture2d base alongside TextureAtlasCamera3d — retained-mode geometry, uploaded to the GPU once and re-drawn from there, so moving, rotating, scaling or re-tinting a mesh costs no vertex upload and no per-vertex CPU work at alltextureFilter: "nearest" for crisp pixel-art models)Light2d as a first-class Renderable (multiple dynamic lights, radial-gradient falloff, illumination-only mode, procedural rendering via drawLight), plus optional per-pixel normal-map shading on sprites for 3D-looking dynamic lightsLight3d directional, point, spot and ambient lights, added to the world like Light2d (half-Lambert diffuse + ambient fill, quadratic falloff and cone angles on the punctual types, runtime-manipulable for day/night), auto-loaded from a glTF scene's authored suns and lampsInstancedMesh scatter regardless of instance count. Controllable per object, per glTF scene (level.load(name, { castGroundShadow })) or application-wide. Deliberately not shadow mapping: it answers "where is this standing", which is what a 2.5D scene needsaddPostEffect(), plus custom shader support on both GPU backends: ShaderEffect for per-sprite fragment effects (GLSL and/or WGSL bodies) and complete custom mesh shader programs via mesh.shader (a dual-language GLShader: GLSL pair and/or WGSL module)Sound
AudioContext / master-gain accessors for custom WebAudio graphs that mix with the engine's master volume / mutePhysics
raycast3d)RenderablePhysicsAdapter interface for custom physics via official adaptersInput
Camera
Camera3d) with frustum culling for 2.5D / 3D-projected scenes — drop-in subclass of the default 2D cameraUI
UIBaseElement / UISpriteElement containers for clickable, hoverable and holdable elements with full pointer-event wiringDraggable / DropTarget for drag-and-drop with configurable overlap or contains-checkUITextButton text button with hover, press, and key-bind support — built on BitmapTextScenes
level.load(name) — 2D Tiled maps and 3D glTF scenes alike, auto-registered on preload.aseprite / .ase tileset images (Tiled 1.11+ qaseprite plugin workflow), with frame tags auto-mapped to per-tile animations — no PNG export step requiredlevel.load(...), the same one call as a Tiled mapCamera3dgetChildByName("Sun") finds it for runtime tuningsetCurrentAnimation / play / pause / stop API as a 2D Sprite.glb and .gltf files, with embedded or external buffers & texturesPool: retire the legacy name-keyed object pool from engine internals
Loader: named asset bundles, so a level's assets can be loaded and freed as one unit
Container: opt-in texture caching for a static subtree, so it costs one quad instead of N draws
Ground shadows: shape and placement controls (scale, offset, light direction)
Add textured ribbon mode to Trail renderable
Trail: 3D points, so a ribbon can recede under a Camera3d
Per-sprite multi-pass effects use canvas-relative UVs instead of sprite-local UVs
Per-glyph effect hook for BitmapText (batched vertex offset + tint)
Tree-shaking: importing a single symbol costs 184 kB gzip
Types: reconcile the 2D/3D position vector split across Renderable and the shape chain