best way to sync player over network
Blitz3D Forums/Blitz3D Programming/best way to sync player over network
| ||
ok put the enemy coordinates to the other computer is easy but how to make the direction ? i mean pointentity player with a pivot solve this problem but now i must send pivot and player coords hmm need a better way and any tipp how often send coordinates ? thx |
| ||
I find sending co-ordinates every 250ms works about best, that might not sound a lot but actually it worked fine for an internet played race sim I knocked up once. I sent position, angle, current mommentums, and current controlkeys being pressed. Being a race game acceleration and braking occurred for extended periods (several seconds of one then the other) so if a player changed their input on either of these actions I immediately sent another packet. Sending the direction can be done by reading the angles off the entity you are sending, entityPitch(), entityYaw() and entityRoll() hold the a/b/c (or x/y/z) angles of an entities rotation. Send the data as a float or convert it to a two-byte integer (word) or better yet compile the whole data packet into a string and send it with writeline / readline |