Loss of precision causes game breaking issues at distances far from origin

I’ve been creating a place that takes a players position and uses map feeds to build a world around them based on their real world coordinates. Naturally this means player positions quickly become very large, whenever I get quite far from the origin I immedietally face issues where rendering and physics breaks down. This is game breaking as it prevents players from going too far from the origin (lat 0, lon 0 in my place).

This bug has been around for a while, but is now game-breaking for my project, looking into this and increasing the distance from the origin where systems are stable to a much higher number would be appreciated.

This bug happens every time in production.

Reproduce:

  1. Join my game here: https://www.roblox.com/games/2553556256/GeoBox-Explore-the-world
  2. Teleport to London via /tp 51.5485, 0.4796
  3. Watch physics and graphics go crazy
7 Likes

This has been shown in several tweets by @Maximum_ADHD.

It usually becomes noticeable around 10,000 studs from the origin.

Once you pass a million studs from the origin, things get crazy.

Any farther and it just gets worse.

https://www.roblox.com/games/217275413/The-Null-Zone

3 Likes

Absolutely, in my case since distances can cover the entire earth, it becomes game breaking very quickly.

1 Like

This is a side effect of floating point numbers and is unavoidable, You’d be better off using a chunking and region system and moving the world to the origin

4 Likes

I’m not saying its unavoidable, I’m saying increasing the bits used in floating points so it becomes a problem at much bigger ranges would be appreciated, since I can demonstrate a sane use case for using these far off positions now.

3 Likes

This problem isn’t easy to fix, it’s a fundamental issue that almost all games using floating point precision have.


21 Likes

I understand this, but I think the current limitations aren’t far enough and more bits should be allocated to floating points so that only truly insane distances fail.

2 Likes

Yeah but think about performance. Especially on mobile.

Also, think about your use case. You’re requesting performance to be decreased globally for something that is pretty niche. I’m talking about the entire genre of procedurally generated and large scale games. Where are they? (Yeah, it is an argument that can be turned against me, but I’m pretty sure we would have seen people try already if it was relevant to this platform.)

The 9y/o kids that dominate this platform don’t care about that stuff. Booga Booga was very popular for a short while (it was procedural, right?), but it was still a very small map, and procedural was by no means the core concept of the game (although it did play a role).

Teleported to Auckland, a city in my country. Floating point errors never cease to amuse. Cool place btw, would be nice if we had the capability but not a good idea in the bigger picture I think. Plus there's already Google Maps.

5 Likes

And this is why financial systems handling money will never use floats

14 Likes

21 Likes

Sorry to be the bearer of bad news, but this isn’t a bug and isn’t going to change in the foreseeable future. Gaming happens in a single-precision world. You can’t map the entire world, at life size, in a continuous, linear coordinate system. Higher-precision (more bits) floats isn’t how you would want to solve this for a general-purpose game engine like Roblox either, since you’d hugely impact performance of all games just to cover this fringe case of wanting to travel a million studs from the origin.

You’re going to want to either design your game to make discontinuous use of the coordinate system, to place cities being visited much closer to each other than in real life, or–ideally–use one reserved server per city, so that your build detail is not limited inversely proportional some number of cities you’re trying to keep in memory. Simulating whole-world scale necessarily involves cleverness, smoke and mirrors. If you try to just build the whole world life size 1 foot = 1 stud, this precision issue is just the first of many data and memory limitations you’ll encounter.

19 Likes

I’ve solved most of the issues, this one being the only major one left without a solution. Alas I recognize why this won’t be fixed and I guess I’ll need to get clever with moving players nearer to the origin without them realizing, thanks for the response regardless :grinning:

So far I’ve got it loading world areas on a level of 1:1 (roads and trees only) but its a good start I think!

4 Likes
Screenshots



When doing anything at large distances away from the origin position (0,0,0) of the world, physics and rendering begin to start doing some wonky things that get worse the further away you get.

This bug has been happening for as long as I can remember, years even, but I only just thought about making a bug report for it recently.

You can test out some of the things that are going wrong in this place I made:

  • Try walking around normally
  • Try playing in first person
  • Try interacting with the unanchored parts

Repro File:
roblox_pushed_to_the_limit.rbxl (23.0 KB)

Repro steps: (for if you have a problem with files for some reason)

  • Create a game that has a baseplate and a spawn location
  • Add a few unanchored parts scattered around
  • Put a script that moves all these parts very far away when you spawn (i used this script)
for _,v in pairs(game.Workspace:GetDescendants()) do
	if v:IsA("BasePart") then
		v.CFrame = v.CFrame + Vector3.new(1000000,1000000,1000000)
	end
end
  • Then just test play and watch roblox give up
1 Like

This is called the Floating Point. I’m sure roblox already knows about it, and it’s just a limitation of the engine.

2 Likes

I agree with you, but I haven’t seen it documented anywhere so thought it would be a good idea to make a bug report about it in case it wasn’t just a limitation. If you can find any official roblox documentation about this please post it here.

Just search up “The Floating Point” or something like that and you’ll find some games that show exactly what you’re doing.

“Floating point” is the kind of format used to represent decimal numbers in computers. This behavior is caused by floating point errors.

3 Likes

That’s what it’s also called by most developers on roblox, too.

It’s only one million, which roblox should be able to represent with no problem, so I doubt it’s a result of a floating point error unless roblox is using a much smaller unit than studs. It also doesn’t seem like a “fine line” between good and bad, it just gets progressively worse as you go further away.

Something that seemingly fixes this issue was shown in Hack Week 2019, but it’s unknown whether or not it’ll be officially implemented.

7 Likes