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

Add a page on large world coordinates (double-precision floats) #6314

Merged
merged 1 commit into from
Oct 15, 2022

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 15, 2022

Note: This currently doesn't include the SCons option rename from godotengine/godot#67399.

@Calinou Calinou added enhancement content:new page Issues and PRs related to creation of new documentation pages for new or undocumented features labels Oct 15, 2022
@Calinou Calinou requested a review from clayjohn October 15, 2022 18:30
Copy link
Member

@mhilbrunner mhilbrunner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great content! Could maybe mention the shifting-world-origin alternative approach that many games use, as thats a common workaround.

tutorials/physics/large_world_coordinates.rst Outdated Show resolved Hide resolved
tutorials/physics/large_world_coordinates.rst Outdated Show resolved Hide resolved
@Calinou
Copy link
Member Author

Calinou commented Oct 15, 2022

I mentioned origin shifting in passing, but I don't know how to implement it. It can quickly get complicated (especially for multiplayer games), so it's mainly good to know for low-end mobile.

I added a paragraph on resource saving and interoperability as well. I have some questions:

  • Is there a GDScript method or feature tag to check whether the build is using double-precision? For instance, this could be used by plugin authors to warn if the current build isn't using double-precision.
  • Does GDExtension have REAL_T_IS_DOUBLE defined when building an extension with float=64, and can you use real_t in extensions? I mentioned this in the docs, but I'm not sure if it's correct.

@mhilbrunner
Copy link
Member

I mentioned origin shifting in passing

D'oh, yeah, thats enough already :)

I don't know how to implement it

Roughly: whenever player distance to origin exceeds the shift treshold, calculate the difference between player position and origin and shift everything's position in the game by that difference, so the player is at the origin again, but everything else is still at the same position relative to each other.

Then, pile lots of bandaids and fixes on top as you run into different bugs and edge cases :P

Those additional questions are good ones, no idea honestly, may try out the GDExtension thing. Regardless, I'll go ahead and merge this one now, and we can amend and iterate as needed if we figure out more :) Amazing work, as usual! 🎉

@mhilbrunner mhilbrunner merged commit 70b324b into godotengine:master Oct 15, 2022
@Calinou Calinou deleted the add-large-world-coordinates branch October 15, 2022 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:new page Issues and PRs related to creation of new documentation pages for new or undocumented features enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants