Image

Imagesciucaro wrote in Imagepython_dev

Not that I can do much with it now, but I'm curious if Pygame and online systems like Twisted or just the plain Socket and Threading modules work hand in hand, to make online graphical games.

Like how would it work? The last time I worked with sockets which was like 2 or so years ago, I was only able to send text back and forth, and that's about all I knew how to make it do, because I don't think it takes anything else other than strings, so that's how I got a text messaging program going...

What kind of information would I need to send to and from the server so that any party connected to the server can share the same game world. Would it be correct if the server held the game and data and did the blitting operations for each player's camera, and then send that blitted surface as a pickled variable to the client and have the client blit that pickled variable to the screen and then update? Or is there another way around?

I remember there were two types, one was called SOCK_STREAM which was like a stream-handling socket for on-the-spot signals like a text message, while SOCK_DATAGRAM (correct?) handled larger chunks of code, like for website HTMLs and thus was slower. I know STREAM would be used to send a signal to the server, probably in a string, but how would I return an entire surface to be displayed on the client right back at runtime.

I'm in the middle of snooping around OpenRTS (which was written in Python) to get an idea of what happens, so I know it can be done, but I thought I'd ask to see how it's done and which way would be easier or proper to work with.

thanks in advance