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
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 19th Oct 2012 13:23
No need for payment - I'll try to get something done by the end of next week, am quite tied up at the moment.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 19th Oct 2012 15:30
Very much appreciated, and yes no rush, take your time, I will owe you one for it nevertheless...

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 11th Dec 2012 16:51 Edited at: 11th Dec 2012 16:56
Hi all!

I have just finished and sent v2.0.2 off to TGC! This release includes a number of bug fixes and change requests which have built up over the last few months.

64 bit
Finally 64 bit is now fully tested and supported! .NET, DLL and C++ users can make use of this .

Visual Studio 2012
Support for visual studio 2012 has been added and MikeNet has been fully tested using it.

Demo code
Demo code has finally been completed; before now most demo code from v1 was not transferred.

For C# and C++ users all of the projects are in one solution which is much neater. Also, the project comes ready to compile in debug and release mode, as well as 32 bit and 64 bit.

You can download the demo code here.

Here is a nice screenshot:


TCP_RAW TCP Mode
For a long time now people have been complaining about not being able to work with HTTP or other protocols not directly supported by MikeNet.

To solve this I have implemented a raw TCP mode which passes the TCP data straight to your application; MikeNet doesn't parse it at all.

Note that you should make sure you fully understand the TCP protocol before working with it. Of particular importance is the fact that it is a streaming protocol so the notion of packets does not make so much sense. When using TCP_RAW MikeNet packets are streamed, so if you send 10 bytes, you can expect the receiving application to receive between 1 and 10 individual packets, despite only 1 packet being sent. For example, if you send ['hello world'] the receiving end may receive ['he'] ['llo'] [' world']. Your application needs to take this into account.

I have added a demo example in C#, C++ and DBP demonstrating how TCP_RAW can be used to query a web server.

Open Source
I have uploaded MikeNet's source code to github .

Updated Documentation
The documentation has been updated to reflect the new version, and I'm using a newer version of Doxygen to generate the documentation, which is a little prettier.

See it at the usual place:
www.mikenetapi.net

Conclusion
Let me know if you run into any problems, I am freed up over Christmas to fix any problems but get very busy again after that!

Happy holidays!!

Full change list
Bug fixes:
- Fix bug where mnDNS failure can cause errors later on.
- Fix bug where starting threads (threads are started in module initialization and when encryption/decryption first occurs) can cause unexpected errors.
- Fix bug where UPnP module can fail or trigger errors in some circumstances.

Changes:
- Visual studio 2012 support for .NET and C++ users.
- 64 bit support for .NET, C++ (VS 2010/2012) and DLL users.
- Improved demo code.
- TCP_RAW mode to allow direct TCP communication, useful for HTTP. See HTTP Client demo code.

Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2012 17:27
YOU SIR ARE A LEGEND, I SALUTE YOU

Looking forward to give this a go, hopefully have something to show for it in January... btw... do you have a logo specific for me to use in my projects?

I am implementing splash screens in all my projects so I would love to have a logo specific to DarkNet, in high res that I can embed [for projects that make use of it of course ]

GIDustin
15
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 11th Dec 2012 17:34
!!!!!

Looking forward to the release, and thanks a bunch for putting up with all our feedback!
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 11th Dec 2012 17:36
Gratzz! One level up

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 13th Dec 2012 12:04 Edited at: 13th Dec 2012 12:05
@ MrValentine
I've lost the high resolution copies I had, but you can use these:

You can use:


or



MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Dec 2012 12:28
Super thank you Michael!

I suppose if I am using C++/C#.NET I would be using MikeNet ^^ and DarkNet for DBP projects ^^

Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 19th Dec 2012 12:26
I'm going to refer to it as MikeNet, mainly because DarkNet sounds either A. Evil or B. Related to DarkBasic. MikeNet has a cool ring to it :3

I've been using this api for more than just my DarkGDK games, it has been awesome!

I plan on getting the multiplayer portion of my game working here in a few weeks

Ventures of the worlds around us are limited only by our imagination.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 20th Dec 2012 15:28
It has been nearly ten days... the wait is killing me!!!!!!!

Any news of progress? been sat here at my shop checking my products list every three hours... for the past week

I am desperate to get into network programming and with your added help I hope to make my next game multiplayer and network based...

Any chance you could check up on the progress?

Thanks and Seasons Greetings Buddy!

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 20th Dec 2012 15:49
I have sent you an email.

Regarding TGC, they are quite slow with updates usually, and given its Christmas delay can be expected.

For those waiting, drop them an email and I'm sure they will prioritize it

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 20th Dec 2012 16:25
Thank you!

Replied!

