Loading repository data…
Loading repository data…
melonjs / repository
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 WebGL or Canvas2D with automatic fallback, tree-shakeable so you only pay for what you use, and the entire engine fits in ~150 KB minzipped of vanilla JS/TS with no toolchain lock-in. Built with ES6 classes 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 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.
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 under WebGL 2 — 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: ES6 classes throughout, 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
Noise (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 — ~30% faster mesh rendering with near-zero per-frame allocation (a re-drawn static mesh produces no GC garbage)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 + ambient lights, added to the world like Light2d (half-Lambert diffuse + ambient fill, runtime-manipulable for day/night), auto-loaded from a glTF scene's authored sunpostEffects, plus custom shader support via ShaderEffect for per-sprite fragment effects (WebGL)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 map
Camera3dAssets
.aseprite / .ase binary, audio, video, binary and fontsCore
Application class as the modern entry point with built-in pause, resume, and freeze() (hit-stop) primitivesParticleEmitter (emission rate, lifetime, velocity, gravity, blend modes)setCurrentAnimationplaypausestopSprite.glb and .gltf files, with embedded or external buffers & textures