Processing 2 Maya _ UDP Communication

Simple test on UDP communication between Processing and Maya. The resulting system works quite well and really fast with up to 250 agents, above that limit it slows down a bit, but it still good (I’ve tested it with up to 2000 agents, and it still works, even if quite slow…).

The flocking script is based on Jose Sanchez’s example “flocking_01” for the Plethora library (
The Python script is based on the examples of UDP communication from the Python wiki (

INSTRUCTIONS (Available also in the Processing script)

– open Maya and load the ‘’ file in the script editor.
– check that the ‘IP port’, ‘bufferSize’ fields are the same in the two scripts, and that the ‘numElements’ field in the Python script has the same value that the ‘numParticles’ field in Processing
– define the value of ‘curveStep’, in order to define the resolution of the final trajectory curves.
– run the Processing script and press ‘u’ to start the UDP stream.
– run the Phyton script. It should start to stream the Processing particles into Maya.
– if Maya is giving you a ‘10400 error’, you need to increase the value of ‘bufferSize’ in both the scripts, or you need to check that all the values set above are the same in the two scripts.
– when you want to stop the stream, go to the Processing window and press ‘u’ again.
– in the Maya script editor you should get a message ‘stream stopped’. If this does not happen, try to restart and restop the stream for processing. Do not try to do anything in Maya before getting the message, otherwise the software will crash.
– once stopped the stream, you’ll find in Maya one polyCube object for each Processing particle and a curve describing the particle trajectory.
– if you do not want to have the trajectories curves,comment out all the lines after ‘sock.close()’ in the Python script and run the scripts again.

Link to the files:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s