Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / MikeNet - Multiplayer Plugin

Author
Message
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 15th Apr 2009 16:21
Just thought of two more ways to make this plugin even better.

Request #1
Allow us to attach a packet to the connection command. In all of my games, clients connect to the server, and then once connected send a packet containing their player name, game version, map CRC check, etc. If this info fails the server-side check, it disconnects them. It would be nice if this information could be checked before they enter by attaching the packet with this information directly to the "mn Connect" command ie "mn Connect(Instance, IP, Port, ..., AUTH_PACKET)". My game is currently setup so that clients have 2 seconds after connection to authenticate or it kicks them, which works, but a connection packet would work better. Also, if a user wants to wreak havoc by sending false commands to the server, I prefer to shorten the amount of time for them to do this, and having to wait for them to receive my "d/c Reason" packet before disconnecting them does just the opposite.

Request #2
Add a parameter to mn Disconnect Client: "Reason Code"
If the user fails the check in my games or is kicked for any other reason, I send a packet with the reason they were disconnected, and then disconnect them. The problem with this is that on the client side the connection is tested and if still connected it starts retrieving packets. If I send my reason packet and then immediately disconnect them, they sometimes do not receive that last packet. Something like the following: (Note, I am at work and do not remember the command syntax exactly)



The first few "codes" would be used by MikeNet for legitimate disconnect reasons, and later codes could be custom defined by the game.

Just thoughts. By all means finish Voice Communication before these as it is more important.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 15th Apr 2009 19:00
GIDustin,

I understand your desire for these additions, and actually #2 isn't bad. #1 is easy enough to solve though. Add a variable to your player record on the server. Call it "active" if you want, and when they first connect it's set to 0. In your sending routines for normal gameplay packets, check to see if active is set to 1, if it is then send the packet, if not then it means they aren't ready for the current gameplay data. Once they're logged in and have all the level objects loaded, set it to 1 and they start receiving and interacting with the game in progress.

For packet flooding, add another variable to the player's record. If they send an invalid packet, increment that variable. 10 in a row and you drop them. No need for a reason. If they're flooding, they already know why.

I would rather have a lean and fast network library that just moves the data and lets me decide what to do with it. The smaller and faster the DLL the better. I'd hate to see this wonderful library become slow and bloated with code that many wouldn't need, and others could code themselves for their particular project.

Just my 2 cents.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 15th Apr 2009 20:00 Edited at: 15th Apr 2009 20:01
Quote: "fast network library that just moves the data and lets me decide what to do with it"


I agree, we should code functions like these ourself and let MikeNet do what it does best

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 16th Apr 2009 22:38
I agree with KISTech, I think that request 1 shouldn't be implemented in MikeNet because it is fairly easy to implement using existing commands.

I may look at implementing request 2 because this is more difficult for users to implement using MikeNet. At the moment you would have to send a TCP packet to the client, wait for the client to send a confirmation packet back to confirm that it received the packet, and then disconnect the client.

Thanks for the suggestions

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 17th Apr 2009 04:17 Edited at: 17th Apr 2009 04:22
Wheres the latest update? Im still stuck on 1.02.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 17th Apr 2009 11:34 Edited at: 17th Apr 2009 13:19
You should be able to download v1.1.4 from the order history page as TGC have told me that it is available. My account doesn't have access to it, please could someone else confirm whether or not they are able to download v1.1.4.

[edit]
If you haven't bought DarkNet yet it is available here. Recently MikeNet turned commercial, and was renamed DarkNet; it is being sold in partnership with TGC.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 19th Apr 2009 00:04
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 19th Apr 2009 00:52 Edited at: 19th Apr 2009 01:05
Well since I have bought MikeNet I have seen a good performance increase

I did have some problems though with running a server/connecting on instances that had once existed and now closed, I don't know if its bug or its my code, but I found another way of doing what I wanted to do.

Hows the voice chat going in mikenet? This http://www.speex.org/ and this http://www.portaudio.com/ might help you with it

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 19th Apr 2009 00:58
Its up now. When I downloaded it earlier it was the original release (I know, I click save instead of open). Now its dated 15th of april so I guess that means 1.14. TGC should be quicker with updates. 1.13 was never put up.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 19th Apr 2009 01:31 Edited at: 19th Apr 2009 01:32
Quote: "Its up now. When I downloaded it earlier it was the original release (I know, I click save instead of open). Now its dated 15th of april so I guess that means 1.14. TGC should be quicker with updates. 1.13 was never put up."

