Archive

Archive for March, 2012

Networking

March 29th, 2012 No comments

The past few weeks have been quite interesting. My Uni has moved ┬áthe campus to a different building, and at some point I did some actual work on assessment items. Primarily a networking item. The goal – produce a networked chat client that uses a 3D engine. Not much is asked, but as someone with no experience whatsoever in networking it was an interesting learning process. Nevertheless I came up with a reasonably stylish chat-client that had an interesting combination of features.

A simple smokey particle engine puffs in the background as the server list greets you at start up. The server look-up is done via a multicast heartbeat packet.

To keep things a bit more interesting than simple text, there’s the very basic client customisation – a username and a text colour!

A simple chat system layout. The messages here are sent via a client list that the server acquires, as well as the various port numbers that are automatically allocated to each client. This allows multiple clients on the same machine, even the one that the server is on.

The server is a simple console client that takes care of the server side of things. Likewise, the client also does a lot of the behind of the scenes work in its own little category and used to be a console as well. Eventually when the strange crashes and weird network situations stopped piling up, I moved onto the graphical interface.

As you may have noticed the above example is done on a local machine, hence the 127.0.0.1 address. It does however work over a local network, although I have not tested it over the internet. In theory it should work fine, as the TTL packet setting is sufficient, and since I’m not using broadcasting but instead multicasting, internet communication is a viable option. Lastly, everything’s done via UDP since UDP is really the way to go when it comes to game networking (even though this isn’t really a game and may well have functioned with TCP)

Not a whole lot of information posted, but at least there’s a few shiny pictures :). I may post the source code at some point. The engine is a custom and somewhat heavily modified version of the latest Ogre build, but only uses Ogre, CEGUI and Winsock 2 in this project.