Skip to content
Olivier Biot edited this page Nov 26, 2026 · 135 revisions

Welcome to the melonJS wiki — your guide to building 2D and 3D games with melonJS.


Getting Started

New to melonJS? Start here:

npm create melonjs my-game
cd my-game
npm install
npm run dev

Core Concepts


Rendering

  • Rendering API — full API reference with Canvas 2D comparison, gradients, dashed lines, bezier curves, and more
  • Shader Effects — built-in post-processing effects on both GPU backends (glow, shine, blur, …), writing your own (GLSL and/or WGSL bodies), screen-reading effects (screen_texture / screen_uv / noise_uv), custom mesh shaders, and preloading shaders as assets
  • API Documentation — auto-generated API docs

Working in 3D

  • Working in 3D — general concepts: Camera3d opt-in, conventions (Y-down + +Z forward), Mesh / OBJ rendering (retained on both GPU backends), lighting (Light3d — directional/ambient/point/spot), sprites + depth, and frame-rate-independent smoothing (math.damp). Worked example: AfterBurner showcase.
  • Loading & supported 3D assets — the asset pipeline (OBJ/MTL), and what's supported vs. not across geometry, materials/textures, animation, and lighting.
  • Loading glTF / GLB scenes — import a whole Blender-authored scene (node graph, meshes, camera, lights, node animation) and place each node as a Mesh.
  • 3D spatial queries — Sphere, world.adapter.querySphere, raycast3d, and bulk frustum culling (Camera3d.queryVisible).
  • 2.5D games (Paper Mario-style) — perspective camera for depth, gameplay on a flat Z plane.

Physics & Collision

  • Adding a Physics Body — body, shapes, velocity, friction, and collision types
  • Collision Shapes — Rect, Ellipse, Polygon, Line, and RoundRect
  • Defining Collision Shapes in Tiled — drawing collision layers in the Tiled map editor
  • Migrating to the Physics Adapter API — moving from the legacy new me.Body(this, shape) pattern to the 19.5 declarative bodyDef + body method API (all on the built-in adapter)
  • Switching Physics Adapters — the matter, planck and Rapier adapters, switching while the game runs (world.setAdapter()), expected differences, porting checklist, recipes
  • BuiltinAdapter Quirks — SAT-specific behaviors that don't carry to other engines — patterns to avoid baking into code that might switch adapters later

Level Editors

  • Tiled Map Editor — orthogonal, isometric, staggered and hexagonal maps, loaded as "tmx" assets
  • Defining Collision Shapes in Tiled — collision layers and shape types
  • LDtk — levels loaded from the .ldtk project file as the editor saves it, as an "ldtk" asset (melonJS 20.18 and later)
  • Sprite Fusion — maps loaded from the exported map.json or map.tmx, as a "spritefusion" asset (melonJS 20.18 and later)
  • melonJS Particle Studio — visual particle editor
  • Blender and other glTF authoring tools (Maya, 3ds Max, Cinema 4D…) — a whole 3D scene exported as .glb or .gltf (meshes, materials, cameras, lights, animation), loaded with level.load like a Tiled map: see Loading glTF / GLB scenes

Third-Party Tools


Platforms


Community & Resources


Tutorials


Learning JavaScript

Clone this wiki locally