Python socket for multiplayer

Is it possible to use python socket to send a PyDatagram over a network if so how would one go about it

My impression of the builtin networking solutions was that “it just works” and you don’t need sockets. But I didn’t feel like the documentation was detailed enough. So I built my own solution with sockets. And that does work. Was a fair bit of work though.

Could you please share your own solutions because I’m finding it difficult to work with that of panda3d or maybe give me an idea of how I can go about it

Hm, not right now. The basics are pretty simple though. The standard docs are a good starting point. socket — Low-level networking interface — Python 3.12.4 documentation

And then everything you send back and forth has to be string/ bytestring encoded.

For more advanced solutions, I would point to valve’s socket networking library but that’s in C++

I would highly recommend to just mess around with the python sockets for now. Until you get the hang of things.

For now, it is literally as simple as the example things and e.g. sending over a position and applying to an object on the other side of the connection. Everything else needs to be carefully considered.

Okay I see but I wanted to know if it was possible to send a PyDatagram using socket because I went through Evan Todd’s code for A3P and saw that he sent PyDatagram’s using socket, would it work if I just did client.send(PyDatagram ()) or is there something else I need to do

Okay I’ve decided to use python socket but I need to know would it be better if I send the client’s state on key press or to send it repeatedly like once per frame