Jump to content


Photo

Faucet Networking


  • Please log in to reply
397 replies to this topic

#181 nick

nick

    GMC Member

  • GMC Member
  • 24 posts

Posted 31 July 2012 - 09:11 PM

After a quick overview, I notice that this is a simple wrapper for the boost::asio libs. Also, I read your complaints about 39dll. These are mostly due to the limitations of GM and GML. I have written a proper wrapper for 39dll in c# (with a Linux and MACOS port included run on Mono).

The only complaint that I find really valid is the return codes and even those are just -1 for errors. You can use socklasterror() to get the last WSA errror and those are well documented HERE

I will be open-sourcing the the network socket server soon (Im just adding a few last features and Ill be done...) In the meantime, you can get the Linux and Android port of 39dll HERE (I did the heavy lifting and ported it. It works as best as I can tell. Please let me know)
  • 0

#182 MonkD

MonkD

    GMC Member

  • GMC Member
  • 12 posts
  • Version:GM:Studio

Posted 01 August 2012 - 03:14 AM

Does anyone have a copy of the pong example that works with Studio? I'm really new to networking and I'm having a horrid time trying to figure out why things aren't working properly. I fixed the menu issue at the start (that was easy), but now I'm again stuck.

If I choose host I get this error - which makes sense because there's no connection yet:

Spoiler


If I choose join I can enter the local ip and "connect" (it's not actually connecting to anything). Paddle does not move to match mouse x location.

I think the issue is something to do with the opponentSocket and how it is being set in this part of the End Step code, but I'm really not sure:

Spoiler


Any help would be appreciated. Thanks!
  • 0

#183 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 01 August 2012 - 06:22 AM

After a quick overview, I notice that this is a simple wrapper for the boost::asio libs. Also, I read your complaints about 39dll. These are mostly due to the limitations of GM and GML. I have written a proper wrapper for 39dll in c# (with a Linux and MACOS port included run on Mono).

The only complaint that I find really valid is the return codes and even those are just -1 for errors. You can use socklasterror() to get the last WSA errror and those are well documented HERE

I will be open-sourcing the the network socket server soon (Im just adding a few last features and Ill be done...) In the meantime, you can get the Linux and Android port of 39dll HERE (I did the heavy lifting and ported it. It works as best as I can tell. Please let me know)

I'd be interested to see how much GML you need to reliably send bytes over a TCP connection. One of my main problems with 39dll is how complicated it is to do that, as I described here. Also, please link to your own thread so that your extension/dll can be discussed there instead of in this one.
  • 0

#184 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 01 August 2012 - 06:33 AM

Does anyone have a copy of the pong example that works with Studio?

Sorry, I don't have GM Studio myself. It would be interesting to know what causes the errors you describe, but from the error message I think it might be related to using LeftPaddle.y (i.e. using the object id to access a variable of the only instance). I don't know why that would suddenly be a problem in Studio, but it is my best guess.

Please let me know when you find out what the problem is (and also, please tell me about the "menu issue") so everyone can benefit from the fix.
  • 0

#185 MonkD

MonkD

    GMC Member

  • GMC Member
  • 12 posts
  • Version:GM:Studio

Posted 01 August 2012 - 09:23 AM

Please let me know when you find out what the problem is (and also, please tell me about the "menu issue") so everyone can benefit from the fix.


Ah, sorry. The "menu issue" is simply that show_message_ext is obsolete in Studio so you basically have to create the host and connect buttons in another way. Thanks for the tips on the other issue. I'm going to keep hammering at it - I only wish I was more familiar with GMS and networking in general. =) I'll update you if I figure anything out about the other issue.
  • 0

#186 nick

nick

    GMC Member

  • GMC Member
  • 24 posts

Posted 02 August 2012 - 03:41 AM


After a quick overview, I notice that this is a simple wrapper for the boost::asio libs. Also, I read your complaints about 39dll. These are mostly due to the limitations of GM and GML. I have written a proper wrapper for 39dll in c# (with a Linux and MACOS port included run on Mono).

The only complaint that I find really valid is the return codes and even those are just -1 for errors. You can use socklasterror() to get the last WSA errror and those are well documented HERE

I will be open-sourcing the the network socket server soon (Im just adding a few last features and Ill be done...) In the meantime, you can get the Linux and Android port of 39dll HERE (I did the heavy lifting and ported it. It works as best as I can tell. Please let me know)

I'd be interested to see how much GML you need to reliably send bytes over a TCP connection. One of my main problems with 39dll is how complicated it is to do that, as I described here. Also, please link to your own thread so that your extension/dll can be discussed there instead of in this one.



I never said that sending multiple bytes with GML was easy, but GM was never truly designed for multiplayer. And under the covers, Boos::Asio uses winsock/GNU sockets. Networking code at this level is never pretty. Sure you can abstract it somewhat, but you still have to handle a lot of boilerplate...
  • 0

#187 elgreen

elgreen

    GMC Member

  • GMC Member
  • 5 posts
  • Version:Unknown

Posted 04 August 2012 - 01:28 PM

Faucet works with Studio-html or Studio-win?
  • 0

#188 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 04 August 2012 - 01:55 PM

Faucet works with Studio-html or Studio-win?

I do not have GM Studio (of any variety), so unfortunately I can't really tell you. MonkD ran into trouble with the examples in Studio a few days ago (not sure which Studio), but it's not clear yet whether that is due to problems in the examples or because the extension does not work properly.
  • 0

#189 Debels

Debels

    GMC Member

  • GMC Member
  • 2019 posts
  • Version:GM:Studio

Posted 04 August 2012 - 06:15 PM


Faucet works with Studio-html or Studio-win?

I do not have GM Studio (of any variety), so unfortunately I can't really tell you. MonkD ran into trouble with the examples in Studio a few days ago (not sure which Studio), but it's not clear yet whether that is due to problems in the examples or because the extension does not work properly.

Easy, The extension made with Extension Maker won't work on Studios, Since they changed something and now the extension needs to be created in studios with its Extension creator.

PS: At least that's what i think, another option is that Studios broke your dll (in other words can't read/execute it), in other words it won't work on studios unless you change part of your code.
PS 2: I know this because to Luke it already happen with some dll's Like WinAPI 2 and I tried to import a extension i made with extension maker.
  • 0

