Sign in to follow this  
fateriddle

Is there any plan to extract a light weight core of babylon.js for mobile?

Recommended Posts

Is there any plan to extract a light weight core of babylon.js for mobile? 

Currently, I downloaded the babylon.js file from mdn and size is around 2.1 M. That's way too big for me to run some simple game on smart phone.

Can we extract a lighter version that only contains the core functionalities? And maybe then add everything else back onto the core using plugins / npm packages?

I build a game to play on phone, and share it (qr code) internally in our company, the performance is not impressive to say the least, and we are considering switching to something lighter right now. 

But I actually like babylon.js so it feels like a shame. Just asking.

Share this post


Link to post
Share on other sites

You can build your own custom version. The only way I could do it I will describe below. Others may know alternatives

You build from a local version of the BabylonJS/Babylon.js github repository.

Read https://doc.babylonjs.com/how_to/how_to_start and rather than creating your own fork and cloning from that just clone directly to your local computer. Before doing the build part read https://doc.babylonjs.com/how_to/workloads to see which workloads to select and place in the `buildConfigurations` and set the `currentConfig` to this. The do the build part with gulp --max-old-space-size=8192 and you build of javascript files will be in the dist folder.

Share this post


Link to post
Share on other sites

v4.0 will let you treeshake the code in order to get only what you need.

 

So far with current version you can rely on workloads (as @JohnK mentioned )to build your own version with only what you need

Also 2.1M is without gzip so I highly encourage you to turn on gzip on your server and then the entire library is around 400K

 

What do you mean by "the performance is not impressive "? Is that related to size of are you facing perf issues (https://doc.babylonjs.com/how_to/optimizing_your_scene)

Share this post


Link to post
Share on other sites
On 11/14/2018 at 5:20 PM, JohnK said:

You can build your own custom version. The only way I could do it I will describe below. Others may know alternatives

You build from a local version of the BabylonJS/Babylon.js github repository.

Read https://doc.babylonjs.com/how_to/how_to_start and rather than creating your own fork and cloning from that just clone directly to your local computer. Before doing the build part read https://doc.babylonjs.com/how_to/workloads to see which workloads to select and place in the `buildConfigurations` and set the `currentConfig` to this. The do the build part with gulp --max-old-space-size=8192 and you build of javascript files will be in the dist folder.

I got this error (see attach). Basically I clone the project, cd into Gulp folder, then run 'npm install' & 'gulp --max-old-space-size=8192'
Everything seems fine, till the very end, I got this error. Haven't change anything, not trying to customize yet.

babylonjs build错误.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.