-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Project settings to use soft float and fixed point backends for float type #7128
Comments
Doing this as a project setting is going to be extremely difficult, I'd argue impossible, as GDScript relies on built in types that can't be changed like this, and it'd require every part of the engine using non-integers to somehow handle this Even doing this for like Doing this as a compilation option would be a different story, but using fixed point math would involve a lot of work to make it decently performant and redesigning essentially everything in the engine that involves it If we simply do this only for the data types in GDScript, the issues making Now adding a fixed point type is an idea, to be used for things like transferring data But to be frank I have no hopes that it will be either possible, or approved, to do any of this by a project setting, it would at minimum be an extreme bottleneck for performance, even if it just affects the GDScript part, and converts to the relevant floating point type into the engine |
Also useful for all kinds of game mechanic related data, e.g. item weights or currency. I meant to write a proposal for this feature, but I never got around to work out the details sufficiently. |
We already have a 64.64 fixed point format available for internal use, but it doesn't have support for a number of things, it's in |
I don't think this is a practical thing that can be done. Whether or not we're using floats is compiled into the engine. To allow this to be a project setting, we'd need to use some abstraction instead of real floats, that would check this project setting on every math operation. This would slow down all uses of Godot (even when the project setting is set to "hardware floats"), when most projects don't need it. Maybe this could be done as a compile-time settings, where you could compile a "soft float" or "fixed-point" build of the engine, but that would still require massive changes to most of the project's source code. Which, again, I don't think is worth it for a feature that isn't needed by most games. FYI, I maintain a deterministic 2D physics engine for Godot that uses fixed-point math (it's main use-case is for multiplayer games using rollback netcode): https://gitlab.com/snopek-games/sg-physics-2d Rather than trying to change all of the engine, it just introduces some custom physics nodes, which is IMO far more maintainable. And then only folks who need it can use it! Of course, this only covers 2D, but anyone is welcome to make a GDExtension that does a similar thing for 3D, perhaps using soft floats (which I think would be a better fit for 3D than fixed-point). |
As explained here, it's not possible to have float precision controlled by a project setting. However, you can add Making the entire engine deterministic is too ambitious of a goal. At most, it can be isolated to a specific system such as the physics engine. Also note that double-precision is already really good, it's nearly a billion times better than single-precision and that is already good enough for most games. |
Describe the project you are working on
Multiplayer game
Describe the problem or limitation you are having in your project
It would be nice if node's were deterministic and we could just sync input state
It would reduce network overhead and would make writing things like david snopek's sg physics not needed
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add backends for gdscript float...
Add option in project settings to change what one we use.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Hardware would be no different to what we have now
Software would be a software implementation of hardware
Fixed would be a fixed point number possibly configurable or just up to the godot developers
If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
It would ensure everything that uses float in the engine can be set to be deterministic
The text was updated successfully, but these errors were encountered: