Jump to content


Photo

Gmsock Threaded - Highspeed Online Extension


  • Please log in to reply
104 replies to this topic

#1 matthewbot

matthewbot

    The Sockmaster

  • New Member
  • 258 posts

Posted 11 September 2005 - 08:21 PM

GMsock threaded, as you probably know, is an extension for Gamemaker allowing you to utilize sockets. With its combination of raw socket power, with the multi-threaded design, you have a socket library rivaling that which commercial games utilize, in a simpler package.

Since I don't have a help file yet, I'll try to compensate with this FAQ.

Q: What does multi-threaded actually mean?
A: Your computer splits up multiple tasks into independent threads, or segments of code that run simultaneously. That’s why you can be browsing the web at the same time your music player can play music, for example. Two tasks at one time.

Gmsock utilizes the same technique, liberating socket handling code from GMs thread. This leaves GMs thread free to do the important part: Run the game. Previously, a laggy connection meant a laggy framerate. Not any more! Since GMsock threaded runs in a separate thread, the slow network doesn't bog down the actual game.

Q: What’s the difference between TCP and UDP?
A: TCP stands for transmission control protocol. TCP best parallel a phone. You call someone, exchange data (or for your normal folks, chat :(), then hang up. TCP works the same way, by creating a virtual stream between two computers. The problem with TCP is that is tends to be slow. TCP utilizes several methods of insuring data integrity, or in laymen’s terms, making sure your data actually got to the other end. Thing is, most games don't need this. Will it kill you to have a player not in the exact correct place for one frame? Probably not.

UDP, on the other hand, is more akin to the postal system. You mail the letter, and bada-bing, bada-boom, go about your business. There’s no way of knowing if your letter got there, or even if it was corrupted during transit. The advantage is the go about your business part. UDP has a much lower overhead, or the amount of time it takes to actually send data. So UDP is usually the logical choice for high action games.

UDPs downside, however, is that it requires both ends to have a properly configured router and/or firewall, where as on TCP, only the hosting end must have it configured. That’s why most commercial MMORPGs use TCP, but cut corners elsewhere, like click to walk. It only needs to send one packet, where you clicked, so they can live with the overhead of TCP. But high action games like FPSes tend to use UDP, and That’s why they are so finicky about their routers.

Q: I think I found a bug. I'm now going to e-mail you my entire game, all the while spamming your screen name with "iT Don’t W0rK LOL WTF!!1!1!11"
A: *sigh*

Anyway, you can download GMsock Threaded 1.1 (build 521) here, or until my site is up, get it here

Matthewbot (aka, The Sock Master)

Unfortunately, due to time constraints and lack of interest, you can pretty much consider this project over. If I feel like it, I could help/explain a thing or two if you PM me, but I probably won't roll out any new versions, or make a tutorial/help file. You might be better off choosing another network DLL with better documentation that is still under active development.

Edited by matthewbot, 02 January 2006 - 02:06 PM.

  • 0

#2 Meiun

Meiun

    GMC Member

  • New Member
  • 248 posts

Posted 11 September 2005 - 09:58 PM

Very awesome! Gmsock has always been a top notch networking DLL, and this just makes it all the better.

Edited by Meiun, 11 September 2005 - 09:58 PM.

  • 0

#3 GmDude66

GmDude66

    GMC Member

  • New Member
  • 348 posts
  • Version:Unknown

Posted 11 September 2005 - 10:00 PM

Nice! I'll upgrade my game to GMsock 3 now =P.

~Derek~
  • 0

#4 DJ Gman

DJ Gman

    GMC Member

  • New Member
  • 685 posts

Posted 11 September 2005 - 10:55 PM

nice *waiting for explosion of new mmo's* :)
  • 0

#5 Cynical

Cynical

    Inside the Cynic

  • New Member
  • 423 posts

Posted 12 September 2005 - 01:03 AM

Nice work, just as the previous versions. I looked at the source and nearly died :) ...
  • 0

#6 GearGOD

GearGOD

    Deus Verus

  • GMC Member
  • 2153 posts

Posted 12 September 2005 - 01:06 AM

Strange, every MMO ive seen behind the scenes of, was built on top of UDP, and I never had problems with UDP games clientside with routers. Hosts, yes... Clients, no.
Perhaps I am mistaken?
  • 0

#7 Heart_of_VVolverine

Heart_of_VVolverine

    GMC Member

  • New Member
  • 24 posts

Posted 12 September 2005 - 08:56 AM

DUde you RULLE!!!!!!!
i love this!!!
The help file that comes with 2.1c it's awsome... i can see it doesn't come with version 3 anymore :)

Keep up the good work! :) :P
  • 0

#8 matthewbot

matthewbot

    The Sockmaster

  • New Member
  • 258 posts

Posted 12 September 2005 - 11:35 AM

Strange, every MMO ive seen behind the scenes of, was built on top of UDP, and I never had problems with UDP games clientside with routers. Hosts, yes... Clients, no.
Perhaps I am mistaken?

<{POST_SNAPBACK}>

Hmm, I'm not really sure. As far as I know, NAT routers block all UDP packets by default, except for really common things like DNS.