JohnFT
13
Years of Service
User Offline
Joined: 6th Apr 2011
Location:
Posted: 27th Dec 2012 19:50 Edited at: 27th Dec 2012 19:51
I have sent an email to TGC, and they said they would post it globally has soon as they receive the update from the author?
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 27th Dec 2012 21:51
mmm well they do have it, I will remind them!

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 15th Jan 2013 19:56
The update has now been released by TGC - enjoy!

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Jan 2013 03:50
Thanks Mike; nice to also get some new code examples. Looking at the HTTP client example now.

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Jan 2013 07:43
Excuse my double post...

Any ideas why I get these warnings in VS 2008 after adding references to either of the libraries:
Quote: "Warning 1 The referenced component 'MikeNet' could not be found.
Warning 2 The referenced component 'MikeNet64' could not be found."


I checked the .DLL file locations and the reference paths are valid.

Quote: "C:\program files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\MikeNet.dll"


I am using VB.NET and had the old MikeNet version installed before installing the new one.

Let me know if you recognize the problem, thanks. Meanwhile I'll look up similar problems on google and MSDN.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 16th Jan 2013 08:18
I still get a lot of errors with the client versions of the demo code apps but the server codes work fine...

DBP

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 16th Jan 2013 16:42
@ Chris Tate
Try removing the DLL and re-adding it to your project. Also make sure it is set to use .NET framework v4.0 and is set to the correct architecture, 32bit or 64bit, for your machine.

@ Mr Valentine
What are the errors?

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 16th Jan 2013 17:10
Give me a bit of time, I will make a video to show what I am doing...

I tried Admin mode too...

I will try to go through everything that I can in the video...

Including VS 2012 stuff and DBP...

The video will be on YouTube but I will make it private and send you the direct link

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Jan 2013 21:24
Oh OK I would have to use VS2010 / VS2012 to use .NET 4. I'll reference it in a dll via VS2010 on my other PC.

Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 23rd Jan 2013 19:18 Edited at: 23rd Jan 2013 19:20
Hey I had these warnings with the last update and again this update.


I have no problem with compiling and it working, but I get this warning whenever I include MikeNet anywhere :\

How would I get rid of this warning without cheating and disabling the the warning?

[edit] I know the last warning is my own

Ventures of the worlds around us are limited only by our imagination.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 23rd Jan 2013 19:48 Edited at: 23rd Jan 2013 19:50
I think visual studio is wrong to give me this warning since there is only one concrete implementation of GetMemorySize, the others are pure virtual.

So it can be safely ignored, unfortunately the only way I know of to get rid of the warning would be to disable it, but I think that's okay .

See the comments section of the MSDN page - the code snippet by jfgaut is essentially what is in MikeNet code.

GIDustin
15
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 30th Jan 2013 03:36 Edited at: 30th Jan 2013 03:36
@Michael:

Your newest version still doesn't address null strings. Not the end of the world or anything, but I though I would point it out in case you get really bored one night and can't think of anything to do.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 30th Jan 2013 20:12
Noted - will do my best to remember for next update!

JohnFT
13
Years of Service
User Offline
Joined: 6th Apr 2011
Location:
Posted: 1st Feb 2013 07:57
Is the Get_Version command still supported in the new 2.0.2 version of MikeNet? I compiled into a PureGDK.dll and used the command in C++. It worked in version 2.0.1, but in this new version, it doesn't display anything (it is a null string). I haven't tried it in DBPro yet...
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 1st Feb 2013 11:39
Of course. Are you using the C++ libraries?

What happens when you run this code:


Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 3rd Mar 2013 17:36
Stupid question perhaps, but is there any tutorial on using this with the C++ classes?
The only C++ example I found still used (mostly) the procedural wrapper functions in the «mn» namespace.

Of course, given enough time one could figure it out from the documentation, but it is always nice to have a hands-on tutorial when starting with a whole new system rather than following crosslink after crosslink in an elaborate documentation...


"Why do programmers get Halloween and Christmas mixed up?"
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd Mar 2013 18:00 Edited at: 3rd Mar 2013 18:15
No not that I know of - funnily enough you are the first to ask for one.

I can point you in the right direction though.

NetInstanceServer, NetInstanceClientand NetInstanceBroadcast are your instances where the lifetime of the object is the lifetime of the instance. These classes are a good starting point.

NetSocketTCP and NetSocketUDP are your basic communication links and actually do the sending/receiving. Instances will use a number of these to transfer data.

NetSockets will use a TCP or UDP mode to describe how data should be sent i.e. how it is formatted and split into chunks. You can use an existing TCP or UDP mode or you can write your own class which extends NetModeUDP or NetModeTCP to take complete control over the socket's data transfer protocol.

