GML Networking Tutorials (GMS 2 and 1.4)

matharoo

Tutorial Guy
YYG Staff

Bentley

Member
Excellent tutorial as usual.

I am completely new to networking. I got one game to host but the other can't join. My computer freezes at "network_connect(...)".
Maybe I'm using the wrong port number? I googled "how to get my port number" and used the command prompt and got multiple port numbers. I just picked one.

Me = bad at this stuff.

Any ideas where I'm going wrong?
 

matharoo

Tutorial Guy
YYG Staff
Excellent tutorial as usual.

I am completely new to networking. I got one game to host but the other can't join. My computer freezes at "network_connect(...)".
Maybe I'm using the wrong port number? I googled "how to get my port number" and used the command prompt and got multiple port numbers. I just picked one.

Me = bad at this stuff.

Any ideas where I'm going wrong?
Try port forwarding. But even that isn't guaranteed to work since some ISPs use, uh, weird stuff.

Easiest way to make it work would be to host a dedicated server somewhere and have your players connect to it.
 

curato

Member
Yeah I usually find that if you are doing anything beyond basic internet usage it is best to buy your own modem to avoid issues like that, but you can't assume everyone will do that.
 

Xer0botXer0

Senpai
Excellent tutorial as usual.

I am completely new to networking. I got one game to host but the other can't join. My computer freezes at "network_connect(...)".
Maybe I'm using the wrong port number? I googled "how to get my port number" and used the command prompt and got multiple port numbers. I just picked one.

Me = bad at this stuff.

Any ideas where I'm going wrong?
As far as I'm aware the port number is the same port number you use when you're hosting the server.
Only then if you can't connect do you consider port forwarding.


@matharoo
What is the question mark parameter [? "socket"] ?
 
Last edited:

dadicool

Member
Hello,

Thank you, it helped me a lot! Saw a lot of tutorials for networking but this one was the best for me.

Is someone know a solution to launch a server app made with GMS2 but without graphics? Like a simple command line server.
Thanks!
 

matharoo

Tutorial Guy
YYG Staff
Hello,

Thank you, it helped me a lot! Saw a lot of tutorials for networking but this one was the best for me.

Is someone know a solution to launch a server app made with GMS2 but without graphics? Like a simple command line server.
Thanks!
I don't think that's supported.
 

FrostyCat

Member
DukeSoft has reported some success in running headless: https://forum.yoyogames.com/index.php?threads/servers-question.63296/#post-379665

This is not officially sanctioned functionality, however, so don't whine at the helpdesk or here if anything goes south. People who know enough about multiplayer on GM generally advise against writing public central servers in it, for 3 main reasons:
  1. GML runs single-threaded and scales poorly
  2. GM runner performs hardware checks for 3D support
  3. Networking calls are only responsive once a step during the Network asynchronous event
 
GM Version: GMS2 (also works with 1.4)
Target Platform: ALL
Download:
Part 2: https://www.dropbox.com/s/5cdb5wc0yxtmwwv/networking.yyz?dl=0
Part 3: https://www.dropbox.com/s/1pd9cpydjbsnfoj/networking-two.yyz?dl=0

Summary:
They're three videos, where the first one covers buffers, second one covers server/client connection and third one covers player movement.

Tutorial:

Part 1

Part 2

Part 3
nice tutorials! I really like your content!

but it only covers server/client connection on a local network. correct?
 
I loved it, it just what i needed to a project. As always, very good tutorials!
Do you have any suggestion on where to start reading about hosting or matchmaking? Or did you learn this just using the manual?
 

matharoo

Tutorial Guy
YYG Staff
Do you have any suggestion on where to start reading about hosting or matchmaking? Or did you learn this just using the manual?
There are a lot of resources on the internet, most of them unrelated to GameMaker but the same rules will apply. I usually use Node.js for my servers and TCP for connections.
 

NeutronCat

Member
I loved it, it just what i needed to a project. As always, very good tutorials!
Do you have any suggestion on where to start reading about hosting or matchmaking? Or did you learn this just using the manual?
You can tried GMnet, which includes online lobbys and UDP Hole Punching / NAT traversal.
It's a bit old, but it should work in GMS2. (I have not tried it though)
 
You can tried GMnet, which includes online lobbys and UDP Hole Punching / NAT traversal.
It's a bit old, but it should work in GMS2. (I have not tried it though)
I knew about GMnet, but i thought that it was obsolete for GMS2. I'll give it a look and see if is there anyway to make it functional!
 
Top