You can use mnGetVersion to determine what version is installed.

Quote: "I did have some problems though with running a server/connecting on instances that had once existed and now closed"

I will look into it.

Quote: "Hows the voice chat going in mikenet?"

It is going fairly well , I have finished the core code of the new voice commands. I am using waveform.

Here is some sample code where voice input is gathered and played; as you can see it is nice and simple:


Attached is the exe of this. It works fairly well for me but is not yet fully tested. You will notice that there is a small gap between saying and hearing; this is due to the buffering system which ensures smooth playback. There are several adjustable settings that can lower this gap or improve smoothness.

Attachments

Login to view attachments
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 19th Apr 2009 01:42
Thats pretty cool.

How does it send sound over the internet? That will be difficult without a connection. Or is it just broadcasting over the LAN?

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 19th Apr 2009 01:47
The demo I posted doesn't send anything, it just plays the input.

mnGetInputData puts input data into the specified packet, you can then manipulate this packet and send it as you would with any other packet using mnSend commands. On the receiving end you use mnPlayData to play the contents of the packet. It is best to use TCP because packet loss should be kept to a minimum.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 19th Apr 2009 04:03
Nice, look forward to getting hold of it

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 2nd May 2009 13:46
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd May 2009 12:54 Edited at: 3rd May 2009 13:01
I have added functions that allow you to customize all aspects of sound output and input. You can change the quality, responsiveness and smoothness of sound recording and playback. I've also done some testing and fixed a couple of problems.

Below is some code which demonstrates the above features, and attached is the exe of this code:


As far as sound recording/playback commands are concerned, I need to write commands to select the input/output device to use and then all that is left to do are finishing touches, documentation and some more testing.

For the next version I also want to do the following:
-Exception based error system.
-Memblock support for DBP.
-GIDustin's suggestion of allowing packets to be transferred during the connection process. By the way, I may implement something similar to both your suggestions GIDustin (not just number 2).
-Minor internal changes to DarkNet.

I have less time than usual for the next few weeks/couple months as I am busy with other things. I will do my best to fit as much work on DarkNet in as possible though. I can't give a reliable ETA on the next version, but I will work as fast as I can .

Attachments

Login to view attachments
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 3rd May 2009 13:15
Nice

Can you add something which gets the current volume of the microphone, this way when the volume is over X amount it will automatically start recording/sending

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd May 2009 14:18
Quote: "Can you add something which gets the current volume of the microphone, this way when the volume is over X amount it will automatically start recording/sending"

I will have a go

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 12th May 2009 21:41
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 12th May 2009 22:11 Edited at: 12th May 2009 22:39
I haven't been able to do much work on DarkNet lately. I'm swamped with other work until the 20th of June unfortunately I should be able to finish the next version shortly after that date. When exactly depends on how much time I have.

I have been investigating manipulation of the sound wave stored in the 'Data' packet of the demo code posted previously. I have created a function that changes the volume by a specified percentage. Using a similar method, I can make a function that determines how loud a sound is by looking at the height of sound waves.

I experimented with pitch adjustment, but it is very difficult to do through byte manipulation. Luckily though, it is straightforward to instruct the sound driver to make the adjustment, although not all sound cards support this (mine does not).

[edit]
I did also finish the device selection functions, so you can now select which output and input devices you want to use.

And a while ago I did a tiny bit of work on a website for DarkNet, attached is a screenshot of the layout.

Attachments

Login to view attachments
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 15th May 2009 01:03 Edited at: 15th May 2009 01:04
Hi, I haven't had the time lately to start learning networking lately. Someday I will definetly want to do this. I just wanted to say that I have been an alpha tester for Metaplace for awhile. Now that it's in beta and the NDA is lifted, I wanted to share this idea with all you DarkNet gurus.

Metaplace at http://www.metaplace.com/ is a place that one can create small mmo worlds people can play. At the website, you can directly create 2D/Isometric worlds. But, they have a wiki that explains how you can create your own client. Thus, you could create your own "3D" world. I thought that DBPro and even Dark GDK with DarkNet could be perfect for this.

