LittleJS is an open HTML5 game engine with 2D and 3D rendering, physics, audio, and input. It has no runtime dependencies and runs in modern browsers via script tag or npm.
Overview
LittleJS is a small JavaScript game engine for browser games. It covers 2D and 3D graphics on one canvas, arcade or Box2D-style physics, particles, sound, tile maps, UI widgets, tweens, and camera helpers, aimed at fast iteration with readable code and many examples.
You can start from a single HTML file and one script, use npm with TypeScript types, or scaffold with Vite for dev reload and tree-shaken release builds. Debug builds include asserts, an overlay, and built-in 2D and 3D level editors; release builds strip that overhead.
The engine targets all modern web browsers and mobile devices. Optional plugins add Box2D, Jolt, Three.js rendering, pathfinding, and a JS13k size-limited branch. An example browser runs editable samples beside live code.
LittleJS is MIT licensed and distributed on npm as littlejsengine as well as downloadable build artifacts.
Key features
- Combined 2D and 3D WebGL rendering
- Particles, audio, and input handling
- Tilemap collision and arcade physics
- Built-in UI, tweens, and scene flow
- npm, ESM, and single-script-tag usage
- In-game 2D and 3D level editors
- TypeScript definitions included
- 100+ examples and starter game projects
Use cases
- Browser arcade and puzzle games
- JS13k and small downloadable web games
- 3D demos with built-in renderer or Three.js plugin
- Teaching game loops with minimal setup
- Mobile-friendly canvas games with touch controls