i swear on all my lives there was a scons option for double precision when building Godot from source. looking again, i either dreamed it, it doesn't exist anymore, or i suck at web searching. someone let me know if i'm crazy.

edit: and the answer is #3:
https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_with_dotnet.html#double-precision-support-real-t-is-double
i think because this is only mentioned in the "Compiling for .NET" doc, its a windows only feature. that or it's another case of strangely obscured documentation. i haven't tried it out yet.

edit #2: its come to my attention .NET is cross platform.

    vfung Hi there, I changed the tags as this seems to be more asking for help than a project. 👍

    vfung I know Godot can be compiled with the double precision option, but that is light years away from my capabilities. Is there a place where I can download such a build?

    I'm in a similar position to you right now. I don't need double precision, but I want to play with soft physics in Godot 4.3, and for that I also need to compile an engine. There are no ready compiled engines available anywhere. Looks like we have only two choices:

    1. Wait for some good Samaritan to compile an engine with the necessary settings and share it with us.
    2. Try to master compilation on our own.

    It is very difficult to find good Samaritans in the modern world. Self-compilation can make us independent (relatively of course), although it is really not easy at all. But presumably it is possible.

    But you have to take into account that GDExtension won't work or have to be recompiled too.

    What version of Godot do you need and for what OS?

    DaveTheCoder It's not that difficult to make your own build. The instructions are reasonably clear.

    It's not that hard to do when you already have a customized and working toolkit, and experience with it. It requires installing and setting up weird programs that wouldn't be needed in peacetime.

    Changing a barrel in a machine gun is not hard, but it may be difficult the first time.

    xyz How do you know you need double precision if you're not a programmer?

    Here is a detailed explanation of why double precision is needed. In short, it is the astronomers' custom.

    Jesusemora In theory you could use the C# build and do the calculations in C#.

    packrat i swear on all my lives there was a scons option for double precision when building Godot from source. looking again, i either dreamed it, it doesn't exist anymore, or i suck at web searching. someone let me know if i'm crazy.

    It seems to be possible to compile from the regular version.

    Translated with DeepL.com (free version)

      As someone stated above, Godot's float type is already double precision. So all large distance calculations can be done with it, and you almost never need double precision for rendering stuff on screen.

      Regarding compiling - building Godot is almost trivial, thanks to SCons. No special knowledge needed. Just download the required software as stated in the instructions, type a single line into the console, press enter and wait for the executable to materialize 🙂

        xyz So all large distance calculations can be done with it, and you almost never need double precision for rendering stuff on screen.

        This is the article that disagrees with you:

        Close to the scene origin this looks totally fine, but once we move this same scene 10,000 kilometers away something terrible happens. The Godots clump together and the character teleports from point to point. The diameter of the earth is 12,742 km for reference.

        xyz Just download the required software as stated in the instructions

        Tomcat It requires installing and setting up weird programs that wouldn't be needed in peacetime.

        I once built ArmorPaint according to the instructions, everything seemed fine. But when I wanted to do it again, one of the required programs asked me to register. So it's not that simple.

        I also remembered, there were problems when building in Win 7, it required at least Win 10. I don't remember how I solved it.

          Tomcat This is the article that disagrees with you:

          From that article:

          By default Godot uses single-precision floating point numbers to store things like object positions. While GDScript typically allows users to do user-space calculations with double precision, those calculations get truncated as soon as they are stored in Godot internal objects (like Vector3’s).

          Then for data requiring double precision, don't use Vector3, Node3D, etc. Use only the primitive data types like float and int, and create custom classes using only those types. For some objects, you may need two copies: a double precision copy for real world calculations, and a single precision copy (using Vector3's) for displaying.

          I haven't thought this through, and there may be obstacles, such as using the physics engine without using Godot's physics objects.

          It will take effort, but so does making a custom build from source code. And with a custom build, you'll need to rebuild every time a new version is released, if you want to keep up with that.

            DaveTheCoder And with a custom build, you'll need to rebuild when a new version is released, if you want to keep up with that.

            Yep. Obviously, there's no easy and simple solution.

            what is even double precision? like x.xx?

              kuligs2 what is even double precision? like x.xx?

              I gave a link to the article above.

              This is the range where individual integer values can be represented in a floating-point number:

              • Single-precision float range (represent all integers): Between -16,777,216 and 16,777,216
              • Double-precision float range (represent all integers): Between -9 quadrillon and 9 quadrillon

              It is needed for astronomical calculations

                Tomcat i get that it is needed for astro stuff.. but can you not abstracterize the numbers? like you want something with 100 zeros you just write it like maybe 1e100 then do some conversion maths from string/obj to some number and or something.. i mean you dont have to store the whole number in a var or do you? i mean 5 chars in a string is less bytes than 1 with 100 zeros..??

                  kuligs2 like you want something with 100 zeros you just write it like maybe 1e100 then do some conversion maths from string/obj to some number and or something

                  That's possible, but it would make the math calculations extremely slow. And you wouldn't be able to use Godot's built-in features like CharacterBody3D, collisions and the physics engine.

                  Godot's primitive float variables and floating point operations are already double precision. The problem is that when using built-in objects such as CharacterBody3D in a standard Godot build, the position, velocity and other properties get truncated to single precision. So you would have to avoid using those objects, and do your own physics calculations.

                  Maybe the ideal solution is a double precision physics engine plugin.

                  I wonder how Unity and Unreal handle this.

                    kuligs2 but can you not abstracterize the numbers?

                    That's not really my topic. I just joined the discussion of Godot compilation possibilities with extended non-standard features. Although my project may need large numbers, but this is in the very long term. Then I will look for a solution.

                    DaveTheCoder Maybe the ideal solution is a double precision physics engine plugin.

                    Can a plugin replace the built-in solution? I'm interested in the question "in general" — I came across a statement that the physics engine should be integrated into the kernel and an extension won't help in this situation.

                    Keep in mind that even if you have double-precision values in your app, the GPU rendering hardware is still single-precision. It's going to convert all your nice double-precision values back into single-precision.

                      Haystack the GPU rendering hardware is still single-precision

                      Well, the main thing there is to calculate the location of celestial bodies — rather, for an accurate astronomical model, and display — another task.

                      Tomcat This is the article that disagrees with you:

                      Lol. The guy moved a scene that's several units big, 10000 units from the origin. That's a very naive bruteforce way to render it. If you plan to render a galaxy this way, not even quadruple precision will help you. Some form of coordinate localization approach should always be used with large spaces, and if you do it right the single precision will always be enough while player would still have the illusion that they deal with a huge continuum.

                      As I always say: don't do simulations in games, do illusions of simulations. It'll spare you much headache.

                        xyz Lol. The guy moved a scene that's several units big, 10000 units from the origin. That's a very naive bruteforce way to render it.

                        Even I realize this is imagery and a stretch to illustrate the problem.

                        As I always say: don't do simulations in games, do illusions of simulations.

                        The question is: where is the line between simulation and imitation? Calculating and showing are different tasks.

                        If it is possible to achieve double precision in the engine, why do need to avoid it so energetically?

                        • xyz replied to this.

                          Tomcat If it is possible to achieve double precision in the engine, why do need to avoid it so energetically?

                          @Haystack Already said why. GPUs (means rendering) operate optimally in single precision. So rendering something that has big coordinates will always "fail". You need to translate it "near" origin for rendering. With sufficiently large distances you'll have the same problem with doubles as well. So a fully generalized solution is not to increase precision, but rather to localize your space representation. How to do it specifically may wary depending on the needs of your "simulation".

                          The problem really is not in precision. The problem is that people do not understand actual hardware limitations. Today's relatively powerful hardware spoiled them to feel entitled to bruteforce their way out of absolutely everything.

                            xyz The problem really is not in precision. The problem is that people do not understand actual hardware limitations.

                            Well, let people learn from their experiences. It's always more useful than outside advice. Warned about possible problems and difficulties, right? And then the person will decide whether to make up his own mind or listen to the wise.

                            "You can be absolutely right, but what's the point if the user is crying?"

                            • xyz replied to this.