The client writing and using a network library would take me a while to get right/used to. So, I thought this might spark somebody's interest here. It's FREE to join. I would be glad to try to help anyone who would like to do this if so desired. The major point I like about this is the fact you wont have to worry about finding your own server to host your game(s) on. They provide it. But, Im sure it would cost if you wanted to create big worlds like World of Warcraft or something like that.

If you try the place out, go to the community section and you'll see the wiki. It'll be under the Client & Web Services Portal section. Anyways, it would be cool to see if anybody here is interested in this possibility.



PC Specs: Core2Quad 2.66 GHz, 8 GB RAM, Geforce 9800 GX2, Vista Ultimate 64-bit
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 15th May 2009 05:16
Quote: "-GIDustin's suggestion of allowing packets to be transferred during the connection process. By the way, I may implement something similar to both your suggestions GIDustin (not just number 2).
"


Didn't see this before, but Thanks!!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 15th May 2009 18:42
@ Todd Riggins
I had a look at the Metaplace wiki. Metaplace requires HTTP which DarkNet currently does not support; although this is on my to do list . I couldn't find much information about Metaplace's TCP/IP setup; it is more than likely that DarkNet does things differently (and so they would not be compatible).

To write a client for use with Metaplace I think that you would need to go deep into networking and write your own networking code rather than relying on a 3rd party plugin such as DarkNet. However, DarkNet could be used to create a system similar to Metaplace i.e. instead of using Metaplace, you could create a replica.

In the future I may implement the ability to create unmanaged sockets so that DarkNet simply sends/receives data and manages connections. This would help you in writing a client.

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 15th May 2009 19:54 Edited at: 15th May 2009 19:56
Quote: "Metaplace requires HTTP which DarkNet currently does not support;"


Cant you connect to the server like normal on port 80. Then you can send HTTP packets to it and it will send HTTP packets back?

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 15th May 2009 21:08 Edited at: 15th May 2009 21:14
Hi, thanks for looking into it. Well, when it comes to networking, it feels just like when I first stepped into 3D programming back when. Lots to learn. Anyway, they have a blitzmax example and it also used some "curl" library. This may help to see if this might make it worth it and easier to pursue. Also, this is what I was using to try to get my head around this stuff. It's now considered an old method and will be deprieciated in the next two months as it says. But they do have info on a newer method.

Old method with source code examples:
https://www.metaplace.com/wiki/index.php/Logging_In

Info on the newer method:
https://www.metaplace.com/wiki/index.php/Logging_In_With_Single_Token

PC Specs: Core2Quad 2.66 GHz, 8 GB RAM, Geforce 9800 GX2, Vista Ultimate 64-bit
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 15th May 2009 21:30 Edited at: 15th May 2009 21:34
@ Todd Riggins
Yes, as I suspected they are doing things differently to DarkNet. TCP streams data; this means that if you send two packets one after another they can both be received, or only partially received in one receive operation. So for most purposes a packet scheme needs to be implemented where you ensure the receiving end receives each packet separately once each packet has been fully received. DarkNet does this by putting an unsigned integer at the start of each TCP packet which indicates the length of the rest of the packet. Metaplace seems to do this by putting a character at the end of each packet:


So it looks like DarkNet won't work with Metaplace. If you do plan to code this yourself using another method I would start with something simpler; its hard enough to understand the Metaplace system let alone networking. I will implement unmanaged TCP and UDP sockets where DarkNet will simply send/receive data without doing anything else such as the packet scheme I mentioned earlier. It may be a while (at least one month) before I get round to doing this though as I don't have much time.

kaedroho
No because DarkNet manages the TCP connection, it does two things:
1. Handshaking: The client is sent data during the connection process (even when UDP is disabled).
2. Packet scheme: This is different to the one used by HTTP. It is explained in the first part of this post.

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 15th May 2009 23:50 Edited at: 15th May 2009 23:51
Thanks for at least giving this a look through, Michael. Exactly what kind of info I was looking for. At least the possibility is there, good to know.

PC Specs: Core2Quad 2.66 GHz, 8 GB RAM, Geforce 9800 GX2, Vista Ultimate 64-bit
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 19th May 2009 20:39 Edited at: 19th May 2009 23:12
@ All
I have been working on a demo application to show some of the cool things you can do with the next version of DarkNet and its new sound input and output commands. Attached is this demo, which is near enough complete. Below is a screenshot:


