Game Development Community

About X,Y.Z position of an object

by Dimitris Matsouliadis · in Torque 3D Professional · 08/05/2010 (7:25 pm) · 2 replies

Hello everyone
Know how to increase the sampling X, Y, Z so I can have the opportunity to travel longer distances at a level; An example flight limited to short distances because it has tremolo, it has scared due to failure to decimals in X, Y, Z of the position.
Where is in the engine the x,y,z? maybe i need to change vars from __int32 to __int64

Thanks for yours time :)


#1
08/05/2010 (8:36 pm)
This is sort of a common topic of discussion on and off. It's not nearly as simple an issue as simply changing from 32-bit to 64-bit (floats in this case). Like most game engines, basically everything from physics to rendering is going to be handled with 32-bit floating point precision, so just using 64-bit floating point precision for the position storage won't actually solve the problem. You'll also need to rewrite any physics elements to use 64-bit, handle how these values translate to scripts, and handle how to render this with a 32-bit precision rendering engine.

My suggestion is to look into what I would call "position paging," ie relative positioning. In this system you keep the existing 32-bit position system, but add another set of 32-bit integer X/Y/Z coords that represent a "page" of the world.

Whenever the player travels to coords beyond, let's say 10000, you warp them back around to the other side of the world (in this case -10000) and increment the Page value by 1. Likewise, if they turn around and travel past -10000, you decrement the Page value by 1. This is done for X, Y and Z if needed (space environments are probably the only things that need to include Z).

At this point you have essentially 64-bits worth of positional data, because the player can travel to an extent of 10000 * MAX_INT (~2 billion) units from the center of the world. The challenge at this point becomes handling all of the other objects in the scene. Depending on whether this is singleplayer or multiplayer, that's going to be either fairly easy or highly complicated.

Wish I could give you a more straight-forward answer, but it's not a simple topic.
#2
08/05/2010 (10:18 pm)
I fully understand the fears that you are very correct. A solution should be find but for the moment there came a game that idea. The game is multiplayer and fly with spaceship in a galaxy. Distances are enormous, eg The visual distance is 500k. when the coordinates lose their decimal parts the universe is dancing:)
The idea with pages per time can be achieved rather to study it and see the result. But need

Thank you very much Henry for taking the time to my question