Multiple Channels for SpiderMonkey

Last week I added the ability for a spider monkey connection to have multiple channels. This is in the main trunk of SVN for any eager early adopters.

Prior to this change, a spider monkey client->server connection would have one TCP connection and one UDP connection. With this change, a server can now add additional TCP channels by calling Server.addChannel( portNumber ). These additional ports are automatically sent to the client as part of connection setup… so clients still only need to know about the one main port.

Many games use multiple channels to send parallel messages back and forth that are not dependent on one another. This can improve performance in some cases since on a single channel one large message can clog the pipe and prevent other messages from getting processed in a timely way. In my game, this happened where terrain data messages were causing other standard traffic to slow down.

I’m trying these changes out in Mythruna right now and everything seems to be working well so far. I’ve moved several message varieties off to their own channels and certain operations feel less “laggy” now.

I made some additional tweaks to SpiderMonkey last night to reduce some of the connection close INFO logging because with four channels there would be a whole mess of INFO logs about a single client disconnecting. Other than that, the changes seem pretty stable and the processing is the same if you don’t add any channels.


cool, can’t say i’ve used multiplayer yet (hopefully in the future), but thanks for the effort :slight_smile:

This should provide a big bump to the feasibility of using SpiderMonkey in projects going beyond the proof of concept level… nice!

Yeah, to me it seems like a minimum requirement for any semi-real time game not using UDP for whatever reason. It just took me a while to get to it. :slight_smile: