Hot answers tagged location
10
You can use an IP geolocation service to obtain an approximate location from where the user is connecting. Compare this with the GPS data received and you can weed out some extreme cases (players connecting though proxy, etc). You can even calculate distances between user logins and if they are too high (say, the location moved 1000 kms between two login ...
10
There is nothing on the client side which can not be faked, everything somebody has physical access to can be manipulated.
The IP contains routing information and thus hints on the location. But the player just needs a proxy and whoops... the IP hints at a completely different location than the player actually is.
Trust your players, don't give them a ...
3
You are trying to fire an arrow from point a(player) to b(mouse position) in 2d space?
you can simply do the following formula to get the direction. (rather than degree)
v1 = ( Player.x, Player.y );
v2 = ( Mouse.x, Mouse.y );
dir = v2 - v1;
dir.normalize();
arrow.xy += dir * speed;
hope this helps you achive what you want.
3
You cannot truly verify this information any more than you can truly verify any information created by an external source. So what you want is theoretically impossible. But you can probably make it a bit harder to fake.
For example, on Android phones you have various location providers, such as locating a user by the nearby cellphone masts, Wi-Fi position ...
2
This " answer " is to add some visual information to the answers already given.
2: We first create a vector ( 2D in this case with component x and y ) by taking the difference from both positions ( mouse - player ).
3: We then Normalize it to create a so called " unit vector ". Which means to bring the length of our vector to 1. This is done by ...
1
The ratio of the horizontal to the vertical component of the vector is proportional to the ratio of the horizontal and vertical difference in position. The proportion factor is the speed divide by the direct distance (calculated by the pythagorean theorem).
distance.x = target.x - start.x;
distance.y = target.y - start.y;
distance_direct = ...
Only top voted, non community-wiki answers of a minimum length are eligible
