Jump to content

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


fateriddle
 Share

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.

Link to comment
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.

Link to comment
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)

Link to comment
Share on other sites

  • 1 month later...
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...