The application takes input data and plays it out of an output device (these can be specified). The input data is then displayed as a sound wave, and its volume shown. The application also demonstrates two techniques which are easily achieved using DarkNet. Firstly you can adjust the volume of sound input and secondly you can fix the volume at a certain level, so if you shout the volume is reduced and if you whisper the volume is increased.

One of the great things about this demo is that the code is reusable. You can easily adjust the volume and sound wave display classes to suite your own needs. Here is a really simple example which uses the sound wave display class to create a small box and update it with sound data:


The display looks like this:


Lastly, here is the full code for the attached demo. It is written in C++ using DarkGDK and uses some fairly complex techniques, so don't worry if you don't understand everything. Object orientated programming is used and is not properly supported by DarkBASIC Pro but I will do my best to convert it over. The code:


Any comments, criticisms or suggestions regarding the demo are appreciated

@ Todd Riggins
If you need any help with networking feel free to email me questions.

Attachments

Login to view attachments
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 19th May 2009 22:30
Nice Now you just need to release it

Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 25th Jun 2009 18:06
Quote: "Hold your breath: I am planning to turn this project commercial with the help of TGC. If all goes to plan, MikeNet will soon no longer be free. Don't worry though, the price will probably be around $20 (hopefully within your budget); this will give you access to all future updates. The next version will be the first version that is not free and so it may take longer to release whilst agreements are finalised with TGC. The name of the plugin may change but the internals will not (e.g. commands will still have a prefix of mn); the new name is currently planned to be DarkNet."


Congratulations you desrve this. I have always asked, this is so good, i don't understand why it's free .
Thank you for your hard work and to make possible for us to make web games so easy (Ultimate Apocalypse will show a video next week or in two weeks, a video with netplay using Darknet). I will buy DarkNet for sure.

I have been out for a while and i'm reading at this moment all update you have been doing. (i'm like in page 11).

Cheers.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 25th Jun 2009 22:26 Edited at: 25th Jun 2009 22:30
Thanks, I guess now would be a good time to mention what new things I've finished so far for the next version.

There is an improved error system. This includes a new exception error mode and a new command mnGetErrorFlag which indicates whether an error has occurred. Both of these make dealing with errors much easier. The following code demonstrates how these can be used:


There are several new packet commands including mnErase, which erases a specified portion of the packet and mnChangeMemorySize which unlike mnSetMemorySize, does not delete the contents of the packet, so you can change the memory size without losing data.

There is a new UDP mode called 'catch all, no out of order', the name gives it away. It is used in exactly the same way as UDP mode 'catch all' except there are no out of order packets. It should perform as well as UDP mode 'catch all'.

There are some new commands to do with TCP and UDP packet stores. When you receive a packet DarkNet puts it in a queue and the mnRecv commands are used to get packets from this queue. If too much is being received the queue can become clogged up and currently the only solution is to disconnect the client. You can now use mnFlushRecvTCP and mnFlushRecvUDP to empty the queue.

mnChangeBufferSizeTCP can be used to change the maximum size of packets that can be received. Similarly, you can use mnSetAutoResizeTCP to ensure DarkNet automatically increases the buffer size if more space is needed. These commands are used on a per client basis which means that you can treat clients differently.

Today I've been working on a new TCP mode, which is compatible with HTTP and other protocols. Instead of a 4 byte prefix indicating the size of the packet, the end of the packet is indicated by a 2 byte postfix. Here is a screenshot of a client requesting data from google:


All this and much more is coming in the next version

Attachments

Login to view attachments
Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 26th Jun 2009 21:23
Quote: "-Packet compression."


Excellent. which means even faster data transmition.
Dragon Knight
17
Years of Service
User Offline
Joined: 10th Jan 2007
Location: Newcastle
Posted: 28th Jun 2009 22:32
Looking forward for more updates on this , i cannot wait til the 16th july, getting out off student halls, and I'll be able to test dark net out properly !

Any success with working with computers behind uni networks? Or looked into any more possible solutions?

^-^, thanks for your time and effort!

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 28th Jun 2009 23:05 Edited at: 28th Jun 2009 23:07
Quote: "Quote: "-Packet compression."

Excellent. which means even faster data transmition."

