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

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

The more digits you have to the left of the decimal point the less you can accurately have to the right of it. It makes sense that once you have enough data to the left you end up losing rounding precision on the right which causes jumpiness.

Roblox Vector3s use single precision floating point to my knowledge, so it’s not able to represent as much as you’d think. About 7 decimals is about where things get wacky.

4 Likes

At least this shows that roblox has made notice of the issue, but it’d still be nice to see some official documentation making developers aware of such limitations and their exact nature.

As many others have said here, this is something to do with Floating Point errors
Floating Point can be super annoying when creating a game with a large map or something like that but I found a game that managed to get around this problem in an interesting way.

The game is called AirX 2020, it’s made by Widgeon and a few other developers and what he did to overcome this problem was to implement a recentering system.

The Fix
I’m not exactly sure how it works but I’m pretty sure the player goes to 0, 0, 0 and the place the player was at before being teleported would get teleported next to the player.

Maybe you could use something like that to help with your problem.

AirX 2020:
(61) AirX 2020 Testing - Roblox

(sorry if I didn’t explain the process well, not really a person to rely on when it comes to explaining things)

2 Likes

This is often called a floating or shifting origin. In reality it’s not the origin that’s moving but everything else. Its a solution used by many open world single player games. It works great for single player or cooperative multi-player if you can limit the distance players can stray from the group.

For mmo games you can still use this technique to handle larger map sizes but it’s common to break up the world into separate maps and use cut scenes or come up with some reasonable explanation for transitioning between maps.

Unfortunately origin shifting isn’t something Roblox offers out of the box but it does provide the tools to build it yourself. It’s not trivial though.

2 Likes