Any one up for game network coding?

Looks like Pand3D could use some bootstrapping for its publicly available network capabilities and some glue to help people get a network experience up and running. I propose we start working on this. Any one up for some game network coding?

I’m not even sure there is real interest in this What would you all suggest as a starting point and is it even worth the efforts?


I’m doing some network coding write now. The system is working great for me. Recently I changed the structure of the network code by isolating in from other objects, I just made a Network class and filled it with the various functions I needed. Unfortunately the code isn’t ready for release yet-sorry.

Here’s the general overview:

In my program both single and multiplayer play is available so at the start of the program on the title screen the player has the option to play single or multiplayer by pressing Guibuttons that call separate functions setting the ‘multiplayer’ value to True or False. Then with that information the Network class is started or not.

The first thing the network class does is setup the all the connection manager’s, readers, listeners, etc. plus a reading task:

(Thanks to Legion for supplying the basis for lots of this code)

#Loads in the panda connection agents
		self.cManager = QueuedConnectionManager()   #the names (like self.cManager) are arbitrary 
		self.cListener = QueuedConnectionListener(self.cManager, 0) 
		self.cReader = QueuedConnectionReader(self.cManager, 0) 
		self.cWriter = ConnectionWriter(self.cManager,0) 

The above code sets up the panda connection objects. So this means Panda’s ready to receive information but our program has no place to process it yet.

Now we set up a read task: Once a frame this read task will ask if there is any new PyDatagrams that have been received from another computer. If there was a package, it unpacks the package (using cPickle)
The unpacked package is in the form

 info = [MSGID, value1, value2,value3] 

Then the ‘info’ variable is sent to a datagram handler. The idea here is that over the network I’m going to sending various types of information: position and rotation information at one time, but also a text-message from the user other times. So each ‘info’ variable comes with a little MSGID variable inside it. the MSGID tags the information so


I can execute one set of commands than


the Datagram handler (a function in my network class) simply calls the necessary functions based on the MSGID and the other values in the ‘info’ packet. These means that different types of ‘info’ packets with different numbers of values can be sent because the Datagram handler will be expecting the correct number of variables for each MSGID possiblity if you write your code correctly.

You create an ship a package like this-from my text messaging code:

def sendmessage(self, text):
		if self.stage.multiplayer:
			dta = PyDatagram()
			info = [TXTMESSAGE, self.hanger.player+": "+text]
				for Client in self.Clients:
					self.cWriter.send(dta, Client)

and the Datagramhandler will see it like this:

def datagramHandler(self, info, msgID): 
		elif (msgID == TXTMESSAGE):
			text = info[1] 	

[b]One concept that I think you have to understand is that the server and client’s virtual worlds are completely separate entities. The same things will occur in their respective worlds only if you allow for it. So, every major thing that happens has to be packaged into a message- sent over the network- decoded and has to execute some functions to make the same thing happen in computer B than happened in computer A’s world.

For example, everytime there’s an explosion in the server’s computer, the command to make an explosion and the location of that explosion has to be sent to all the clients’ computers where it will tell them to make a new explosion object and where to put it.

mavasher . Thanks for the reply some nice point and suggestions. I should introduce my Self. I work for the Disney’s VR team supporting panda and have done some of the low level work for Python Bindings and OSX drivers and such. I am the main network engineer for server coding here . We have traditionally not released server code for various reasons but are starting to feel this is not the best approach.

I can not spend tuns of effort on this,. I am a terrible Python coder but a pretty good C coder. My documenting skill stink and my spelling lafable. So I need some partners in crime.

Here is what I am thinking.

Should we build a system that support the Panda DC interface with automatic exanimation and such with function level dispatching and network interest culling.
AKA MMP server


Should we build a pier to pier discovery system. With sample server/clients and Master Server …
AKA First Person Shoot Code.


Something else


Nothing at all panda does not need tightly coupled networking ?



I realized, after reviewing your other posts, that you knew a lot more about running networks than I did.

I definately think Panda could use some help with an expansion of the it’s network functions. You’ve listed a lot of options. I think the most useful would be what you labeled First Person Shoot Code. Speed is going to be the issue. What happens in one world has to be communicated across the network to the world of the other computers. The way I’m doing it now in my game-

you can see the source here

is that a task is setup or in the server’s case a few different tasks to communicate the world changes. The issue I’ve discovered is that the nature of the task means that it runs only once a frame. On computers with slower framerates communicating to computers with faster frame rates the network communicated objects move less smoothly than the NPC objects.

Unfortunately I know nothing of C code. I’m not even a good python programmer, my day job is medical student. I just do this to take a break from memorizing.