Synchronizing time between simple python-socket-based server and clients
Asked Answered
O

2

7

I have the beginnings of a small multiplayer game that I'm writing in python as a learning exercise. Currently the server runs at 10 fps, while the clients run at whatever rate they like. This works well to conserve bandwidth, but unless the client tells the server when its input happened, all input gets quantized to 100ms intervals. How can I synchronize time between client and server so that I can make these corrections? A major hurdle here is that I'll need to determine ping times and compensate for them.

Oxeyed answered 12/12, 2009 at 16:52 Comment(1)
The answer most other game designers have come up with is that (basically) you're never going to get good synchronization. Big games like wow and kin simulate most of the actions client side, and push updates either direction as it's convenient.Cabriole
C
1

I accidentally came across an excruciatingly fine blog post on how to do distributed network physics in general (without traditional client prediction). I highly recommend it, along with the GDC slides Fiedler presented a couple of years ago. Good luck!

Culberson answered 15/12, 2009 at 2:11 Comment(1)
Thanks, I remember those blog posts from a long time ago when the series was incomplete. The final one on networking is great, and should help a lot!Oxeyed
F
0

This is a very interesting question. Unfortunately there's no easy answer. You just have to understnad the issue well and settle for a solution that is good enough for your application.

My first instinct was that the Network Time Protocol (NTP) for setting machine clocks from NTP servers would have addressed this issue. One of the issues addressed there concerns Jitter Buffers, which involves packet delay variation. This is elaborated in RFC 3393; IP Packet Delay Variation Metric for IP Performance Metrics (IPPM).

Friendly answered 12/12, 2009 at 17:12 Comment(1)
I will look into NTP, that may indeed provide some insight into my situation.Oxeyed

© 2022 - 2024 — McMap. All rights reserved.