Problem with floating point precision errors

Y’all are probably familiar with everything getting wobbly and weird once you go far enough from the world’s origin.

My game involves really great distances in a really fast ship, and I’m pretty worried about the ship going so far that stuff at least subtly starts to get wobbly. The effect of everything slowly descending into madness is also pretty unnerving.

Players mostly just stand on the ship, and so idk how to teleport the ship to a closer distance without casually having everyone fall off or get startled.

In my plans, assets like islands and other ships are spawned and despawned within boundaries that follow the ship along the Z axis. Other ships are usually allowed some space behind the players’ ship until they get deleted by the Expunger Part.

1 Like

Suggestion make a ship static, center of everything and worlds spawn around it.
make illusion of movement I could misunderstand your game idea

The main issue in your game isn’t floating point errors but that you create a direct 1-1 correlation between the editor Position coordinates and the in-game coordinates. Basically to fix it, just assume that your intergalactic light year in-game distances, are smaller Position distances. For example, 10 thousand meters in your game logic can be 1 stud in your code logic.

1 Like

Other ships usually spawn in with differing speeds and they move around a lot. “Fixed” structures like islands, tall buildings, and even the spawn place will need unfathomable welding and rigging so that they can “pass by.” One of the game’s main focus also is to “rendezvous” (you can search it up if you don’t know) properly with other ships.

That’s what happens… You’re going pretty far it you’re seeing this. Few ways around this but there is no way to actually go that far realistically. Things start to look odd even before that point.

Well the ship would be unfathomably slow, evident from seeing fixed structures passing by if game logically 10 thousand meters was equal to 1 stud behind the scenes. Maybe I can slow down the ship a bit, but I’m still kinda worried about going quite far into the distance since the ship still has to feel “fast”.

Would you even need to worry about welds? You can pivot the entire model and it’ll work.

Adjust your physics so they account for it. Also adjust the physics related to player movement. I’m basically asking you to lie to the player because it’s way easier and logical that what you’re currently trying to do, that requires the entire engine logic to change for just this one use case.

Think of the distance Roblox allows you to move in as information rather than distance, and then think how to manipulate it to your advantage. For example Roblox recently added the ability for positions to be very slightly away from each other(for example by 0.001 studs) you can take advantage of it since it means extra information.

1 Like

So like, correct me if I’m wrong, the ship doesn’t have to travel that fast, and the displayed distance that it has travelled is a number kinda higher than how many actual studs it has gone?

1 Like

Basically you have to create the illusion that it travels fast, like most space games do. For example you can also add visual effects that trick the player into thinking the ship is travelling at light speed. Here’s an example of what the game Subnautica did for their game ending scene, where the ship looks like it’s travelling at light speed, while in reality it’s not travelling at all:

(WARNING huge spoiler for the first Subnautica game below)

Another great example for what you’re trying to do is movies. In movies you often see sci-fi scenes of extreme distance travelling or extreme catastrophes, obviously they don’t need to really do it to create that illusion for the viewer. So you can also rethink your problem as a cinematics type of problem.

So I guess I gotta add some visual effects and altered perceiving and stuff to make the ship look like it’s moving fast even though it’s not really going that fast? The FOV’s gonna be increase, maybe some “air lines” going past the ship when it’s going fast, and the distance-travelled display multiplied a bit to make it look like you’re going really far. Then because the ship is not going that fast, it’s gonna take way more time of travelling for the annoying distortion to appear.

1 Like