Infinite runner and coordinates limit

Hi,

I am creating a infinite runner game. My character runs against X axis and have X coordinate continuously increasing. After a while player’s X coordinate will hit float limit, what is very bad.

To solve that issue I tried to keep player at world origin and move the world, not player. That solves problem with coordinates but I have got new problems with world space particle systems that is attached to the player and some other because of the same reason.

Is there a correct way to do make infinite runner without that issues?

This Unity tech talk explains that you should “reset” your world coordinates to avoid drifting too far away from the (0,0,0) origin.
http://unity3d.com/learn/resources/talks/gis-terrain-unity

Just curious… Is it the Infinite Runner example game from this tutorial? (I haven’t seen it yet!)
http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/infinite-runner

The overall structure is to have your data generated (or stored?) as data, and only generate a fraction of it where it is needed (instead of generating and rendering objects 100s of km away from yourself).

When you get beyond a certain distance from (0,0,0) (say, 10000 units in any axis), you “reset” your main character back to (0,0,0) and generate/move everything else in the same place, relative to the player.
For the player, nothing has changed (it should be seamless), but for an imaginary “God camera” looking down from (0,99999,0), he can see the player and everything else jump back to (0,0,0) every time it goes too far away.

This, of course, is a very general idea, and really you should think about what exactly to do that would suit your game well.

Here is an idea I have for you:
If it is like a “tunnel-style” running game, where you run a long (infinite?) distance along only one axis, but don’t go too far along any of the other axes, then maybe it is better to pre-generate a duplicate of your game data a section ahead of the player’s view, and just seamlessly manually move the player to the alternative section when he exits the first section.
Obviously, when he moves to the next section, the previous section is dumped and the next section is generated in the background at the alternative location, waiting for the payer to be moved back, and so forth.

Excuse the horrible text art, but this probably explains it better.

(world position of first tunnel section) tunnel_section_numbers

(0,  100, 0) 11112222
(0, -100, 0) 22223333

(0,  100, 0) 33334444
(0, -100, 0) 44445555

(0,  100, 0) 55556666
(0, -100, 0) 66667777

WHEN THE PLAYER REACHES THE END OF SECTION 1, HE IS MOVED TO (0, -100, 0)
TO BEGIN RUNNING DOWN SECTION 2 (WHILE SEEING SECTION 3 IN THE DISTANCE),
THEN AT THE END OF SECTION 2, IS MOVED BACK TO (0, 100, 0) WHERE
SECTIONS 3 AND 4 ARE NOW GENERATED AND WAITING FOR HIM. ...AND SO ON.

If it must be truly infinite, you will have to think about how you will wrap around the section numbers.
Maybe have some way of wrapping the max value back to section 1?

Anyway, I hope that at least points you in the right direction.