Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that creating a custom engine build configuration is not sufficient by itself to reduce exported project size #72893

Open
TheCymaera opened this issue Feb 8, 2023 · 10 comments

Comments

@TheCymaera
Copy link

Godot version

v4.0.beta17.official [c400205]

System information

macOS 13.2 (22D49)

Issue description

After disabling most features through the engine build configuration menu, a 2D scene with a single ColorRect produces a web release-build that is over 28MB. This is the same size as an export with all features included.

Steps to reproduce

  • Create a new project with a 2D scene
  • Go to Project > Customize Engine Build Configuration
  • Click "Detect from Project" and manually unselect "3D Engine" and "3D Physics"
  • Go to Project > Export
  • Build release as web/HTML5.
  • Web assembly file is around 28MB.

Minimal reproduction project

Test Project 2D G4.zip

@Calinou
Copy link
Member

Calinou commented Feb 8, 2023

Related to #68647.

You need to compile custom HTML5 export templates after creating a custom configuration. There is no way to magically trim features from the exported project without recompiling 🙂

We should add a label to the dialog and write a dedicated documentation page for customizing the feature build profiles (which can then be linked to from the dialog using a LinkButton).

@Calinou Calinou changed the title Engine Build Configuration does not affect web build size. Clarify that creating a custom engine build configuration is not sufficient by itself to reduce exported project size Feb 8, 2023
@magikmw
Copy link

magikmw commented Feb 9, 2023

I'd like to add a newbie (in godot engine developement) perspective:

  • I've looked through documentation, and other than this particular paragraph I cannot find more information about creating custom templates. Certainly none on how to use the engine build configuration.
  • Now, I suspect if I dug into docs from the start of Contributing section, I could figure it out.
  • However, I've seen a few issues here and some discussions on reddit from devs interested primarly in making games for web put a lot of value in reducing the size of downloaded files, and therfore startup time.
  • I propose that creating and using custom templates should get a treatment similiar to 'your first game' tutorials, as a step-by-step guide in official documentation. It's an activity that any dev could benefit from, especially due to further core Godot developement increasing the size of binaries. The users don't nescessarly want to even check the Contributing section of the documentation (contribution is not on their mind yet, creating small exports is).

I'm willing to contribute my time to this goal, especially if I could get some guidance from someone in the know already.

@voylin
Copy link
Contributor

voylin commented Jun 13, 2023

How does this custom engine build configuration actually work? There is no information about this anywhere. we have this page: #62996
Here it says to use that menu to create that .build file and then put it in scons with this:
$ scons p=windows target=release tools=no build_feature_profile="soso.build"
But as far as I can tell, this doesn't change anything.

I would be more then happy to write out the docs or try to fix any of the issues which make it not work, but to my knowledge 'build_feature_profile' doesn't work (yet), nor is there any way to use that file. (or maybe it's a windows only thing for now?)

@Calinou
Copy link
Member

Calinou commented Jun 13, 2023

I would be more then happy to write out the docs or try to fix any of the issues which make it not work, but to my knowledge 'build_feature_profile' doesn't work (yet), nor is there any way to use that file. (or maybe it's a windows only thing for now?)

The option name was initially build_feature_profile in #62996, but it has changed to build_profile in 4.0.stable:

opts.Add("build_profile", "Path to a file containing a feature build profile", "")

@voylin
Copy link
Contributor

voylin commented Jun 13, 2023

I would be more then happy to write out the docs or try to fix any of the issues which make it not work, but to my knowledge 'build_feature_profile' doesn't work (yet), nor is there any way to use that file. (or maybe it's a windows only thing for now?)

The option name was initially build_feature_profile in #62996, but it has changed to build_profile in 4.0.stable:

opts.Add("build_profile", "Path to a file containing a feature build profile", "")

Are there any plans of changing this in the near future, or would it be okay to add this to the overall documentation already? If it would be okay than I'd like to create an entry to the docs on how to use this. (I'll first fiddle around with it a bit to test things out of course so I can write a correct entry ^^)

@magikmw
Copy link

magikmw commented Jun 13, 2023

Are there any plans of changing this in the near future, or would it be okay to add this to the overall documentation already? If it would be okay than I'd like to create an entry to the docs on how to use this. (I'll first fiddle around with it a bit to test things out of course so I can write a correct entry ^^)

I'll gladly test the docs - drop me a link to PR when you're ready.

@paskausks
Copy link

I also stumbled on this completely by accident. Documentation would be greatly appreciated. The autodetection is great and will greatly reduce the effort required to produce small builds, which are essential for mobile devices especially in places where network availability is limited.

@Calinou
Copy link
Member

Calinou commented Aug 15, 2023

The autodetection is great and will greatly reduce the effort required to produce small builds, which are essential for mobile devices especially in places where network availability is limited.

The custom build profile feature on its own doesn't reduce binary size much, so it won't help that much. This is because it doesn't disable modules if a module ends up unused (due to all nodes that require it being disabled). Using optimize=size and disabling modules helps much more in comparison, but there's no way to detect which modules are required for a specific project.

This means that while additional documentation is welcome, it won't point towards the most optimal way of reducing binaries. The optimal way is still the oldschool approach of figuring out which modules you need, and disabling all modules you don't need.

@paskausks
Copy link

The custom build profile feature on its own doesn't reduce binary size much, so it won't help that much.

Do I understand it right - feeding the *.build file to SCONS when compiling an export template won't exclude the disabled_classes from the final export template? If so, what is the custom build profile feature meant for then?

@Calinou
Copy link
Member

Calinou commented Aug 15, 2023

Do I understand it right - feeding the *.build file to SCONS when compiling an export template won't exclude the disabled_classes from the final export template? If so, what is the custom build profile feature meant for then?

It will exclude the disabled classes, but it won't disable modules that these disabled classes may rely upon. This reduces the opportunities for reducing binary size significantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants