littlejsengine 1.19.3 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/FAQ.md +841 -820
  2. package/README.md +29 -25
  3. package/dist/littlejs.d.ts +2455 -935
  4. package/dist/littlejs.esm.js +30344 -21110
  5. package/dist/littlejs.esm.min.js +4 -3
  6. package/dist/littlejs.js +30259 -21052
  7. package/dist/littlejs.min.js +2 -2
  8. package/dist/littlejs.release.js +26567 -20455
  9. package/package.json +10 -5
  10. package/plugins/audioEffects.js +28 -24
  11. package/plugins/box2d.js +2516 -2073
  12. package/plugins/drawUtilities.js +206 -31
  13. package/plugins/gltf.js +740 -0
  14. package/plugins/jsconfig.json +19 -0
  15. package/plugins/lightSystem.js +719 -332
  16. package/plugins/math3d.js +58 -17
  17. package/plugins/medalSystem.js +326 -280
  18. package/plugins/newgrounds.js +400 -199
  19. package/plugins/pathFinder.js +208 -175
  20. package/plugins/pluginExport.js +15 -0
  21. package/plugins/postProcess.js +56 -13
  22. package/plugins/render3d.js +1643 -1577
  23. package/plugins/render3dDebug.js +109 -0
  24. package/plugins/render3dExtras.js +1754 -0
  25. package/plugins/render3dVoxels.js +502 -0
  26. package/plugins/textureSheet.js +496 -458
  27. package/plugins/threejs.js +183 -163
  28. package/plugins/tweakables.js +411 -0
  29. package/plugins/tweenSystem.js +263 -145
  30. package/plugins/uiSystem.js +2024 -1687
  31. package/plugins/zzfxm.js +159 -159
  32. package/src/engine.js +191 -75
  33. package/src/engineAudio.js +229 -125
  34. package/src/engineBuild.mjs +289 -256
  35. package/src/engineDebug.js +912 -742
  36. package/src/engineDraw.js +295 -193
  37. package/src/engineEditor.js +2431 -0
  38. package/src/engineExport.js +12 -0
  39. package/src/engineInput.js +1462 -1293
  40. package/src/engineMath.js +1274 -1252
  41. package/src/engineObject.js +194 -80
  42. package/src/engineParticles.js +583 -532
  43. package/src/engineRelease.js +67 -45
  44. package/src/engineSettings.js +77 -29
  45. package/src/engineTileLayer.js +995 -741
  46. package/src/engineUtilities.js +19 -13
  47. package/src/engineWebGL.js +239 -82
  48. package/src/jsconfig.json +17 -13
  49. package/plugins/box2d.wasm.js +0 -630
  50. package/plugins/box2d.wasm.wasm +0 -0
package/README.md CHANGED
@@ -16,14 +16,12 @@
16
16
  ## 🚂 All Aboard!
17
17
 
18
18
  LittleJS is a fast, lightweight, and fully open source HTML5 game engine designed for simplicity and performance.
19
- Its small footprint is packed with a comprehensive feature set including rendering, physics, particles, sound, and input handling.
19
+ Its small footprint is packed with a comprehensive feature set including 2D and 3D rendering, physics, particles, sound, and input handling.
20
20
  The code is very clean and well documented with many examples to get you started quickly.
21
21
 
22
22
  ### 🚀 [Join the LittleJS Game Jam](https://itch.io/jam/littlejs-jam)
23
23
 
24
- *The Third Annual LittleJS Game Jam will take place From Oct 2 to Nov 2! Unleash your creativity and develop amazing games using the LittleJS game engine.*
25
-
26
- ### 😼👍 [LittleJS + JS13k](https://github.com/KilledByAPixel/LittleJS/tree/js13k) - We made a special branch designed for size coding events like JS13k.
24
+ *The Third Annual LittleJS Game Jam will take place from Oct 2 to Nov 2! Unleash your creativity and develop amazing games using the LittleJS game engine.*
27
25
 
28
26
  <div align='center' markdown='1'>
29
27
 
@@ -31,7 +29,9 @@ The code is very clean and well documented with many examples to get you started
31
29
 
32
30
  </div>
33
31
 
34
- ![LittleJS Screenshot](examples/screenshot.jpg)
32
+ ![LittleJS Screenshot1](examples/screenshot.jpg)
33
+
34
+ ![LittleJS Screenshot2](examples/screenshot2.jpg)
35
35
 
36
36
  ## LittleJS Features
37
37
 
@@ -39,27 +39,27 @@ The code is very clean and well documented with many examples to get you started
39
39
 
40
40
  - Blazing fast WebGL2 + Canvas2D hybrid rendering system
