I guess this kind of game or simulator already exist somewhere, but I'm not sure...
Let's imagine I'm making a game where the proportions of the planet earth and the humans beings on it are the same as in the reality. I can't only use longitude/latitude with float because when being far away from the origin, precision would be lost: when the float exponent gets too high, the digit at the right would be rounded and thus, not considered. Or to say it simpler, float
are not precise enough to position an object on earth using longitude/latitude while keeping smooth movements.
Since there is a need to track each player's position in an homogenous way, I'm thinking about dividing the world map into indexed subparts (thus integers), and then precisely position the player using a float or double.
This would look like this:
struct position_on_earth
{
int sector_x, sector_y;
float pos_x; pos_y;
};
Is it potentially faster to use this kind of data instead of using double
s ?