Lightweight / Stripped PlayCanvas Engine

Hi fellow devs,

If one would want to build a game with a very lightweight file size (and therefore minimal engine footprint), what would be meaningful things to do, besides going without the physics engine integration? The game should result in around 1-3MB filesize.

Is there a lightweight version of PlayCanvas? Any ways to strip unused functions automatically? What’s your thoughts on this one?

Any hints appreciated, have a great start into the week!

For the moment we have a solution to tree-shake unused parts of the engine if you’re working on an engine only project. If you use Editor project, we’re starting the work on support there as well, but this likely won’t be ready for a while, sometimes next year.

You could also make a custom build of the engine, by stripping parts that you are not using from here: engine/index.js at main · playcanvas/engine · GitHub
You could strip out many Components/ComponentSystems (for example only have render, camera and light component), and also loaders (for example only texture and glb). But depending on complexity of your project, you might need a lot more, and so the saving would be smaller.

Note that full size of compressed minimized engine is just over 300kb. With removing many things you could get to maybe 200kb, so not a huge saving, if your budget is 1-3MB.

Ammo itself is a bit larger, maybe 700kb compressed or so … so ideally you avoid using it if at all possible.


Instead of Ammo, you could use something like Cannon.js which has a smaller footprint

There’s also this chart from Jan that shows where the size of the engine is going:

Eg. Taking out all UI parts is a nice saving

1 Like