Likely the best JavaScript 2D game engine as of 2023.Uses Matter.js as a physics engine if enabled. There's also an alternative (in-house?) "arcade" engine: photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.ArcadePhysics.html but it appears to be simpler/less robust (but also possibly faster).
TODO any 2D first person examples a bit like Ciro's 2D reinforcement learning games?
The examples are present under:
but note that that repo is huge, about 4.5 GiB on local disk, as is has tons of assets.
git clone https://github.com/photonstorm/phaser3-examples
The demos also include a Monaco-editor based sandbox mode where you can edit code directly on the web and see the game update which is a really sweet addition.
- phaser/hello.html: a minimal hello world adapted from web.archive.org/web/20230323212804/https://phaser.io/tutorials/getting-started-phaser3/part5. Not an actual game strictly speaking though, just shows the phaser logo bouncing around the screen.Fully contained in a single HTML file, except that it loads the phaser library and image assets from the web.
- phaser/hello-game.html: an actually hello world game where you have to collect stars and avoid bombs.Based on labs.phaser.io/index.html?dir=games/firstgame/&q=:
- finished version: labs.phaser.io/view.html?src=src/games/firstgame/part10.js
- corresponding tutorial: web.archive.org/web/20230323210501/https://phaser.io/tutorials/making-your-first-phaser-3-game/part10.
A web server is mandatory for assets, unless you embed them in data URLs,
file://
access is not possible:To run the demos locally, tested on Ubuntu 22.10:
and this opens up the demos on the browser.
git clone https://github.com/liabru/matter-js
cd matter-js
git checkout 0.19.0
npm install
npm run dev
Hello world adapted from: github.com/liabru/matter-js/wiki/Getting-started/1d138998f05766dc4de0e44ae2e35d03121bb7f2
Also asked at: stackoverflow.com/questions/28079138/how-to-make-minimal-example-of-matter-js-work/76203103#76203103
Renderer questions:
- follow object on viewport: codepen.io/csims314/pen/goZQvG
- draw text: github.com/liabru/matter-js/issues/321
A multi-scenario demo.
Articles by others on the same topic
There are currently no matching articles.