Jitters when position values get very high

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LemonSqueezy

Context:
I have a 2D space game where you fly a Spaceship through space filled with asteroids. The space ship is composed out of multiple different tiles. Tiles for the ship walls, doors, hull elements, so on. The map (space) is infinite, that means the spaceship can just fly on and on, thus increasing the ships position value.

The Problem:
After reaching position values larger than 200_000, tiles on the ship start to jitter. Mainly when the ship is rotated.

Potential Cause:
As far as I understand, when the shipsposition value reaches large enough values, the precision of the float position value is no longer high enough to place every tiles (which are very far away from the origin now) on the correct position every frame. The tiles can be displaced by multiple pixels. Thus causing jitter. Rotation seems to be especially sensitive because the tiles position isn’t just a simple position offset, but varies for every tile when the ship is rotated (tile position is calculated via transforms with sin / cos where precision is especially important)!

My attempt at fixing the Problem:
To combat these “long-distance”-based jitters I decided to “reset” the position values of all objects on the screen in regular intervals. In pseudo code:

foreach object on screen:
      new_object_position = object_position - ship_position

resulting in the ship position being reset to the origin point (0,0) and all other objects (like asteroids) in close proximity around the space ship. This “reset” ideally is not noticeable to the user.

In my testing, this does fix the jitters on tiles on the ship. But I am having trouble to keep the position “resets” seamless, unnoticeable. E.g. now the asteroids (all of them at the same time) “jump” a little, because the reset of the ship, the asteroids (and other objects on the screen) don’t sync up perfectly. Going further down the rabbit hole might improve the sync issues, but before doing that…

My question is:
1. Is there a smarter approach to “resetting” the objects positions?
2. Or maybe a completely different, easier approach to avoiding “long-distance”-based jitter?
3. Or do you have a clean implementation of resetting the objects position that syncs up nicely?