#190 MonkD

MonkD

    GMC Member

  • GMC Member
  • 12 posts
  • Version:GM:Studio

Posted 07 August 2012 - 04:38 AM

Debels: How does one go about creating the extension? Do we need the original source files or is this something that can be done with only the old extension? Sorry, I'm not even sure where to start figuring out if this is the solution. =)
  • 0

#191 Debels

Debels

    GMC Member

  • GMC Member
  • 2019 posts
  • Version:GM:Studio

Posted 07 August 2012 - 05:34 AM

Debels: How does one go about creating the extension? Do we need the original source files or is this something that can be done with only the old extension? Sorry, I'm not even sure where to start figuring out if this is the solution. =)


I think you need the source code, not really sure, but you can start playing with it in GM:Studios to see if you can make it work.
  • 0

#192 wnsrn3436

wnsrn3436

    GMC Member

  • GMC Member
  • 134 posts
  • Version:GM8

Posted 16 August 2012 - 08:44 AM

Obviously, this is the network library.
However, function at the library limits the ability of the buffer should not be a reason.

In my opinion, this library do not have the extensibility of the buffer.
At the least, you should support the MD5 or SHA hash. :sweat:
  • 0

#193 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 16 August 2012 - 11:09 AM

Obviously, this is the network library.
However, function at the library limits the ability of the buffer should not be a reason.

In my opinion, this library do not have the extensibility of the buffer.
At the least, you should support the MD5 or SHA hash. :sweat:

I had looked into ways of passing data buffers from one extension to another, so md5/zip/other functionality could be separate extensions, but all that came of that was much talk and discussion. That idea might be picked up again, but until then I agree that at least some extra functions could be added. Of course I can't include everything that anyone might need, but a few things like digest functions would probably be useful. I can't promise you when I'll get around to adding them, though.
  • 0

#194 wnsrn3436

wnsrn3436

    GMC Member

  • GMC Member
  • 134 posts
  • Version:GM8

Posted 01 September 2012 - 12:17 AM

Read large files from append_file_to_buffer () function, the error appears. (500MB+)
But, HTTP DLL does not produce an error.

Different buffer structure?

Ps. Can I get dll files or lib files?

Edited by wnsrn3436, 01 September 2012 - 01:17 AM.

  • 0

#195 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 01 September 2012 - 08:47 AM

Read large files from append_file_to_buffer () function, the error appears. (500MB+)
But, HTTP DLL does not produce an error.

Different buffer structure?

Ps. Can I get dll files or lib files?

The problem is expected (see the help file). The file functions were just a quick addition to cover the most common case of reading/writing a small file as a whole, so what you are trying to do is unfortunately not supported yet.

I might finally get some time to work on this again, so if it's important for your game I would be able to look into a solution.