For everyone else, thanks for the replies! I'll try to write a help file if I can find time, but I've been really busy lately. Hopefully in a few days I'll have a more optimized version of it, there are some things I'd like to tweak a bit. I've discovered in some testing that critical sections, a way of keeping threads synchronized, is much faster than using mutex objects. By re-writing GMsock to use them, it could be considerably faster!

Edited by matthewbot, 12 September 2005 - 11:50 AM.

  • 0

#9 Degman

Degman

    There is no spoon

  • New Member
  • 263 posts

Posted 12 September 2005 - 02:05 PM

Strange, every MMO ive seen behind the scenes of, was built on top of UDP, and I never had problems with UDP games clientside with routers. Hosts, yes... Clients, no.
Perhaps I am mistaken?

<{POST_SNAPBACK}>

I'm very confused about this too, as it would seem most action games fundamentally require something as fast as UDP. I don't have a router, hub, switch, or external firewall, so I've never had to deal with those sort of client issues before. I will be getting a wireless router in the next week, so it had better be able to relay UDP :)

Ahhh GMsock..keep up the great work, matthewbot.
  • 0

#10 Bowex

Bowex

    Digital-X

  • New Member
  • 462 posts

Posted 12 September 2005 - 04:28 PM

it's finally done....great.... =))
  • 0

#11 Timmo

Timmo

    GMC Member

  • New Member
  • 558 posts
  • Version:GM:HTML5

Posted 12 September 2005 - 05:59 PM

Is this faster than earier versions?
  • 0

#12 necromancer_productions

necromancer_productions

    GMC Member

  • New Member
  • 124 posts

Posted 12 September 2005 - 06:41 PM

Is this faster than earier versions?

<{POST_SNAPBACK}>


It is.

Shaya...
  • 0

#13 akimaru

akimaru

    GMC Member

  • New Member
  • 135 posts

Posted 12 September 2005 - 07:32 PM

wow this is great... replacing gmsock2 with 3 didn't cause any problems at all
since gmsock threaded is finally finished,
what are you going to do next?
  • 0

#14 arcooke

arcooke

    GMC Member

  • New Member
  • 1055 posts

Posted 12 September 2005 - 08:11 PM

This is great. Definately going to be a hit :)
  • 0

#15 matthewbot

matthewbot

    The Sockmaster

  • New Member
  • 258 posts

Posted 12 September 2005 - 08:53 PM

New version released! GMsock threaded v3.1.0 is now out, and is much faster, having replaced mutexes with critical sections!

Edited by matthewbot, 12 September 2005 - 09:09 PM.

  • 0

#16 Rune Hunter

Rune Hunter

    GMC Member

  • New Member
  • 317 posts

Posted 12 September 2005 - 09:03 PM

I don't see any manual to this? I thought I saw one before but were did it go?
  • 0

#17 matthewbot

matthewbot

    The Sockmaster

  • New Member
  • 258 posts

Posted 12 September 2005 - 09:23 PM

I don't see any manual to this? I thought I saw one before but were did it go?

<{POST_SNAPBACK}>

Well, the old version had a manual. Unfortunatly, I haven't had time to write a new one. Click my name <---, the contact me on any one of my screen names, and I'll show ya the ropes :)
  • 0

#18 Rune Hunter

Rune Hunter

    GMC Member

  • New Member
  • 317 posts

Posted 12 September 2005 - 09:38 PM

Alright, wow a nice and smart person all in one!

I think I have been doing pretty good so far, and so far this actaully works!
  • 0

#19 GmDude66

GmDude66

    GMC Member

  • New Member
  • 348 posts
  • Version:Unknown

Posted 12 September 2005 - 09:40 PM

Upgraded to GMsock 3.1.0.521, he didn't have time to post that he upgraded it so I will do this for him.


Anyways the same link is now download to 3.1.0.521....


Re-download if you want NEWEST version..

~Derek~

Edited by GmDude66, 12 September 2005 - 09:53 PM.

  • 0

#20 Rune Hunter

Rune Hunter

    GMC Member

  • New Member
  • 317 posts

Posted 12 September 2005 - 09:42 PM

EDIT: This bug is in version 3.1 (The newest one)


I also found a bug. Small bug but can cause huge problems.

It is in the sock_message_recive(...) script.


Your script looks like this:

/*identical to mplay_message_receive
first arg:  socket identifier returned by sock_connect or sock_accept
returns:    1 if message received, 0 if not.
*/
if (argument0 == -1)
   return "";
var char;
if (string_pos(chr(10),sock_buf(sock)) == 0)
   return 0;
char = ord(sock_receive(argument0));
if (char < 0)
   return 0;
global._GMSOCK_MESSAGE_ID = char;
global._GMSOCK_MESSAGE_VALUE = sock_token_receive(argument0,chr(10));
return 1;

but this line:

if (string_pos(chr(10),sock_buf(sock)) == 0)

should be:

if (string_pos(chr(10),sock_buf(argument0)) == 0)

were sock was changed to argument0. Than it works after that.

Edited by Rune Hunter, 12 September 2005 - 09:43 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users