Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Synchronizing time between simple python-socket-based server and clients

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.

like image 355
Alex Avatar asked Dec 12 '09 16:12

Alex


People also ask

How does Python connect to server and client?

To use python socket connection, we need to import socket module. Then, sequentially we need to perform some task to establish connection between server and client. We can obtain host address by using socket. gethostname() function.

How do I connect multiple clients to one server in Python?

Connect Multiple Clients in Python We have to create a brand new function and name it multi_threaded_client() ; this connects every client from the various address provided by the server simultaneously. Within the multi_threaded_client function, the connection.


1 Answers

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!

like image 161
Jonas Byström Avatar answered Oct 05 '22 14:10

Jonas Byström