That will not be in the next version. Here are the major things that will be:
-Voice commands
-New UDP mode, the same as 'catch all' (3) but out of order packets are discarded
-HTTP commands
-Windows firewall commands
-Improved error system, with a command that detects when an error has occurred so that you don't have to check the return value of functions (-1 doesn't always indicate error), exception error mode and the ability to use multiple error modes at the same time.
-Improved performance and some bug fixes
-Option of graceful disconnecting, where TCP data transfer is allowed to complete before the connection closes. This is done using mnShutdownClient and a specific order of function calls, so that your application doesn't have to block while the graceful disconnect process completes.

I have now finished coding almost all of these things, I'm just finishing off firewall commands. After that I need to do lots of documenting, and write some demo code. This will take a while, since there are already 60+ new commands not including windows firewall commands. Good new is, I think I'm on target for release before mid July .

Quote: "Any success with working with computers behind uni networks? Or looked into any more possible solutions? "

UPnP won't work behind a router that doesn't have UPnP enabled. However, I have looked at NAT punch-through and it is possible with the next version. I'm going to try and write some sample code to demonstrate how it is done.

Dragon Knight
17
Years of Service
User Offline
Joined: 10th Jan 2007
Location: Newcastle
Posted: 29th Jun 2009 05:38
Quote: "it is possible with the next version"


YAY!! thank you very much Michael for your time and effort!

Serge Adjo
18
Years of Service
User Offline
Joined: 3rd Aug 2006
Location:
Posted: 13th Jul 2009 20:46 Edited at: 13th Jul 2009 21:12
Thank you Mike, I'll ask for your help if I run into problems. I'd love to see the next version ! Edit: Help files should be improved and sorted by category e.g: packet encryption commands... send commands... receive commands... DBP commands... C++ & .NEt commands...

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 13th Jul 2009 23:28 Edited at: 13th Jul 2009 23:40
I plan to release the next version this Friday, if I fail to do that I will be disappointed with myself

Quote: "Edit: Help files should be improved and sorted by category e.g: packet encryption commands... send commands... receive commands... DBP commands... C++ & .NEt commands... "

Funny you should mention that, I am currently documenting the new commands.

I have greatly improved the layout of the help files. Documentation is split into sub sections and every help file is linked together e.g. every time mnSendTCP is mentioned in any help file, there is a link to it.

Attached is a screenshot showing 3 help files, the top left being the index page.

Attachments

Login to view attachments
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 15th Jul 2009 20:30
Quote: "I plan to release the next version this Friday"


This new version going to contain your NAT and Voice Commands? Can't wait!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 17th Jul 2009 21:45 Edited at: 22nd Jul 2009 15:58
v1.1.5
Against all odds, I have just sent off v1.1.5 so it should become available on Monday.

I have not yet completed a NAT punch-through demo, but it should be possible with the current version.

Moving from v1.1.4 to v1.1.5
This is relatively straightforward. By default, everything is the same as it was in v1.1.4 e.g. graceful disconnect is disabled.

You only have to worry about the following:
-mnGetTCPRecvSize has been renamed mnGetTCPRecvSizeA.
-mnGetErrorCode now returns long long int instead of int.
-mnGetErrorMode now takes an error mode parameter and is used to determine whether an error mode is on or off.
-mnConnect and mnPollConnect can now return -2 indicating that the server rejected the connection request. This normally means the server is full.
-mnSetFunction, the thread ID of function parameters is no longer passed by reference.

General
DarkNet has been optimised and restructured. There isn't much that hasn't improved in efficiency, so hopefully you will notice some kind of performance increase.

The help files have been completely rewritten and are much more useful and easy to use.

There is now alot of new demo code. There are now 19 projects demonstrating various aspects of DarkNet.

There are also several bugs that have been fixed:
- Packet commands may not always display correct error message when there is not enough memory in packet to add or get data.
- Packets may not always have variables such as client ID set properly.
- Server/clients could not continue to transfer data in UDP mode 2 and 1 after 49.7 days of being connected.
- Vulnerability where certain situations could cause the server to display an error message or be unable to receive UDP data.
- mnFinish would not re-enable UDP on the specified instance.
- mnToggleAffinity, mnGetAffinity, mnSetAffinity, mnGetPriority and mnSetPriority were not working.

Improved Error System
You can now have more than one error mode enabled at the same time using mnToggleErrorMode. mnGetErrorMode has changed as a result.

