The Game Creators
The Game Creators Home Online Shop Click to Login
 
DarkBASIC Professional
Order Online
Hands on DB Pro
International Sites
Brazilian DarkBASIC Professional site Brazil
French DarkBASIC Professional site France
German DarkBASIC Professional site Germany
Italian DarkBASIC Professional site Italy
Japanese DarkBASIC Professional site Japan
Newsletter
Issue 82 is out now
The Game Creators Newsletter
Get our free newsletter
Forums
Join thousands of game developers in our forums and read over 1.4 million messages
Free Software
Download a free version of FPS Creator
Twitter
Keep up to date with all the latest events at The Game Creators
Programming
GBN
Game Creator Store
Get Firefox!
DarkNet
DarkNet

DarkNet is a multiplayer plugin specifically designed for use in game development. It uses both UDP and TCP protocol making it suitable for virtually any type of online game ranging from fast paced first person shooters to large scale massively multiplayer online games. It is very easy to use and well documented with several code examples. DarkNet is compatible with Dark Basic Professional, C++ and .NET compatible languages (e.g. C#, VB.NET).

High performance

Throughout development there has been a great deal of focus on maintaining high performance.:

  • Internally DarkNet receiving is multi-threaded in order to make use of all available cores on the system.
  • In addition to this, C++ applications can make use of function pointers, passing them directly to DarkNet (using mnSetFunction). Specified functions will then be executed when data is received.
  • DarkNet code has been heavily optimized meaning that large amounts of data can be quickly transferred making efficient use of available resources.
Ease of use

DarkNet is very easy to use and is useful to programmers of all ability. Basic easy to use commands exist for beginners, whilst more advanced users can make use of additional commands intended to maximize performance (e.g. mnSetFunction). Take a look at a basic example application created in Dark Basic Professional that sets up a server and accepts new connections. Without DarkNet this would take hundreds of lines worth of complex code to create a basic server:


` Start DarkNet
mn Start 1,0

` Start server
mn Start Server 0,50,5,1

` Display information about server
print "Local TCP IP: " + mn Get Local IP TCP(0)
print "Local UDP IP: " + mn Get Local IP UDP(0)
print "Local TCP Port: " + str$(mn Get Local Port TCP(0))
print "Local UDP Port: " + str$(mn Get Local Port UDP(0))
print

do
   ` Check for new clients
   iJoined = mn Client Joined(0)
   if iJoined > 0
      print "A new client joined the server"
    endif

   ` Check for leaving clients
   iLeft = mn Client Left(0)
   if iLeft > 0
      print "A client left the server"
   endif
loop
Asynchronous

All DarkNet commands have a non blocking option so that your application can continue operating whilst a DarkNet operation completes.

This is most useful when connecting to a server. Whilst connecting a handshaking process completes behind the scenes and this can take several seconds on slow connections.

There are two ways of using mnConnect in DarkNet. Note that all other commands that may take several seconds to complete operate in a similar way.

  • Synchronous - mnConnect will not return until the specified timeout length has expired, or the connection has completed.
  • Asynchronous - mnConnect returns straight away and mnPollConnect is used to determine the status of the connection process. mnStopConnect can be used to halt the connection process prematurely.
Error System

DarkNet includes a versatile error system which can be used in a variety of ways. There are 3 error modes available; you can use more than one at the same time. mnToggleErrorMode is used to enable or disable an error mode.

All error modes provide useful information about the error. The following information is provided:

  • The command that caused the error e.g. mnRecvUDP
  • The operation that the command was performing at the time of the error e.g. loading the networking module
  • The line within DarkNet's code that the error occurred at e.g. 730
  • The file within DarkNet's code that the error occurred in e.g. clInstance.cpp
  • The error code of the error e.g. 4300
  • The version of DarkNet in use e.g. v1.1.6
Documentation

Every command in DarkNet is documented fully, as well as this certain concepts such as UDP modes and instances are explained.

All documentation is in HTML format. You can view the documentation online or you can download the documentation in a zip file.

The root of the documentation is DarkNet Help.html.

Stability

DarkNet is extremely secure and designed with an intuitive error reporting system.

By default error message boxes are enabled which means that whenever an error occurs, an error message is displayed which explains the error in full. Optionally you can disable error message boxes and use mnGetError commands which allow you to get information about the error and deal with it yourself.

Packet Encryption / Decryption

Encryption and Decryption of packets is supported which means that sensitive data can be transferred between applications without fear of malicious interception. Advanced Encryption Standard is used to encrypt the packet on the sending end and decrypt the packet on the receiving end.

The example code below (for Dark Basic Professional) shows how easy it is to encrypt and decrypt packets in DarkNet. The packet is encrypted and decrypted and its contents are displayed at each stage:

` Create packet
Packet = mn Create Packet()
mn Set Memory Size Packet, 1024

` Create key to be used when encrypting
` The 4 parameters of mnCreateKey256 act as a password
` Without these values it is impossible to decrypt the packet
Key = mn Create Key 256(1251521,15215215,121512515,151252151)

` Get input
InputData$ as string
Input "Enter data to be encrypted: ",InputData$
print
print


` Load input into packet
mn Add String Packet,InputData$,0,0

` Display packet contents
DisplayContents(Packet,"Original contents: ")

` Encrypt the packet using the key that we created earlier
mn Encrypt Packet,Key

` Display encrypted contents
DisplayContents(Packet,"Encrypted contents: ")

` Decrypt packet using the key that we created earlier
mn Decrypt Packet,Key

` Display decrypted contents
DisplayContents(Packet,"Decrypted contents: ")

print "Press any key to exit..."
wait key
end


` Outputs the contents of Packet with TextData$ prefix
function DisplayContents(Packet as double integer, TextData$ as string)
   ` Move cursor to start of packet
   mn Set Cursor Packet, 0

   ` Return string containing contents of packet
   Contents$ = mn Get String(Packet, mn Get Used Size(Packet), 1)

   ` Write packet contents to screen
   print TextData$
   print Contents$
   print
endfunction

Multiple Instances

DarkNet's instance system allows you to create and control multiple connections. This means that a single application can host and connect to multiple servers at the same time. This dramatically increases the options available to you. Here are some options that this feature opens up to you:

  • Combine a server and client into one application so that a player can host a game (see the cube world advanced demo).
  • Use of peer to peer so that a single user leaving will not cause disconnection of other clients. Using traditional client/host setup, if the host shuts down then all connected clients lose connection.
  • Maintain multiple servers within one application, simplifying administration and improving CPU usage as context switching between applications is reduced.
Broadcasting

DarkNet's broadcasting feature allows applications to transmit data to all devices on a LAN without directly connecting to the devices.

An example use for this is clients generating a list of available local servers. The server broadcasts its availability including its IP and port to all devices on the network. Using the client application, devices can listen for the broadcast and use the information in the broadcast packet to connect to the server.

DNS

DarkNet is able to retrieve IP addresses from domain names. This is especially useful for servers that are hosted on dynamic IP addresses that change from time to time.

NAT Compatibility

Clients who have are behind a NAT (Network Address Translation) enabled router can connect to remote servers and communicate normally using both UDP and TCP protocol.

Non blocking option

DarkNet provides non-blocking (asynchronous) options for commands that would otherwise block for a noticeable length of time. By performing operations in a non blocking manor other things can be done whilst an operation completes.

UPnP

DarkNet includes UPnP (Universal Plug and Play) functionality which allows applications to programmatically create, edit and delete port forwarding entries on a router. This is useful for server hosting and peer to peer applications.

Demos

Included with DarkNet are 16 demo projects containing code in C++, VB.NET, C# and DarkBASIC Pro.

Sound Input

DarkNet includes a set of commands for gathering sound input from input devices e.g. microphone. Multiple input device can be used at the same time.

Input is un-paused using mnUnpauseInput and paused using mnPauseInput. While input is un-paused a stream of data will be received in the form of packets. This data is retrieved using mnGetInputData.

The sound format can be adjusted which changes the quality and size of data received. The format can be set to 3 preset quality levels using mnSetInputFormatLow, mnSetInputFormatMedium or mnSetInputFormatHigh. Alternatively precise format values can be specified using mnSetInputFormat; the following values can be set: Channels, Samples per second (hertz) and Bits per sample.

Sound Output

DarkNet includes a set of commands for sending data to sound output devices such as speakers. Multiple output devices can be used at the same time.

mnPlayData is used to send a packet containing data to be played. Such packets can be retrieved from an input device using DarkNet or can be created by other means e.g. from a file.

The sound format can be adjusted which changes the quality of output. The format can be set to 3 preset quality levels using mnSetOutputFormatLow, mnSetOutputFormatMedium or mnSetOutputFormatHigh. Alternatively precise format values can be specified using mnSetOutputFormat; the following values can be set: Channels, Samples per second (hertz) and Bits per sample.

Windows Firewall

Using DarkNet you can control all aspects of windows firewall which is included with microsoft windows SP2 and later.

Approximately 100 firewall commands exist which are easy to use and powerful allowing you to retrieve and change all windows firewall settings. mnSetFirewallEnabled can be used to enable or disable windows firewall. mnAddApplication can be used to add a firewall exception and allow an application to bypass the firewall.

Order Now

DarkNet

DarkNet multiplayer plugin

  $ Dollar € Euros £ Sterling Click to Buy
Price: $32.99 €23.99 £19.99 Click here to buy

DarkNet is distributed electronically.
You must download this product. Download instructions are sent after purchase.
DarkBASIC Professional 7.3 +, C++ or .NET compatible language (e.g. C#, VB.NET) required. Runs on Windows 2000 / XP / Vista.

Special Offer

Take advantage of this special offer and get all of these packs for a low price of $99 giving you a massive 35% discount. Click here for more information.

DarkBASIC Professional Add-on Pack 2009

DarkBASIC Professional Add-on Pack 2009 - Dark Data, Dark Video, Dark Net, Dark Ink, 2D Plugin Kit and the X Quad Editor

  $ Dollar € Euros £ Sterling Click to Buy
Price: $99.99 €67.99 £59.99 Click here to buy

This product is distributed electronically.
You must download this product. Download instructions are sent after purchase.
DarkBASIC Professional 7.4 + is required to use these add-ons.

Further Information

To view more detailed information about DarkNet please visit the DarkNet developer website.

Send this page by Email Printer Friendly Page Web Site Assistance



Dark Data
A library that gives one the ability to create a database with keyed filing systems, and resuable direct access records Read >
DarkCLOUDS
Creates a live, real-time sky for your DarkBASIC Professional games Read >
Dark Video
A complete movie encoder and decoder solution Read >
DarkNet
Multiplayer library Read >
Green-Ear
Integrated voice and text chat, voice morphing, private channels and more. Read >
Dark Physics
A complete royalty-free physics engine. Read >
Tree Party
Realistic tree system built for real time game renderings Read >
Dark Source
Source code snippet collection Read >
PureGDK
Dark Basic for Pure Basic Read >
Dark Ink
Brand new print library Read >
2D Kit
Extension new 2D commands. Read >
Enhanced Anims
Comprehensive 3D animation DLL. Read >
Dark Shader
Easy and impressive shader creation. Read >
Dark Lights
Fast light mapping system. Read >
Dark A.I.
Pathfinding, teams and zones. Read >
STYX
ActiveX, Flash, XML and much more. Read >
eXtends
Hundreds of exciting new commands. Read >
Unity
LUA scripting support for your games. Read >
EZ Rotate
Easy object and world rotation. Read >
Enhancement Pack
OGG replay, File Blocks, EAX and more. Read >
Texture Max
One model, infinite variations! Read >
Nuclear Glory
A comprehensive collision system. Read >
Pure Plugin
DLL creation system. Read >
Cloth & Particles
3D Cloth & Particles. Read >
Newsletter 82
Read our free monthly newsletter online

10 year anniversary, DarkBASIC Pro FREE, Lee Bamber Interview & loads more!

Subscribe for free:

DB Pro
GBN
Latest Releases

FPSC Model Pack 36
DB Pro Add-on Pack 2009
FPSC Model Pack 35
FPSC Model Pack 34
Dark Data
FPSC Model Pack 33
FPSC Model Pack 32
FPSC Model Pack 31
DB Pro Upgrade 7.4
DarkCLOUDS
Dark Video
Magic Particles
FPS Creator Bonanza

User Gallery
Who (2)
Delphi
VR-arena2 botmania
VR-arena2:botmania
Who
Inside The Horror
Visit our new screen shot Gallery