Multiplayer?

I’m experienced in Python and Panda3D, I’ve seen some examples (such as private server source code and small games codes) of multiplayer games but I get confused by Astron and Javascript just doesn’t feel right for me. Where would I start at making a game multiplayer? (I know sockets but not how to distribute the position, actor, and everything.)

The short version: you code it yourself.

Not as short version: If you plan on coding the entire network system yourself then it will be up to you to write the logic for updating positions. You can also use middleware like astron or raknet that handles much of the communication automatically.

Let me use a naive example. Your server is running a bullet simulation with a bouncing ball. The client is “dumb” so its running no simulation code, it just displays what the server tells it.

You have your socket written, then you connect the client to the server. The server should keep a list of all active client sockets.

As you probably know you can use python sockets to send strings messages. What those string messages look like will be up to you but it must be consistent. A simple option is to have a task that runs every frame on the server. In a loop that goes over every socket, construct and send the message “ball1,0,0,0” where ball1 is the name of the ball node, and 0,0,0 is its pos. On the client when it gets a message from the server you can use the split(",") function, separate out the message into its proper components, and the ball position updates on the client.

This is a very simple explanation. If you are interested in more lower level networking I recommend starting with these articles:
gafferongames.com/networking-for … ogrammers/
developer.valvesoftware.com/wik … Networking

As you’ve noticed, there’s more to networking than just the how, but also the when, why conditions!

I have been working on a networking system for Python, aimed towards FPS games, though it is designed for authoritative networking in a general sense.

It’s currently written with BGE bindings, but I’ve been working to ensure that the core game libraries (built upon the lower networking library) can be used with only a few additional panda-specific features added.

There are potentially some bugs in MASTER, but most of the required code is now in place. A few aspects are currently undergoing refactor (like AI systems, which are primitive / stublike in places, and client input handling (which is a rather damaged part of the codebase, as I disabled it carelessly in order to test new changes.

However, those aspects are entirely optional as they are higher level, and you can always extend base types to re-implement such features.

It’s loosely based upon Unreal networking, check the WIKI for information.

Check it out here :slight_smile:
github.com/agoose77/PyAuthServer/