Skip to content

Commit 1e6df92

Browse files
authored
Update Optimizing for size for Godot 4.5 (#10968)
- Document disabling physics engines (and 2D/3D physics altogether). - Mention disabling 2D navigation separately from 3D. - Improve LTO minimum RAM notice and remove reference to Godot 3.x. - Update list of modules that can be disabled in a minimal 2D game. - Update list of nodes that are disabled with `disable_advanced_gui=yes`.
1 parent 6b8faf3 commit 1e6df92

File tree

1 file changed

+49
-11
lines changed

1 file changed

+49
-11
lines changed

contributing/development/compiling/optimizing_for_size.rst

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ and MSVC compilers:
6666
scons target=template_release lto=full
6767

6868
Linking becomes much slower and more RAM-consuming with this option,
69-
so it should be used only for release builds:
70-
71-
- When compiling the ``master`` branch, you need to have at least 8 GB of RAM
72-
available for successful linking with LTO enabled.
73-
- When compiling the ``3.x`` branch, you need to have at least 6 GB of RAM
74-
available for successful linking with LTO enabled.
69+
so it should be used only for release builds. You need to have at least
70+
8 GB of RAM available for successful linking with LTO enabled. Since the operating
71+
system and programs will take up some RAM, in practice, you need 12 GB of RAM
72+
installed in your system (preferably 16 GB) to compile Godot with LTO enabled.
7573

7674
Optimizing for size instead of speed
7775
------------------------------------
@@ -170,10 +168,12 @@ This is everything that will be disabled:
170168
- :ref:`class_CharFXTransform`
171169
- :ref:`class_CodeEdit`
172170
- :ref:`class_CodeHighlighter`
173-
- :ref:`class_ColorPickerButton`
174171
- :ref:`class_ColorPicker`
172+
- :ref:`class_ColorPickerButton`
175173
- :ref:`class_ConfirmationDialog`
176174
- :ref:`class_FileDialog`
175+
- :ref:`class_FoldableContainer`
176+
- :ref:`class_FoldableGroup`
177177
- :ref:`class_GraphEdit`
178178
- :ref:`class_GraphElement`
179179
- :ref:`class_GraphFrame`
@@ -191,10 +191,42 @@ This is everything that will be disabled:
191191
- :ref:`class_SubViewportContainer`
192192
- :ref:`class_SyntaxHighlighter`
193193
- :ref:`class_TextEdit`
194-
- :ref:`class_TreeItem`
195194
- :ref:`class_Tree`
195+
- :ref:`class_TreeItem`
196196
- :ref:`class_VSplitContainer`
197197

198+
Disabling physics engines
199+
-------------------------
200+
201+
- **Space savings:** Low to moderate
202+
- **Difficulty:** Easy
203+
- **Performed in official builds:** No
204+
205+
If your 3D project uses Jolt Physics, you can disable GodotPhysics3D at compile-time as
206+
it will never be used:
207+
208+
::
209+
210+
scons target=template_release module_godot_physics_3d_enabled=no
211+
212+
Inversely, if your 3D project uses GodotPhysics3D, you can disable Jolt Physics at compile-time:
213+
214+
::
215+
216+
scons target=template_release module_jolt_enabled=no
217+
218+
If your project uses 3D rendering but not physics (or 2D rendering but not physics),
219+
you can also disable 2D or 3D physics entirely. Most 3D projects can take advantage
220+
of this, as they don't make use of 2D physics:
221+
222+
::
223+
224+
scons target=template_release disable_physics_2d=yes
225+
226+
::
227+
228+
scons target=template_release disable_physics_3d=yes
229+
198230
Disabling unwanted modules
199231
--------------------------
200232

@@ -215,7 +247,7 @@ a lot of them:
215247

216248
::
217249

218-
scons target=template_release module_basis_universal_enabled=no module_bmp_enabled=no module_camera_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_jsonrpc_enabled=no module_ktx_enabled=no module_mbedtls_enabled=no module_meshoptimizer_enabled=no module_minimp3_enabled=no module_mobile_vr_enabled=no module_msdfgen_enabled=no module_multiplayer_enabled=no module_noise_enabled=no module_navigation_3d_enabled=no module_ogg_enabled=no module_openxr_enabled=no module_raycast_enabled=no module_regex_enabled=no module_squish_enabled=no module_svg_enabled=no module_tga_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_upnp_enabled=no module_vhacd_enabled=no module_vorbis_enabled=no module_webrtc_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_zip_enabled=no
250+
scons target=template_release module_astcenc_enabled=no module_basis_universal_enabled=no module_bcdec_enabled=no module_bmp_enabled=no module_camera_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_etcpak_enabled=no module_fbx_enabled=no module_gltf_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_interactive_music_enabled=no module_jsonrpc_enabled=no module_ktx_enabled=no module_mbedtls_enabled=no module_meshoptimizer_enabled=no module_minimp3_enabled=no module_mobile_vr_enabled=no module_msdfgen_enabled=no module_multiplayer_enabled=no module_noise_enabled=no module_navigation_2d_enabled=no module_navigation_3d_enabled=no module_ogg_enabled=no module_openxr_enabled=no module_raycast_enabled=no module_regex_enabled=no module_svg_enabled=no module_tga_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_upnp_enabled=no module_vhacd_enabled=no module_vorbis_enabled=no module_webrtc_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_zip_enabled=no
219251

220252
If this proves not to work for your use case, you should review the list of
221253
modules and see which ones you actually still need for your game (e.g. you might
@@ -229,29 +261,35 @@ following:
229261
.. code-block:: python
230262
:caption: custom.py
231263
264+
module_astcenc_enabled = "no"
232265
module_basis_universal_enabled = "no"
266+
module_bcdec_enabled = "no"
233267
module_bmp_enabled = "no"
234268
module_camera_enabled = "no"
235269
module_csg_enabled = "no"
236270
module_dds_enabled = "no"
237271
module_enet_enabled = "no"
272+
module_etcpak_enabled = "no"
273+
module_fbx_enabled = "no"
274+
module_gltf_enabled = "no"
238275
module_gridmap_enabled = "no"
239276
module_hdr_enabled = "no"
277+
module_interactive_music_enabled = "no"
240278
module_jsonrpc_enabled = "no"
241279
module_ktx_enabled = "no"
242280
module_mbedtls_enabled = "no"
243281
module_meshoptimizer_enabled = "no"
244282
module_minimp3_enabled = "no"
245283
module_mobile_vr_enabled = "no"
246-
module_msdfgen_enabled= "no"
284+
module_msdfgen_enabled = "no"
247285
module_multiplayer_enabled = "no"
248286
module_noise_enabled = "no"
287+
module_navigation_2d_enabled = "no"
249288
module_navigation_3d_enabled = "no"
250289
module_ogg_enabled = "no"
251290
module_openxr_enabled = "no"
252291
module_raycast_enabled = "no"
253292
module_regex_enabled = "no"
254-
module_squish_enabled = "no"
255293
module_svg_enabled = "no"
256294
module_tga_enabled = "no"
257295
module_theora_enabled = "no"

0 commit comments

Comments
 (0)