As for a .dll or lib, I can compile that, but unfortunately I didn't put all the functions into a header file yet...
  • 0

#196 legobear154

legobear154

    GMC Member

  • GMC Member
  • 277 posts
  • Version:GM:Studio

Posted 06 September 2012 - 11:57 PM

To anyone having troubles with Faucet Networking in GM Studio. I think I have a solution, I got the pong example working on localhost with GM Studio Free. Add an external name to all of the functions. The external names, as far as I know, are the same as the names of the functions themselves. I did that and It has solved all my problems. I am not able to export the modified extension because of me using the free version of GM Studio, but maybe someone will be able to. I hope this helps anyone that is having issues!

PS: I have not done extensive testing.

Edit: I remade the extension in extension maker with all of the external names added and it appears to work in Studio as well, and if I get medo's permission I will put it up for download :)

Edited by legobear154, 07 September 2012 - 12:14 AM.

  • 1

#197 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 07 September 2012 - 08:45 AM

To anyone having troubles with Faucet Networking in GM Studio. I think I have a solution, I got the pong example working on localhost with GM Studio Free. Add an external name to all of the functions. The external names, as far as I know, are the same as the names of the functions themselves. I did that and It has solved all my problems. I am not able to export the modified extension because of me using the free version of GM Studio, but maybe someone will be able to. I hope this helps anyone that is having issues!

PS: I have not done extensive testing.

Edit: I remade the extension in extension maker with all of the external names added and it appears to work in Studio as well, and if I get medo's permission I will put it up for download :)

Hi Legobear, Thank you for figuring out the problem! You don't really need to ask my permission for putting up your version, it's an open source project (even though I'm the only contributor so far) - just read the license. However, if the fix is that simple I'll just add it to my version right now.

Edit: Make that "later today", I'm updating my C++ development toolchain. Might as well use the latest Boost and mingw while I'm putting out a new version :)

Edit2: Urgh, it really feels like Yoyo are trying to make it as unpleasant for me as possible to provide free added value for THEIR product. I can't run my unit tests on GM Studio Free because it is limited to 10 scripts, and my test program uses 20. I'll have to rely on you guys to test this...

Edited by Medo42, 07 September 2012 - 10:00 AM.

  • 0

#198 legobear154

legobear154

    GMC Member

  • GMC Member
  • 277 posts
  • Version:GM:Studio

Posted 07 September 2012 - 10:32 AM

You are very welcome :) I didn't figure I had to ask for permission but I had seen people get angry before so I try and be safe than sorry. And I am glad it was as simple as that. I may not own GM Studio yet but I am glad to be able to help everyone :) I hope everything in your newest version works for everyone! It sucks that GM Studio free is so limited, but it is what it is I guess. Best if luck to you!
  • 0

#199 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 07 September 2012 - 01:04 PM

Hmm, that delay might turn out to be a bit longer yet. I built Boost and set up mingw 4.7.0 but everything crashes in unexpected places. If I add debug messages to figure out where exactly the problem happens the crashes suddenly disappear, and they also do that when I build with lower optimization settings (-Os instead of -O3)... no idea what is going on there, I have trouble believing that the optimization in 4.7.0 could be broken so badly.

Edit: Going back to 4.6.2 for now, rebuilding boost with that (which will take about an hour again... sigh)

Edited by Medo42, 07 September 2012 - 01:24 PM.

  • 0

#200 Medo42

Medo42

    GMC Member

  • GMC Member
  • 226 posts

Posted 07 September 2012 - 03:14 PM

Here we are:
Faucet Networking v1.4.2 (test)
Also because wnsrn3436 asked about it, here is the DLL, although I don't think it's very useful on its own without some GM scripts or C header files, and I didn't write those yet...

Anyway, this is functionally the same as v1.4.1 (no code changes), but I added the external function names to the .gex description as legobaer suggested, which hopefully makes it work in GM Studio - please test (see below). This is also now compiled against the latest version of Boost, which seems to have made the result a bit smaller and might improve some unknowable things below the covers. And finally, I UPX-compressed the .dll this time for even more space savings, so that the final .gex file is now 268kb instead of 402kb :)

Please take a look at it and see if everything works for you, for example by opening the unittests.gmk example (contained in the download) in your version of Game Maker (Studio) and running it, and posting here whether it works or not. If everything works, you will just see a popup saying "All tests completed". This does not test every aspect of the library, but it's at least some indication that things generally work. I have already tested it successfully with GM8.0 and GM8.1, so if someone can test it with Studio that would be very helpful.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users