Networking in Monkey?Monkey Forums/Monkey Beginners/Networking in Monkey?
| Hi all,|
I'm starting a 2D side-scroller MMO, and while I do a lot of programming in my day job, I'm fairly new to game programming.
Monkey X looks very promising in terms of the rendering performance I could expect, but I'm a little worried about the networking side of things, as there's virtually nothing to see on the site except a little bit in the API.
I can take care of the server side of things, but how is Monkey X for the client-side of networking, specifically high-rate unreliable UDP that you'd need for an action MMO? Is that fairly straightforward with the existing platform, or am I basically going to be building it from scratch?
| Unless you're looking for a pre-built game networking engine (Which would usually require a lot of conformity in your own engine), then Monkey gives you the tools you need. Basically, you'd be using 'brl.socket', 'brl.datastream' (Or a similar streaming method), and 'brl.databuffer' for network I/O. You'd need to format your packets as you see fit, following whatever format you want. It's raw data transfer, like any other socket module. Other than raw socket utilities, Monkey provides built-in/standard asynchronous functionality, allowing you to perform networking operations on other threads. For example, a standard 'ReceiveFrom' call would block the current thread until a message was received. Using 'ReceiveFromAsync' and 'IOnReceiveFromComplete', you could do this on another thread managed by 'brl.socket'. Of course, there's a few design quirks to doing this, but it's usually pretty natural for a networking framework.|
What you'd probably want is a way to handle packets how you see fit; but a basic framework to manage them, as well as handle stream management and deployment. For that, you'd want a lower-level solution.
I wrote / am writing this module. That's basically the start of a lower-level networking framework that supports reliable and unreliable messages. It also supports both TCP and UDP, and handles things asynchronously, using 'brl.socket'. That being said, it's not really production ready. Though it works, it's still experimental, and is missing a few features. It also requires some of my other modules (As stated here), meaning it isn't dependency-free. However, if you're interested in building your own networking system, it's not a bad reference on using the API.