Networking code

In my opinion, all components of Panda3D were fantastic, except one: The networking code.

It didn’t seem very well-organized. I didn’t like how in-control the client end of the system was, that it had the authority to create any object at any time.
A hacker could exploit that to flood a server with, say, tripmines (the kind in FPS games) in-game to cheat, so nobody could walk anywhere.
Using an HTTP URL to connect to a server didn’t make much sense, because HTTP has nothing to do with the connection that took place.

As you can see, I didn’t really like the way it was laid out.

I decided to write my own networking code, which has the following changes:

  1. It’s designed to have the server as the ultimate authority.
  2. Uses UDP instead of TCP.
  3. Very simple design. The return value of a function controls whether or not data should propagate.

I have a download of a hastily slapped-together layout of how this may work available here. Don’t expect much yet, however.

Any feedback on this? People willing to document it, test it, expand it, add UDP packet-loss handling, or code to handle when clients choose to disconnect? Anything’s appreciated here. :smiley:

my experience is simmilar. i still work with pandas connection but i set up custom packageing system. including sanity checks for the incomming data, serversided value handling, disconnection detection etc. but since timing is non-critical in my case it might not be what you’r looking for. it’s specialized on handling a huge number of players while keeping trafiic and cpu-usage as low as possible.
if you’r intrested just let me know=)

Well, I kinda liked the panda networking system. I made a simple TCP server with it, but experienced some strange lag issues (which later on turned out to be a bug in my code) and decided to use twisted.
In the end I decided twisted was too big for the simple things I needed done.
No I am using pythons (C’s in fact…) low level BSD UDPsocket interface.

I use pythons “structs” to pack my data (a packet is a sequence of struct data’s)

When all the neccessary network code is done (error handling, out of order, missing packets etc) I might make a little library from it and put it in code snippets

I have been using the network code in asyncore for both UDP and TCP. My performance tests have achieved a sustained 600 packets / sec at a frame rate of 60+ / sec.

The platform is a 2.4 Ghz P4 with an ATI x1300 video card. The testbed was running 30 models of 6000 polys each.

This is a much lighter solution than Twisted.

I use python’s modules socket and asyncore myself. Though there seems to be a panda class called DistributedNode (and co.) which claim to are for easy networking… though no one knows how they work.