-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Move Godot Physics 2D into a module; add dummy 2D physics server #95261
Conversation
What's the best way to disable 2D physics tests when the physics server is the dummy physics server? |
I guess you could test something from Or register a bool somewhere in the |
1842267
to
34c250e
Compare
E.g. navigation checks in test_main.cpp if the navigation module is enabled and if not the entire navigation tests are excluded from the build. |
34c250e
to
28298cd
Compare
@smix8 I think we shouldn't rely on a define like For now I hacked around it with an early return from the test. Ideally I would skip the test instead, but I didn't find a way to do it properly within the doctest framework (which I am not really familiar with). |
28298cd
to
29851a7
Compare
godot/tests/servers/test_text_server.h Lines 45 to 51 in 03afb92
|
Continuing my test on top of #95252 (comment) (merged both PRs locally) on a web Default config (both 2D and 3D physics enabled):
With the 3D physics module disabled:
With both the 3D and 2D physics modules disabled:
So removing the 2D physics reduces the wasm size by 4.4% (1.4 MiB) and the zip size by 2.7% (209 KiB). Also for the lulz, my minimal template with all engine functionality disabled (at least all functionality that can be disabled currently):
Now to find what I would need to re-enable to be able to export an actual small game :D |
29851a7
to
707bd33
Compare
If the module is enabled (default), 2D physics works as it did before. If the module is disabled and no other 2D physics server is registered (via a module or GDExtension), then we fall back to a dummy implementation which effectively disables 2D physics functionality (and a warning is printed). The dummy 2D physics server can also be selected explicitly, in which case no warning is printed.
707bd33
to
7c4c4b9
Compare
Thanks! |
If the module is enabled (default), 2D physics works as it did before this PR.
If the module is disabled and no other 2D physics server is registered (via a module or GDExtension), then Godot falls back to a dummy implementation which effectively disables 2D physics functionality (and a warning is printed).
To try it, compile with the SCons option
module_godot_physics_2d_enabled=no
.This is useful for games that want to use a different 2D physics server, especially in web builds where binary size matters.
Linux binary size comparison (
scons target=template_release production=yes use_llvm=yes linker=lld
):So the binary size of the Godot Physics 2D module is 1.691 MiB (1772680 bytes), nice.