The mn namespace is a thin layer so most of the classes should be pretty intuitive to you if you already have experience with the mn namespace.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 3rd Mar 2013 18:29
Michael P - Can you confirm which version of C# MN works with?

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd Mar 2013 18:45
It is built for .NET version 4.0, I tested it using Visual Studio 2010 and 2012.

You have to manually set the CPU configuration to 32 or 64 bit (depending on which DLL you use).

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 3rd Mar 2013 19:03
Thanks... Any future 4.5 support?

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd Mar 2013 19:38
Normally it is just a case of recompiling the source code so I don't see any reason why not. Will look into it for the next release, although it may be a couple of months before then!

If you urgently need it you can download the source and project of MikeNet and build the CLR configuration. That will build for .NET v4.0 but there should be an option to change to v4.5.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 3rd Mar 2013 19:39
Might need it in a month or two no rush

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 3rd Mar 2013 22:07
Quote: "funnily enough you are the first to ask for one."

Haha, is that so.

Anyway, thanks for the pointers, will dig into it tomorrow I guess

Quote: "The mn namespace is a thin layer so most of the classes should be pretty intuitive to you if you already have experience with the mn namespace."

Hm, I did some small tests with it last year if I recall correctly... wonder how much I remember though


"Why do programmers get Halloween and Christmas mixed up?"
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 8th Mar 2013 20:43
Hm, just got a quick test together to try this and it seems I'm having some issues...

NetAddress::SetPort(unsigned short) is defined in NetAddress.h.
However, my compiler claims that no such function declaration exists, instead there is a SetPortW. If one settles for that and reference NetAddress::SetPortW, linker errors arise.
This seems to be caused by SetPort being defined as a macro somewhere in the Windows headers. Because the library file where the definition of SetPort is already defined it doesn't get replaced into SetPortW / SetPortA by the macro and as such the linking fails.
I've tried "#undeffing" SetPort after including Windows.h, but it seems like the culprit header (supposedly winspool.h) is included by MikeNet itself at some point, and since including Windows.h before including that causes conflicts as well I'm currently not sure how to go about solving this issue.
Any ideas?


"Why do programmers get Halloween and Christmas mixed up?"
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 8th Mar 2013 23:13 Edited at: 8th Mar 2013 23:15
Very surprising that I never noticed that before; I have tested and see the same issue as you.

The issue is that in MikeNet code it was silently changing SetPort to SetPortA. Now when you include the headers your compiler options are different and it replaces SetPort with SetPortW but in the MikeNet library it is SetPortA so you get a linker error.

There are several work arounds.

1. You can change Configuration Properties -> General -> Character Set to 'Use Multi-Byte Character Set'.

2. You can avoid using SetPort and set the port during construction like this:


3. If you want to use Unicode character set and want to change the port without creating a new object then you can do this:


which is pretty much what is done by SetPort anyway.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Mar 2013 14:52
Ah, thank you very much, got it working (so far.. ) now.