41
41
  - Apply [Shadertoy](https://www.shadertoy.com) style shaders for post-processing effects, or on any object or draw
42
+ - 2D lights with soft shadows, tinted glass and emissive objects
42
43
  - Robust particle effect system and [effect design tool](https://killedbyapixel.github.io/LittleJS/examples/particles/)
43
44
  - Load sprites and animations into texture sheets at runtime, or import [TexturePacker](https://www.codeandweb.com/texturepacker) and [Aseprite](https://www.aseprite.org) atlases
44
45
 
45
46
  ### 🧊 LittleJS 3D
46
47
 
47
- - Built-in 3D renderer with no dependencies that adds about 21kb gzipped, drawing into the same WebGL canvas as the 2D scene, so 3D can sit behind your sprites, in front of them, or both
48
- - `EngineObject3D` is an `EngineObject` with a mesh, so update, collision, children, timers and sound all work the way they do in 2D
49
- - Build shapes in code with box, sphere, plane, cylinder, cone, capsule, torus, lathe and loft builders, give any sprite thickness to make a block model, or load an OBJ file
50
- - Sunlight with real shadow maps, where cut-out art like a leafy tree casts its true outline, plus ambient light, up to 8 colored point or directional lights, specular highlights, emissive glow and distance fog
51
- - Height map terrain from an array or an image, with height, normal and raycast lookups for driving and walking on it
52
- - Instanced drawing puts thousands of copies of a mesh into one draw call
53
- - 3D particles, trails, ribbons, billboards and text extruded from the engine font
54
- - Orbit, chase and first person cameras, perspective or orthographic, with mouse picking and 3D positional sound
55
- - Any object can carry its own shader, in 2D or 3D, and post-processing shaders reach the 3D scene too, including a built-in bloom for glowing lights
56
- - The [Three.js](https://threejs.org) plugin is still fully supported as an alternative, rendering a Three.js scene behind the LittleJS canvas with `ThreeJSObject` letting LittleJS physics drive its meshes
48
+ - Built-in 3D renderer that shares the canvas with your 2D game
49
+ - 3D objects with the same physics, children and timers as 2D
50
+ - Shape builders, extruded sprites and text, and OBJ and glTF model loading
51
+ - Height map terrain with collision and raycasts
52
+ - Shadow maps, colored lights, specular, emissive glow and fog
53
+ - Particles, trails, billboards and instanced drawing
54
+ - Orbit, chase and first person cameras with mouse picking
55
+ - Custom shaders on any object
56
+ - Optional [Three.js](https://threejs.org) plugin as an alternative renderer
57
57
 
58
58
  ### 🔊 Audio
59
59
 
60
60
  - Sound and music with mp3, ogg, or wave files
61
61
  - Use [ZzFX](https://killedbyapixel.github.io/ZzFX/) sound generator to play sounds without asset files
62
- - Spatial audio stereo panning
62
+ - Spatial audio with stereo panning
63
63
  - Audio effects plugin with filter, reverb, delay, distortion and compressor
64
64
 
65
65
  ### 🎮 Input
@@ -86,6 +86,8 @@ The code is very clean and well documented with many examples to get you started
86
86
 
87
87
  - Live example browser with code editor
88
88
  - Import level editor data from [Tiled](https://github.com/mapeditor/tiled) or other JSON
89
+ - UI system with buttons, sliders, text input and nine-slice skins
90
+ - Tween system with easing curves
89
91
  - Debug overlay and primitive rendering system
90
92
  - Medal tracking system with [Newgrounds](https://www.newgrounds.com/) support
91
93
  - Node.js build system
@@ -113,11 +115,11 @@ npm install
113
115
  npm run dev
114
116
  ```
115
117
 
116
- Here is a minimal Hello World example game.
118
+ Here is a minimal Hello World example game, with the script path pointing at the engine file from the download or npm package.
117
119
 
118
120
  ```html
119
121
  <!DOCTYPE html>
120
- <script src="../dist/littlejs.js"></script>
122
+ <script src="node_modules/littlejsengine/dist/littlejs.js"></script>
121
123
  <script>
122
124
  function gameInit() {}
123
125
  function gameUpdate() {}
@@ -130,12 +132,12 @@ engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost);
130
132
 
131
133
  ## Tutorials
132
134
 
133
- - [Making Awesome Games With LittleJS](https://youtu.be/_dXKU0WgAj8?si=ZDXLYAFDWp54hrGT) - A short talk about LittleJS with some tips on how to use it.
135
+ - [Making Awesome Games With LittleJS](https://youtu.be/_dXKU0WgAj8) - A short talk about LittleJS with some tips on how to use it
134
136
  - [Tutorial: Breakout](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial) - Learn how to make a simple game from scratch
135
- - [Tutorial: Make a ski game](https://eoinmcgrath.com/little-ski/tutorial.html) - This tutorial by eoinmcg that shows how to make a pixel art style game.
136
- - [LittleJS Quick Reference Sheet](https://github.com/KilledByAPixel/LittleJS/blob/main/REFERENCE.md) - A reference sheet to help you get started.
137
- - [Little JS FAQ](https://github.com/KilledByAPixel/LittleJS/blob/main/FAQ.md) - Answers to common questions about LittleJS.
138
- - [JS13k Branch](https://github.com/KilledByAPixel/LittleJS/tree/js13k) - For size coding events like JS13k there is a special branch that builds to a 7KB zip.
137
+ - [Tutorial: Make a ski game](https://eoinmcgrath.com/little-ski/tutorial.html) - A tutorial by eoinmcg that shows how to make a pixel art style game
138
+ - [LittleJS Quick Reference Sheet](https://github.com/KilledByAPixel/LittleJS/blob/main/REFERENCE.md) - A reference sheet to help you get started
139
+ - [LittleJS FAQ](https://github.com/KilledByAPixel/LittleJS/blob/main/FAQ.md) - Answers to common questions about LittleJS
140
+ - [JS13k Branch](https://github.com/KilledByAPixel/LittleJS/tree/js13k) - A special branch for size coding events that builds to a 7KB zip
139
141
 
140
142
  ## Examples
141
143
 
@@ -143,7 +145,7 @@ LittleJS comes with several demos both for learning and using as starter project
143
145
 
144
146
  - [Example Browser](https://killedbyapixel.github.io/LittleJS/examples/) - Live example browser with all examples and editable source
145
147
  - [LittleJS Arcade](https://killedbyapixel.github.io/LittleJSArcade/) - Over 50 example games you can use as starter projects
146
- - [Short Examples](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/shorts) - 60+ single-file demos showing off individual engine features
148
+ - [Short Examples](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/shorts) - 80+ single-file demos showing off individual engine features
147
149
  - [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout/) - Block breaking game with post-processing effects
148
150
  - [Puzzle Game](https://killedbyapixel.github.io/LittleJS/examples/puzzle/) - Match 3 puzzle game with HD rendering and high score tracking
149
151
  - [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer/) - Platformer/shooter demo that loads level data
@@ -164,6 +166,8 @@ LittleJS comes with several demos both for learning and using as starter project
164
166
  | [littlejs.esm.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.esm.js) | Debug | ESM | Debug mode with asserts |
165
167
  | [littlejs.esm.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.esm.min.js) | Release | ESM | Optimized for release and minified |
166
168
 
169
+ Every build includes the plugins. littlejs.min.js is about 100 KB gzipped: the core engine is about 36 KB of that and the 3D plugins about 40 KB. A bundler like Vite leaves out the plugins a game does not use, so a small 2D game comes to about 26 KB gzipped, and a lit 3D scene to about 47 KB.
170
+
167
171
  ## Games Made With LittleJS
168
172
 
169
173
  Here are a few of the many amazing games created with LittleJS...
@@ -182,7 +186,7 @@ Here are a few of the many amazing games created with LittleJS...
182
186
  - [Isletopia](https://store.steampowered.com/app/1861260/Isletopia) - Relaxing strategy game of greenifying barren islands. by [Gamex Studio](https://x.com/gamesgamex)
183
187
  - [Tetrimals](https://nixn.itch.io/tetrimals) - A puzzle game mixing Tetris with animals. by [nixn](https://nixn.itch.io/)
184
188
  - [Bug&Bee](https://itch.io/jam/littlejs-game-jam-2025/results) - Low fi shoot em up with co-op gameplay. LittleJS Jam 1st place! by [eoinmcg](https://eoinmcg.itch.io/)
185
- - [Little Platformer](https://psemo.itch.io/little-platformer) - Platformer with many mechanics. LittleJS Jam 2st place! by [PSEMO](https://psemo.itch.io/), [Solita666](https://itch.io/profile/solita666), [GabrielRG](https://gabrielrg.itch.io/), [Nate](https://natesassoon.itch.io/)
189
+ - [Little Platformer](https://psemo.itch.io/little-platformer) - Platformer with many mechanics. LittleJS Jam 2nd place! by [PSEMO](https://psemo.itch.io/), [Solita666](https://itch.io/profile/solita666), [GabrielRG](https://gabrielrg.itch.io/), [Nate](https://natesassoon.itch.io/)
186
190
  - [Alien Escape Pinball](https://focaccai.itch.io/alien-pinball) - Pinball game with physics and aliens. by [Focaccai](https://www.focaccai.com/)
187
191
  - [LittleJS Jam 2024 Results](https://itch.io/jam/littlejs-jam-2024/results) - All the games from the first LittleJS Game Jam.
188
192
  - [LittleJS Jam 2025 Results](https://itch.io/jam/littlejs-game-jam-2025/results) - All the games from the second LittleJS Game Jam.