YAY!! we hopefully got this figured out...
here it is
the 3 algorithms
LOCAL CLIENT ( using keyboard control )
after initialization and first server synchronization
NEEDS average latency ( found during the initialization )
2 structs containing queue ( information is below ) and current bitmask -
1 queue for users predictions and one for
server corrections
queues of a moves struct. struct holds bitmask and time when move starts
EACH FRAME {
get input and put in both queues
send input to server
subtract DT from all values in the queue
if ( next.t > 0 )
apply current bitmask to whole frame( DT )
else {
while ( next.t < 0 ) {
apply current bitmask for dt + next.t
dt = -next.t
current bitmask = next.bm
pop next
}
apply current bm for dt
}
}
when packet in apply Algorithm on new position
SERVER
apply bitmask for dt
send back results
OTHERS ( network controlled players )
when packet in update position apply bitmask
keep last update ( if you recieve a late update ignore it )
id draw a picture explaining all this but that would be quite difficult..
just use your photographic memory
byebye
ANDY