Web Game Engines and Libraries
webgamedev.com
webgamedev.com
Other than that I really like that I can piggyback on the browser's devtools and that I can use the DOM for the UI.
A big difference between a classic powder toy game like in the article and Noita is that Noita needs to run a much larger simulation that extends beyond the visible canvas. So while multithreading is probably not needed in the former it's most likely needed when the game is a scrolling platformer. I posted a GDC talk by the Noita devs as a reply to a sibling comment if you're interested in their tech.
The WebGL support can be an issue on some machines, but when it does work... things like procedural fog/pseudo-procedural-water/dynamic-texture-updates look fairly good even on low-end gpus. Also, the free Blender addon can quickly export basic animated mesh formats that will save a lot of fiddling with assets later, and the base library supports asset loading etc.
Like all js solutions your top 3 problems will be:
1. Audio and media syncing (don't even try to live-render something like a face mocap)
2. Interface hardware access (grabbing keyboard/mouse/gamepads is sketchy)
3. Game cheats (you can't trust the clients world constraints are true)
4. web browser ram/cpu overhead
The main downside of using __any__ popular game-engine is asset extraction is a popular hobby for some folks (only consoles sort of mitigate this issue).
Best of luck, =3
If you haven't played Noita it's basically a "falling sand" or powder physics game where every pixel is simulated. You need a special cellular automata that is not your typical game physics engine, so I don't think Babylon.js would be a good choice but I may be wrong.
I've modeled my architecture after this fantastic GDC talk by the Noita devs: https://www.youtube.com/watch?v=prXuyMCgbTc ("Exploring the Tech and Design of Noita")
https://www.youtube.com/watch?v=rSKMYc1CQHE
It should port over if you are not hitting super fine granularity, and the collision model for the sprites is simplified.
Some of the Babylon.js fluid examples still need a bug report:
https://doc.babylonjs.com/features/featuresDeepDive/particle...
Have a wonderful day =)
But I just want to raise awareness that currently it is impossible to get 60fps for a canvas in chrome on MacOS without dropped frames:
I have tested with an M2 Air and an older Intel MacBook Pro. I think this is related to this bug report (open for many years) but I am not sure:
https://issues.chromium.org/issues/41136434
One might say MacOS users use Safari most of the time, but sadly it is not possible to get a pixel perfect (or at least not wildly off) canvas if a user changes the zoom settings:
devicePixelRatio does not change on zoom as it does in other browsers and I believe the spec. https://developer.mozilla.org/en-US/docs/Web/API/Window/devi...
This is a decision made for accessibility reasons on Apples part, but I can’t find the quote on that anymore. Alternative mechanisms to size the internal resolution of a canvas correctly are also not supported on Safari.
Game engine written in Rust, leveraging ECS in almost every place and way, with a really capable WASM export option. Wrestling ECS for the first time might take you some time, but in my experience helps you keep game code as clean and decoupled as game code could be.
JS ECS libraries are listed here: https://www.webgamedev.com/code-architecture/ecs
It's very much a "batteries included" game framework with the exception of a built-in map editor though you can just use something like Tiled.
Don't get me wrong, it's very simple, but it was fun.
Felt like using Flash again. :)
Other engines are either lacking features, or also aren’t tree-shakable, or both. (For example, I think OGL is shakable but it’s much more low-level, just a very thin wrapper around WebGL.)
I guess it’s no big deal as both big engines minify down to around 500KB, IIRC. Just a shame they can’t get smaller than that if you just want to make a tiny little 3D widget.
Though maybe I'm not the target audience.
I believe the wasm is about 5mb and the .pck is about 5mb.
You can shrink the wasm by disabling unused modules in your Godot compilation and not compile stuff you don't need. You can remove debug symbols, and enable link time optimization as well. We could push our export size even smaller, but I have higher priorities.
I have a feeling other libraries on the list are similar