-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|432|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs

Created : 01 July 2007
Edited : 02 July 2007

NetF4ktor network library

For Cobra and maybe other languages

As some of you may already know I'm writing a network library.
This will be designed mainly for the use with Cobra. If you got any questions then send them,
I will answer them here in the following FAQ:


June 29th 2007:
Yesterday I decided to do a complete rewrite and I have already given Graham a link so he can show me how to write the includefiles for the library. Unfortunately I made a bad design decision (again). I thought it would be handy to have just one setup function where you can decide wheter your app should be a server or a client. Unfortunately this will cause massive errors when testing your server and client apps because they will share the same functions, etc. at the same time. So I'm on the design document again and I think I the library will consist of 2 DLLs, one for the server and one for the client functions. I'm also thinking about switching the project from PureBasic to BlitzMax because PureBasic DLLs can be a bit instable on a system with multiple CPUs (there are some bugs in the threadsafe library that lead to that instability). I will keep you updated.

June 30th 2007:
I have now decided to go with two DLLs. I think it doesn't matter if you have one DLL or two to give with your program. What I'd really want to see in Cobra is attaching DLLs at compile time and being able to load them from memory like you can do with media at the current time.
Having two DLLs is also good if you don't need server or client functions in your app (like if you're doing a ORPG you wouldn't need to have server functions in the game client; or if you code a dedicated server app this wouldn't need to have client functions). I'm also thinking about new features like allowing the sending of files to patch your game etc.
Also the programmer won't need to read every single message from the network queue. There will be one command that will read all messages from one client or the server and save it into some sort of array or linked list. You can then get those messages by calling a command, you will even be able to search for a certain message.
I'm also planning to cut out TCP functionality alltogether in favour for a UDP based library that will be controlled by the NetF4kor API. So you will get fast AND secure connections (not in terms of cryptography, I still have to think about that because I'd have to create a own cryptography algorithm which would need additional time).

July 2nd 2007:
I have now added cryptography and hash functionality to the lib.
All of this will be done automatically so you will do nothing more than send and get messages over the network.
I have also implemented some kind of key system, that means:

You will set or generate a integer value which will then work as your application-key. When you initialize the networking by calling NFConnect (on the client side) or NFStart (on the server side) you will have to provide this key which will then make sure only [YOUR GAME NAME] clients will be accepted by [YOUR GAME NAME] servers.

The encryption will by different for every client connection and it will change every time you connect to the server. The hash function should provide a very basic and simple defense against mitm-attacks and message manipulation (of course it's not even close to 'bullet proof') but will be mainly useful to make sure the message didn't get corrupted while being transfered.

July 3rd 2007:
Today I realized that I will never finish the network library in time if I build in all the stuff I want. So I decided to do two versions of the library. The one I'm working on oll the time and a second one which will just provide some sort of simple network commands and filesending. I hope to get this done very soon, bugfixing should be easy, too. The current one is a hell of a beaast to debug. There are so much features that the testing drives me nuts And I've just finished the base of the library
But don't be afraid: the "lite" version of the network library will still contain everything you need to create your own multiplayer games! I'm looking at Blitz3D for that to make sure switchers will have an easy life