Hi,
I have the following question:
Is there some way to reduce the weight of the engine file by cutting out the modules I’m not using?
Is there already a ready-made solution? If not, then what would you advise to do it more efficiently and with less risk of damaging the required modules and overall engine performance?
In theory (I’ve not tried this), you can remove component/systems that you don’t want to use such as the UI module (which is pretty large).
However, you are talking about 10s of KB after gzip so unless you are looking for a very lean engine and scoped functionality, I’m not sure if you are going to get the gain you want?
Can you recommend any glsl compressor? The one which will be compatible with playcanvas shaders chunks format (template literals)?
Or do i better extend rollup.config.js to remove comments, extra tabs and spaces, minify local vars, etc. ?
I cant, but anyway it may not work with the chunk system, only with full shader xode. This is because if it renames functions or variables, each chunk may not be compatible with the rest anymore
@yaustar Hi again. Here is a small report on this thread.
I removed some of the modules that I don’t use in one specific project of mine (animations, a large part of the UI, legacy components, collision, sprites and some others) and thereby saved almost 300kb. Theoretically, if completely abandon the Playcanvas UI (sad sacrifice for the weight of the engine ) in favor of simple HTML, we can save another ±100kb.
If we use the lz4.js compressor together with this, it will save another 500kb.
In the end, I got a fully working project with an engine of about 500kb, which gives even more space for logic and assets in Playable Ads.
I hope it will also be useful to others looking for ways to reduce the critical weight of their project.
I must have expressed myself badly. I meant that the engine file itself weighs 500kb (not the project + engine). However, if we completely remove the UI, it can weigh about 400kb
This is after compression with lz4 (400-500kb). Without compression, it weighs 0.9-1 MB
Edit: This is specifically for me, since I do not use some components other than UI (animations, collision, sprites). If someone wants to cut out components that they are not using in their particular project, then the weight may vary slightly