Save error mode has improved so that you don't have to check the return values of commands to determine if an error has occurred. Instead you can use mnGetErrorFlag to determine when an error has occurred. You can use mnSetErrorFlag and mnClearErrorFlag to toggle error state and control what mnGetErrorFlag returns.

A clError (C++) and mnError (.NET) exception class now exists. When exception error mode (new) is enabled DarkNet functions will throw an exception of this type when an error occurs. The exception class is used internally to DarkNet; you now have the option to integrate your applications with the same error system that DarkNet uses. The documentation explains how to do this.

mnGetErrorMode now takes an error mode parameter and is used to determine whether an error mode is on or off.

There is demo code showing how to use the new error system.

Command list:


Packet Commands
Several new commands exist which make DarkNet packets more useful and dynamic.

mnErase can be used to erase a portion of the packet whilst mnInsert can be used to insert space into the packet, which can then be filled with an mnAdd command (e.g. mnAddInt).

A new command mnCreatePacketFromPacket exists which is faster than mnCreatePacket + mnEqualPacket. It has the same result as using those two commands.

There are several new string commands which operate similarly to their packet counterpart: mnCreatePacketFromString, mnComparePacketString, mnEqualPacketString.

mnChangeMemorySize can be used to change the memory size of a packet without wiping its contents (mnSetMemorySize wipes the contents of the packet).

mnAddMemblock and mnGetMemblock have been added for DBP users so that memblocks can be used with packets.

Command list:


Networking Commands
Several new networking commands have been added.

mnFlushRecvUDP and mnFlushRecvTCP can be used to empty the packet queue whilst mnGetTCPStoreAmount and mnGetUDPStoreAmount can be used to determine the number of packets in the queue. Note: packet queue refers to the queue of packets waiting to be received via mnRecvUDP or mnRecvTCP.

mnChangeBufferSizeTCP can be used to change the maximum possible size of an incoming TCP packet whilst the instance is active. This operates on a per client basis. mnGetTCPRecvSizeB exists to retrieve buffer sizes on a per client basis.

mnSetAutoResizeTCP can be used to set no limit on the maximum possible size of incoming TCP packet. The buffer size will increase as necessary. This operates on a per client basis.

mnGetTCPBytes is similar to mnGetTCPPercent except it retrieves the number of bytes worth of partial data (data that does not make up a complete packet).

mnDisableTCPHandshake can be used to disable the TCP handshake process. When this process is disabled DarkNet can communicate with applications not written with DarkNet. mnGetTCPHandshakeEnabled exists to check whether TCP handshake has been disabled.

mnSetTCPMode can be used to change the TCP mode to the new postfix mode which adds specified bytes of data to the end of each packet, and checks for these bytes at the end of incoming data to determine when a complete packet has been received. mnGetTCPMode exists to determine the TCP mode.

mnSetTCPPostfix can be used to set the postfix used with the postfix TCP mode. mnGetTCPPostfix exists to determine what the postfix is.

mnSetTCPMode and mnDisableTCPHandshake make communication via HTTP possible. Demo code exists to demonstrate this.

Graceful disconnecting is now possible using mnShutdownClient, mnEnableGracefulDisconnect and mnGetGracefulDisconnectEnabled. This allows clients to disconnect but data transfer to complete successfully.

mnSetSendTimeout and mnGetSendTimeout exist to protect the server from malicious clients. After the send timeout expires, if a packet has not been sent the client is forcefully dropped. This prevents blocking send operations from blocking permanently.

There is a new UDP mode (4) UM_CATCH_ALL_NO, UDP mode catch all, no out of order which is used in exactly the same way as UDP mode catch all but out of order packets are discarded.

All UDP modes now have procedures to ensure that data transfer can continue forever. Previously UDP modes 1 (per client) and 2 (per client, per operation) would stop working if a client did not disconnect after roughly 49.7 days.

mnDisableNagle and mnGetNagleEnabled can be used to disable the Nagle Algorithm which may improve TCP performance for some applications.

mnConnect and mnPollConnect can now return -2 indicating that the server rejected the connection request. This normally means the server is full.

Command list:


Firewall Commands
Roughly 90 new firewall commands have been added which allow full control over windows firewall.

Command list:


