๐ Web Game Engines & Libraries
WebGL (opens in a new tab), WebGL2 (opens in a new tab), and WebGPU (opens in a new tab) enable developers to create real-time 2D and 3D graphics in the browser. Writing raw WebGL or WebGPU code is tedious, so there are engines that abstract the complexity and do the heavy-lifting to provide more user-friendly APIs. This page presents the main JavaScript engines available.
Engines and libraries
Much like any ecosystem of developer tools, there are 2 approaches: the monolithic batteries-included framework approach (those would be the engines), or the modular assemble-independent-libraries-together approach. Some of them are installable as typical NPM dependencies, others come in the form of editors that can be downloaded or used in the browser. The main engines and libraries available as packages for JavaScript game development are:
Compare on NPMTrends and Star History (requires a GH token)
About these numbers and colors
And many more engines and libraries (opens in a new tab).
UI library wrappers
You can use any of the previous libraries and engines on their own, but some of them can also be combined with UI libraries wrappers for React, Svelte, Vue, or Angular. This might seem surprising at first, but using these makes your code more declarative and conveniently abstracts some boilerplate. The main wrapper libraries are:
For instance, React Three Fiber (R3F), lets you add objects to a scene and control them as React components:
Downloadable/cloud editors
The following engines are available as downloadable or cloud-based editors and support JavaScript or TypeScript. Make sure to check their licensing and pricing models.
Going native with JavaScript
You also have a few options to write JavaScript code that compiles to native. Expo (opens in a new tab) is a framework for React Native (opens in a new tab), and they created Expo GL (opens in a new tab) and expo-three (opens in a new tab) to provide a Three.js interface for native OpenGL ES. And it can be used declaratively with React Three Fiber (opens in a new tab)! Babylon.js is working on a similar preview feature with Babylon Native (opens in a new tab) and Babylon React Native (opens in a new tab). There is also Cocos Creator (opens in a new tab), a native editor that can compile TypeScript to native.