Minecraft veterans all know about the legendary “Far Lands.” This was where the game’s terrain generation would fall apart and the world would start to look like the image at the top of this post. I’m not certain, but I believe this has been fixed in modern versions of the game. It used to happen at a distance of about 12.5 million units (12500 km) from the center of the world, where the player is spawned. By some really weird coincidence, that’s roughly the diameter of the Earth.
There’s a certain mystique to the Far Lands in Minecraft, even though their existence is technically a “bug.” There’s even one tormented soul out there who has decided to walk all twelve million meters out to find them. As of the time of this posting, he has been walking for about ten years and is roughly one third of the way there. This bizarre quest has essentially become his career, as he now raises money for posting videos of his walk. I find it fascinating that a simple bug can lead to someone playing a game for three decades.
The more serious problem that this caused in Minecraft was “jitter.” Long before you even reach the Far Lands, the player’s motion would start to become very rough. You can really clearly see this happening in Kurt’s “Far Lands or Bust” videos, linked above. I was already seeing this happen in Ladon at a distance of about 8 km from the start point. The 3D model of the ship would start to jiggle around a little. At a distance of a few hundred km, the whole ship would just jump around all over the screen. It’s an interesting bug that I almost wish I could leave in, just to see if anyone gets obsessed with it, but I had to fix it because I want the playable area of the game to be much larger than just a few hundred km.
My solution is pretty simple. I just never let the player’s coordinates leave a predefined range. If you fly past a the boundary (which can be set to anything, I think it’s currently 120 meters in any direction) then I reset your position back to zero. But I also move all the other objects currently on the screen along with you! So, from your point of view as the player looking at the ship, you have no idea anything has moved.
Internally, I store the “sector” you’re in and the offset within the sector. When you reach the edge of the sector, I move you back to zero and update the sector. So instead of your coordinates being (12345, 67890), I would say that you are in sector (123, 678) and your offset is (45, 90). So that assumes that a sector is 100 x 100. I don’t know what the actual sector size will be, but probably much larger than 100 meters. Whatever that size is, the player will never technically move farther than that, even though it will appear that they’re traveling millions of km.
There’s still a point where the math will break down, though. I don’t know exactly where that is, but I think it’s around 10,000,000 sectors in any direction. The code I use to seed the random number generator starts to fail somewhere around there. Maybe I’ll leave that small mystery in there to see if anyone finds it.
Give it a shot in version 0.4.2.1.