# Question about coordinate system precision

I’m a JME rookie looking to use JME for a game I hope to create. I’m planning on having a rather large game world and have a question about the coordinate system used by JME. I see all coordinates are expressed using 32 bit floating point numbers, which have ~7 base10 digits of precision. That equates to about 1 cm of precision on a 100 km scale. In other words in a world 100 km x 100 km an object’s location can’t be specified more precisely than +/- 1 cm. If the world’s larger the precision goes down even more.

My question is how do people handle coordinate precision? Are game world’s typically smaller than this scale? Are object locations not specified as precisely in large worlds? Is there some technique I’m not seeing for handling coordinate system precision?

Slag

Jme is render logic, dont mix it with game logic is the first one. 100km view distance are pretty fine.

Now move the world around 0,0,0 and store it with whatever precision your game requires for large worlds.

(For small worlds you of course save yourself tons of troubly by just having a 1 to 1 relationship between logical and rendering position, but for larger you need to split this)

So when a player moves about the world instead of moving the camera I’d hold the camera still and move the world in the opposite direction? Logically that makes sense but it seems kind of inefficient since it implies mapping the logical coordinates to render coordinates each frame. Are there techniques for making mapping more efficient? My first though would be to create a Spatial for each logical world segment and just translate the segment. Any suggestions?

It’s simple really, you just multiply the co-ordinates by -1 to get the opposite. So if you want to get the location of something, you multiply X and Z (the Y coordinate should be the same unless you’re using parallel projection) by -1. It takes a minute or two to get your head around it, but that’s the long and short of it.

So if you moved the world forward on the X axis 100 world units, the world’s actual position would be negative 100, and you would be at positive 100.

Multiplying by -1 makes positives negative and negatives positive, so it’s a one-size-fits-all solution to the problem.

Also about the moving of course that is only one simple way. (wich works great for space games however)

You could do all kind of different mapping, like only update the offset every x seconds y traveled meters ect.