Sound Input/Output Commands
Roughly 50 new sound input/output commands have been added which allow sound data to be input, sent and played. This facilitates voice communication.

Command list:


Attachments

Login to view attachments
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 18th Jul 2009 01:10
Good lord! 90 firewall commands and 50 sound commands? Hopefully they are easy to learn and implement The help files link above doesn't contain tutorials so I shall have to wait for the download to become available. What on earth am I going to do this weekend then?
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 18th Jul 2009 19:54
PLAY!!

feiting shadow
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 19th Jul 2009 08:46
I am not considering buying this... yet. The reason that would sway me would be one thing and only one thing: Chat windows. Can someone guide me to how to make a transparent and movable GUI window to go with network code?

I see many new GUI's which are either closed-source or for C++, and Blue doesn't have transparency. It would really clean up some things for many of my projects if I figured that part out.

Signed
------
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 21st Jul 2009 12:23 Edited at: 21st Jul 2009 12:26
You may be wondering where the new version is. TGC have got back to me today and are going to test it this week. I think my estimate of Monday was a little over optimistic

In the mean time I have uploaded the new demo code, you can use some of this with the current version e.g. UDP modes.

I have also uploaded compiled versions of some of the demo code so you can try them out. README.txt included in the download explains requirements of each.

Quote: "Good lord! 90 firewall commands and 50 sound commands? Hopefully they are easy to learn and implement"

Most applications can do without using all of the commands. They are there to give as much flexibility and functionality to developers as possible.

If you have used the Universal Plug and Play commands you will find using the firewall commands very straightforward because they are used in a similar way.

Quote: "I am not considering buying this... yet. The reason that would sway me would be one thing and only one thing: Chat windows. Can someone guide me to how to make a transparent and movable GUI window to go with network code?

I see many new GUI's which are either closed-source or for C++, and Blue doesn't have transparency. It would really clean up some things for many of my projects if I figured that part out."

If I have time I'll try and write you some code. The networking part is straightforward, you can just use mnSendTCP and mnRecvTCP along with mnAddString and mnGetString.

Attachments

Login to view attachments
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 22nd Jul 2009 15:58 Edited at: 22nd Jul 2009 16:06
v1.1.5 is now available. You can download it from your order history

DBP users should select repair on the installer if they already have a previous version installed. C++ users will have to manually install MikeNetDebug.lib if they want to use DarkNet with 'multi-threaded debug' code generation. For me the install location is: C:/Program Files/Microsoft Visual Studio 9.0/VC/lib.

The price has increased to £19.99, €23.99, $32.99. Note that you can update previous versions for no extra charge.

If you have any comments, problems or questions regarding the update please let me know.

feiting shadow
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 22nd Jul 2009 23:00
Thanks! Though you don't have to code it for me, I'm mostly asking for a reference on how to do it or where I can learn. I did manage to learn Blender, so don't worry about doing the work for me. Omen did it somehow, I could ask him. I'm just unfamiliar with creating add-ons even though Windows code is no problem for me in C++. The gap that bridges them isn't fully understood for me.

feiting

Signed
------
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 23rd Jul 2009 05:03
Thanks for the heads up on the download link working!

Sadly, my router still isnt supported with UPnP. My router does not appear in My Computer, or My Network Places, yet some of my other applications are able to access it anyway.

I am however very happy at the Sound demo. Man, that looks EASY!
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 23rd Jul 2009 06:39 Edited at: 23rd Jul 2009 08:29
Got a small problem with the sound commands. The sound demo compiles and runs just fine, but when I add it to my game it crashes. "An error occurred in mnStartInput ... Invalid Instance ID". I used the same instance as the one I connected to. Is there some special setting to get that work?

Another thing I noticed is the mn Start Output command takes an instance ID as it's first argument, but in the demo the instances you would be giving it are ones above the "mn Start" limit... How does that work? Do we use numbers higher than the ones actually used for actual instances?


EDIT: Maybe I have got this completely backwards. Are Input instances and Net instances even the same thing or are they completely different numbering?

EDIT 2: Redid my code as if the numbering system is nothing the same, and got further than before, but now I have a very vague error message:


EDIT 3: Found my problem. Created "InputPacket" as my, well, input packet, but copied your code so it was trying to use "InputData". Woulda thought the error message would be more like "Not a valid packet" or something.

