Networking - I think I found the ONE

Posted on May 10, 2013

I’ve been trying to setup the networking for Blast2D for the past couple of weeks (on and off). At first, I tried using MasterMind here: https://www.geometrian.com/programming/projects/index.php?project=Mastermind%20Networking%20Library

Unfortunately it’s designed so that the host and the client take turns in sending data. And that’s no good. I need asynchronous UDP with a choice to send reliable or unreliable packets. So then I looked into PyEnet.

https://code.google.com/p/pyenet

Unfortunately, the networking was lagging (occasionally up to 2-5 seconds), as was the case with MasterMind. It was expected to occur with MasterMind as I didn’t use any flow control at the time. PyEnet, however, claimed that it handled flow control internally. Maybe the buffer was the problem. I don’t know. But what I do know is that PyEnet was compiled through Cython and it didn’t feel really natural to use in a Python script. I also had to prowl through the C source code if I wanted to adjust something, so I gave up on it. I also had trouble finding enough documentation. At that moment, I decided to build  my own reliable UDP protocol from scratch using sockets. A day later, I googled “Python reliable UDP” (why hadn’t I thought of looking that up earlier) and found that it had already been done. So, I will try to use legume this time, rewriting the networking a third time. Legume is exactly what I was searching for.

https://code.google.com/p/legume