Log in

View Full Version : Synchronization math



foxtacles
05-03-2012, 11:18 PM
Maybe you know about the math formula I'm looking for to work on some sync issues. The main problem is the following:

Actual state (information) of position, animation etc. is perfectly synced. However, there is a game lag when applying animation groups on a player, which often leads to situations as illustrated below:

108

(this is the simplest case, there are more problematic ones)

I'm looking for the correct math required to find the mentioned "angle fix", based on the following:

input:

in-game position (X, Y, Z, angles)
destination position (X, Y, Z)
last running animation (and the direction of it)

output:

a Z-angle delta to apply on the current Z-angle, which when running animation is kept, will make the player reach the destination.

Help appreciated. It's some trickery with vectors.

jam
05-04-2012, 01:20 AM
well this is why im never gonna be a good network programmer haha :P, im gonna stick strictly to what i know, but is there someway you could just trigger the animation when the a key is pressed like "walking=true" then just when they let go of the key "walking=0"? or am i completely missing the point (as i said i never program anything to do with networks), because if you could do something like that im sure it wouldnt cause to much lag to pass a single boolean varible

Tomo
05-04-2012, 03:09 AM
Looks interesting. Unfortunately it's 3am and I've been up all night watching local council elections, so I'm a tad too tired to think right now. I'll have a look when I'm a bit more awake.

roby65
06-07-2012, 07:05 PM
I already sent the answer to the mail of Recycler, but i also post there for sharing:

float rotation=(atan2(y1 - y2, x1 - x2)) * 180 / PI;

Maybe the rotation also needs an offset, depending on how the game is implemented