Now my only problem is the volume. 2 inches from my mic and I sound like I am talking from the other side of my room. 1 inch, and I nearly blow my speakers.

Also, leaving my original post and all edits in-tact for others who may hit the same problems as I did.

Attachments

Login to view attachments
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 23rd Jul 2009 11:19
@ GIDustin
Quote: "Found my problem. Created "InputPacket" as my, well, input packet, but copied your code so it was trying to use "InputData". Woulda thought the error message would be more like "Not a valid packet" or something. "

You will always get that sort of error message if the packet you pass to a DarkNet function is invalid. This is because the value returned by mnCreatePacket is a memory address and so it can be any number. Thus I can't put any useful check on the value to determine if it is actually a packet.

Quote: "EDIT: Maybe I have got this completely backwards. Are Input instances and Net instances even the same thing or are they completely different numbering?"

Yes, there are now 3 types of instances. There are networking instances created by mnStart, and there are sound input and sound output instances created by mnStartSound.

Quote: "Now my only problem is the volume. 2 inches from my mic and I sound like I am talking from the other side of my room. 1 inch, and I nearly blow my speakers."

You can adjust the volume using mnSetHardwareVolume and/or mnSetDataVolume. You can also adjust sound settings on windows.

@ feiting shadow
Quote: "Though you don't have to code it for me, I'm mostly asking for a reference on how to do it or where I can learn."

Here is how I would do it:

Create an array of strings, lets say 4 elements, 2 (small numbers to make explanation easier) of which will be visible at any one time.

When a new chat message is received you add it to the array at the top and end up with this:
0: -
1: -
2: -
3: -
4: -
5: "new message"

We now have more messages stored than we want, so we remove the bottom one (0), our new message is now stored in element 4.
0: -
1: -
2: -
3: -
4: "new message"

By default only the last 2 messages are visible to our user. So we can create a scroll bar so that the user can see old messages. When scrolling up we move the first element to view down to a lower element.

Its important to have a maximum on the number of old messages stored. If there is no maximum then our application will eventually consume too much memory and crash.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 24th Jul 2009 00:39 Edited at: 24th Jul 2009 00:40
The sound commands are great I have yet to look at the others still.

Just a quick note, if you try to include mikenet.h after including darkgdk.h you will get a bunch of errors. As it trys to include winsock twice. However if you include mikenet.h first then the program compiles as normal.

Works:



Fail:



Thanks,
Alex

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 24th Jul 2009 21:25 Edited at: 24th Jul 2009 21:28
@feiting shadow,

While my chat window isn't movable, it is transparent, and can change size when the user wants to see something he missed.

It basically starts with an image that is whatever you want the color of the chat window to be. Then set the alpha channel of the image to whatever value you require.

I used the PASTE IMAGE command, and track the Y position in a variable. If the user presses the ` key, the Y value is changed to Hidden (1+screen height), Normal (screen height-200), Large (screen height-500)

I set up an array such as Chat(50) as string, and use this code each time something is added to the chat channel.


So when the user has the chat window hidden, you don't have to display any of the chat messages. When they have it set to normal, you start at line 45 (for example).



and if they are viewing the Large window..



You might want to use TEXT X, Y, Msg instead of PRINT so you have more control over the placement of the text. I just used PRINT here for the sake of speed.

So in summary, you'll use PASTE IMAGE ChatImg, 0, ChatPositionY
to set your chat background in place. Then print your chat text over that.

If you wanted to make it movable, you could paste the image to a bitmap, put your text on the bitmap, and then paste the bitmap onto a plane that you have made movable through keyboard commands or with the mouse.

Hope that helps a little.

feiting shadow
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 25th Jul 2009 00:53 Edited at: 25th Jul 2009 00:55
Both of you helped, thanks!

I was planning on using a windows Edit box and altering the properties, but neither of you recommended that. (Also I remember BlueGUI having limitations regarding that, might not now). I might write a chat handler soon using Cloggy's D3DText and KISTech's custom chat window idea. Thanks!

Edit: AlexI, aren't there commands for including things if they aren't included? I remember Andre LaMothe using them in his books years ago. Microsoft killed programming as far as I'm concerned, but some legacy code should have #pragma examples/details to help fix that type of thing.

Signed
------

Login to post a reply

Server time is: 2024-11-22 00:46:08
Your offset time is: 2024-11-22 00:46:08