LittleJS is a fast, lightweight, and fully open source HTML5 game engine designed for simplicity and performance. Its small footprint is packed with a comprehensive feature set including hybrid rendering, physics, particles, sound, and input handling. The code is clean and well documented with some fun examples to get you started right away. Choo-Choo!
The Second Annual LittleJS Game Jam is currently in progress, running from Oct 3 to Nov 3! Unleash your creativity and develop amazing games using the LittleJS game engine. ๐น๏ธ๐ฎ Sign up today and get more info about the jam on itch.io!
LittleJS is a small but powerful game engine with many features and no dependencies.
- Super fast WebGL2 + Canvas2D hybrid rendering system
- 100,000+ sprites at solid 60fps
- Apply Shadertoy style shaders for post-processing effects
- Robust particle effect system and effect design tool
- Falls back to Canvas2D if WebGL can't be created or is lost
- Positional sound effects with distance falloff
- Use ZzFX sound effect generator to play sounds without asset files
- Music and sound with mp3, ogg, wave, or ZzFXM
- Comprehensive input handling for keyboard, mouse, gamepad, and touch
- Automatic touch pad mouse emulation
- On screen touch gamepad designed for mobile devices
- Robust arcade physics system with collision handling
- Full Box2D integration for more realistic physics
- Tilemap collision with raycasting
- Compatible with all modern web browsers and on mobile devices
- Support for TypeScript and Modules with example projects for both
- Ideal for size coding competitions like Js13kGames
- Open Source and MIT licensed
- Live example browser with code editor
- Debug primitive rendering system
- Screenshot and video capture tools
- Node.js build system
- Bitmap font rendering and built in engine font
- Optimized for AI-assisted development
- Medal tracking system with Newgrounds support
To get started download the latest LittleJS package from GitHub or install via npm: npm install littlejsengine
You need to run a local web server to run LittleJS games during development! You may see a console error like 'The image element contains cross-origin data.' Don't panic, it's easy to fix! If you are using Visual Studio Code there is a Live Preview Extension that will handle this for you automatically. Another option is to setup a simple local web server like http-server via npm.
- Watch this GitNation talk to hear more about LittleJS works and get some tips on how to use it.
- Learn how to make a simple game from scratch with The Breakout Tutorial.
- Make a ski game with LittleJS - Check out this tutorial by eoinmcg that shows how to make a pixel art style game.
- LittleJS Engine Quick Reference Sheet - This cheat sheet can help you get started.
- Check out The Little JS FAQ for more help getting started.
- Join our vibrant community on Discord to get help, share your projects, and collaborate with others!
- For Js13k there is a separate branch that builds to a 7KB zip
These demos are for both learning and using as starter projects to create your own games.
- Starter Project - Clean example with only a few things to get you started
- Breakout - Block breaking game with post-processing effects
- Puzzle Game - Match 3 puzzle game with HD rendering and high score tracking
- Platformer - Platformer/shooter with level data from Tiled Editor
- Box2D Demo - Box2D plugin demonstration and testbed
- Stress Test - Max sprite/object test and music system demo
- Particle System Designer - Particle system editor and visualizer
- Example Browser - Live example browser with all examples
File | Mode | Module | Use case |
---|---|---|---|
littlejs.js | Debug | No | Full engine with debug functions and asserts |
littlejs.release.js | Release | No | Full engine optimized for release |
littlejs.min.js | Release | No | Full engine optimized for release and minified |
littlejs.esm.js | Debug | ESM | Full engine with debug functions and asserts |
littlejs.esm.min.js | Release | ESM | Full engine optimized for release and minified |
To rebuild the engine first run npm install
to setup the necessary npm dependencies. Then call npm run build
to build the engine.
The starter example project includes a node js file build.js that compresses everything into a tiny zip file using Google Closure, UglifyJS, and ECT Zip.
Here are a few of the many amazing games created with LittleJS...
- Space Huggers - Roguelike platformer shoot-em-up game with procedural levels. by KilledByAPixel
- Black Cat Squadron - One button shooter based on a WW2 Navy squadron. JS13k 5th place! by repsej
- L1ttl3 Paws - Cat glider with procedural art and levels for JS13K! by KilledByAPixel
- KleptoKitty - Cat themed heist puzzle. JS13K 22nd place. by eoinmcg
- The Way of the Dodo - Single button platformer. JS13k 5th place! by repsej
- Undergrowth - An interactive music videogame for the band Squid. by KilledByAPixel
- 204Snake! - A puzzle game that combines 2048 with snake. LittleJS Jam 1st place! by Sodoj and Shai-P
- GATOR - Retro platformer shooter game where you rescue animals. LittleJS Jam 2nd place! by eoinmcg
- A Hedgehog's Search - Adventure game starring a hedgehog. LittleJS Jam 3rd place! by willsm1111
- Wendol Village - Warcraft inspired RTS game. by sanojian
- Dead Again - Top down survival horror. by sanojian & repsej
- Isletopia - Relaxing strategy game of greenifying barren islands. by Gamex Studio
- Tetrimals - A puzzle game mixing Tetris with animals. by nixn
- Watch the Pups - The aim of the game is to take care of some puppies. by masa
- LittleJS Game Jam Results - Check out all the games from the first LittleJS Game Jam!