It isn't directly important but I also noticed that the mn:NS_A/B functions doesn't seem to work well given the string "localhost" - for me they return the address "0:0" when used with a NetInstanceClient, (supposedly the same with a NetInstanceServer as the function isn't made aware of any instance, but that one seems to run fine with it anyway) which causes it to fail with a rather ambiguous exception and a stack trace that cannot be followed further back than a few steps through generic code. It's not a big problem as you can just give it "127.0.0.1:port" manually, but it still struck me as a bit odd.


Again, thanks for your active support


"Why do programmers get Halloween and Christmas mixed up?"
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 9th Mar 2013 15:30 Edited at: 9th Mar 2013 15:34
I am aware of that issue. From Vista onward localhost was changed in the hosts file to 0.0.0.0 instead of 127.0.0.1 by default.

So I think that is a mistake in Windows, not sure what the reason for the change was.

The hosts file is usually here: C:\Windows\System32\drivers\etc\hosts - as far as I am aware this is where localhost will be resolved from.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Mar 2013 23:53
I see. Sounds like a sneaky move on their part but oh well.

Yet another issue came up, my client is getting disconnected after sending an UDP package. The package does get through to the server so I'm not quite sure if the connection is broken by sending it or if the server somehow decides to drop the connection upon receiving it.
I saw a couple of posts here on the forum regarding this issue but none of them had any decent answers (they all looked like the threads died without getting the question resolved). I also remember that I had this issue myself ~2 years back when experimenting with DarkNet in DBP. Somehow I solved it but I can't remember how, maybe someone else does though as it seems it would be a pretty common problem. I'm pretty sure it is something along the lines that I'm doing B before A or similar. Still, I think my code, although object-oriented, should follow the structure of the supplied demo code.


"Why do programmers get Halloween and Christmas mixed up?"
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 10th Mar 2013 00:10
If the client packet isn't in the format expected by the UDP mode then it will be disconnected.

There is documentation on the UDP modes here.

If you get really stuck you can post some code and I will look at it.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 10th Mar 2013 00:35 Edited at: 10th Mar 2013 00:45
Ah, I'll look into it
I didn't think that would be the case since the server receives and interprets the package correctly but maybe it is.

Edit: haha, yeah, turns out I didn't add the client ID to the server's response packet. Working fine now, thanks again.


"Why do programmers get Halloween and Christmas mixed up?"
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 12th Mar 2013 11:18
Lee Bamber has started using MikeNet for a virtual boardroom meeting project: http://software.intel.com/en-us/blogs/2013/03/10/ultimate-coder-challenge-ii-lee-going-perceptual-week-four.

Video in the link is quite interesting.

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 14th Mar 2013 23:00
Go Lee!

It will soon be time to get back to my MikeNet operations. Unfortunately I can't seem to get the latest version to install properly on my Windows 7 system. I am using VB 2010 express on it. (I normally use VB2008 for my game, but this DLL requires .net 4.0)

I try to add the reference, but MikeNet is not in the assembly selection list. When it installs, it says 'Failed to install NET files succesfully', although the other platforms get installed (CPP and DBP); and I am sure my system and VBExpress is in good shape.

Must I install Visual C++ for this to be able to install or something?

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 16th Mar 2013 02:25
I don't think I managed to get the installer working on newer versions of visual studio .NET.

You just need to add the CLR DLL to your project references. You can do this by browsing to it (it won't show up on the assembly selection list since the installer failed).

It will need to be configured for the correct CPU architecture (32 or 64 bit, depending on which DLL you use) and be set to .NET 4.0.

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 17th Mar 2013 23:23
Thanks Mike, it got referenced into the project; I will start using it tomorrow.

Just a little feedback, I think the default install path is the TGC directory, however your installation folders don't get put into a DarkNet/MikeNet folder; so your Project, DBP, CPP folders are in the TGC root folder; not sure if that's what you intended to have happen.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 19th Mar 2013 17:05
Hm, yet another question... how slow is mn::finish(instanceID)?
My program hangs for 10+ seconds whenever calling that. I've traced the slow part to the freeing of the instance pointer, but the debugger looses track there and I won't get further into the internal destructor code.
Is this normal (instances would likely only be free'd at the end of the program so it might not be considered all that bad, but it still seems to take a bit longer than you would expect)?
I can post some code yielding the issue if need be.


"Why do programmers get Halloween and Christmas mixed up?"
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 19th Mar 2013 21:52 Edited at: 19th Mar 2013 22:32
A question from me too; I need to send an image from a server written in .Net to a client written in DBP; would guess that it would be more efficient to send the file in binary and load the image as an image file; or send each pixel as part of a memblock packet? No need to worry if the question is a bit awkward; I can do some tests later on, but you would know better than me.

Edit: Come to think of it, I would assume that saving the binary to file then loading it back again would take longer; but since .NET cannot send the image as a memblock, I'd have to use recursion to load each element into the texture pixel by pixel.

I will have a look at what Lee is doing with video to get some inspiration for images sharing.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 20th Mar 2013 00:19
@ Rudolpho
It will close all the sockets and deallocate resources.

It depends really, if you have huge buffer sizes then deallocating can take a long time, especially on XP and older.

If you have graceful disconnect enabled it can take a bit longer to shut down.

If you create a small source file showing the issue and what conditions are required then I can debug it. I wouldn't expect it to take as long as several seconds in normal circumstances.

@ Chris Tate
The memblock commands in DBP wrap around GetString. So if you want to send binary and have DBP load it into a memblock you can use AddString on the .NET side and GetMemblock on the DBP side. You just have to make sure that the bytes are in the form DBP expects.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 20th Mar 2013 01:34 Edited at: 20th Mar 2013 01:37
Ah, I see. Knowing that I managed to find out that it would seem the time complexity is logarithmic to the maximum number of clients allowed by the server. 10 closes instantly, with 1000 there is a slight delay (maybe 0.5 seconds) and 10 000 (which I had just put in as an arbitrary number) causes it to take ~15 seconds. I can get that cleaning up all the UDP message queues might take a while, but I find it weird that deallocation takes (significantly) longer than the allocation at startup. Now I probably won't ever need 10 000 clients () but it would be interesting to know if this much freeing time is truly a necessity?

Edit: I should also mention that this happens even under the simplest circumstances; in total 4 packets of at most 64 bytes each are send between ONE client and the server, so it wouldn't be that any memory is allocated on an as-needed basis under long extents of time.


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2024-04-19 18:41:23
Your offset time is: 2024-04-19 18:41:23