• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Does GMS2 supports Match Making from STEAM?!?

P

psyke

Guest
Hi,

I'm working on the multiplayer for my game, we finished the TCP-IP connection and the multiplayer is already working, but we wanted to go a step further and implement a Match Making system. As the title says, does GMS2 supports that kind of functionality?

I haven't found anything in the manual about that subject.
Thanks!
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I wrote a native extension that allows to set up networking and matchmaking via Steam API. It is currently used in Nidhogg, Ghost Croquet, Take Thy Throne, and few other games.
The extension currently requires some willingness to read the official documentation on principles, but, if you were willing to sponsor the effort, a GameMaker-specific tutorial could be written.
 
P

psyke

Guest
I wrote a native extension that allows to set up networking and matchmaking via Steam API. It is currently used in Nidhogg, Ghost Croquet, Take Thy Throne, and few other games.
The extension currently requires some willingness to read the official documentation on principles, but, if you were willing to sponsor the effort, a GameMaker-specific tutorial could be written.
Hi YellowAfterlife, thanks for the extension link.

Just one question, my game uses TCP-IP to connect the users (we use hamachi to test the game), and the is no separate application for the server (it's universal, works for singleplayer and multiplayer), do you think it's possible to create a lobby using your extension?
Thanks.

EDIT: Also, the extension doesn't seems to work on GMS2?
 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Just one question, my game uses TCP-IP to connect the users (we use hamachi to test the game), and the is no separate application for the server (it's universal, works for singleplayer and multiplayer), do you think it's possible to create a lobby using your extension?
Thanks.
You would usually use Steam P2P with Steam matchmaking, which provides a UDP-like interface (user IDs are used as endpoints) and handles NAT traversal (or relaying) automatically.
Steam offers a separate API for creating lobbies, tagging them, and searching for currently active lobbies (incl. filtering results).
Out of the mentioned games, Nidhogg has automatic matchmaking (connecting to the best-matching lobby or making one if none available) while others have more conventional lists of public games.

EDIT: Also, the extension doesn't seems to work on GMS2?
It does if you import the project and take the converted extension from there,
upload_2017-4-20_2-9-0.png
Keep in mind, however, that the included project in the repository is more of a unit-test (tests that all main functions work correctly), and requires a second game instance to be ran on a separate Steam instance (or otherwise you would have the same ID/endpoint).
 
P

psyke

Guest
You would usually use Steam P2P with Steam matchmaking, which provides a UDP-like interface (user IDs are used as endpoints) and handles NAT traversal (or relaying) automatically.
Steam offers a separate API for creating lobbies, tagging them, and searching for currently active lobbies (incl. filtering results).
Out of the mentioned games, Nidhogg has automatic matchmaking (connecting to the best-matching lobby or making one if none available) while others have more conventional lists of public games.


It does if you import the project and take the converted extension from there,
View attachment 9007
Keep in mind, however, that the included project in the repository is more of a unit-test (tests that all main functions work correctly), and requires a second game instance to be ran on a separate Steam instance (or otherwise you would have the same ID/endpoint).
I managed to get the extension imported on GMS2, I did like you said, imported the project then exported the extension. I can't use the test_ functions for some reason, I guess they don't fit my project (I get lots of errors).
About the P2P stuff, I wrote everything in my game using the network_send_packet function, do I have to rewrite everything again from scratch using the steam_net_packet_send?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
About the P2P stuff, I wrote everything in my game using the network_send_packet function, do I have to rewrite everything again from scratch using the steam_net_packet_send?
In short - yes, as it's not possible to "augment" a built-in function with an extension to do something else on an occasion.

A simple enough method for existing code would be to make a wrapper script that calls one or the other depending on global variable state. For example, you can use steam_id_ functions to split the ID into two 32-bit values to use one as IP and other as port for game logic purposes. Then you'd Ctrl+Shift+F the references to network_send_packet & co and replace them with calls to your scripts instead.
 
P

psyke

Guest
In short - yes, as it's not possible to "augment" a built-in function with an extension to do something else on an occasion.

A simple enough method for existing code would be to make a wrapper script that calls one or the other depending on global variable state. For example, you can use steam_id_ functions to split the ID into two 32-bit values to use one as IP and other as port for game logic purposes. Then you'd Ctrl+Shift+F the references to network_send_packet & co and replace them with calls to your scripts instead.
Ok, you mean something like this?
steam.jpg
 
P

psyke

Guest
Ideally, group the "Send Packet" part into a separate script, so that you don't have duplicates of that code in every packet handler.
Thanks for the advice! I created a script called SendPacket which handles that part of the script.

I also managed to create and connect to a lobby using 2 computers, but it seems like the Invite system is not working (I'm using the invite overlay function).
When I click to invite a friend, it sends an invitation to the other player but nothing happens for the invited player. Do you know what may be causing the problem?

EDIT: it seems like I'm getting a "lobby_join_requested" asynchronous event type, but how do I get the lobby ID that the user just accepted?
 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
EDIT: it seems like I'm getting a "lobby_join_requested" asynchronous event type, but how do I get the lobby ID that the user just accepted?
The event has lobby_id_high, lobby_id_low, friend_id_high, friend_id_low.

A handy way to view async event fields in general is doing
Code:
show_debug_message(json_encode(async_load));
 
P

psyke

Guest
The event has lobby_id_high, lobby_id_low, friend_id_high, friend_id_low.

A handy way to view async event fields in general is doing
Code:
show_debug_message(json_encode(async_load));
Thanks for the advice, I will use that for future tests.

Sorry to bother you again, but I'm having some problems with the buffer being received.
When I send the buffer, it's size is "3", but when it arrives on the server, the size changes to "5", does the steam_net_packet_send stores any extra information into the buffer??

Thanks for helping me, all your answers have been useful.

EDIT:
Here is the problem I'm facing:

SendKey script:
SendKey.jpg

Packet Receive:
ReceivePacket.jpg

The MsgID is returning 0, when it's supposed to return 201 from the SendKey script. This works with the TCP-IP code (network_send_packet), but doesn't seems to work with steam_net_packet_send.

Any clues?


EDIT 2:

OK I managed to solve my problem by adding this line before reading the buffer:
Code:
buffer_seek(Buffer, buffer_seek_start, 0);
Honestly, I don't know why this is necessary since I didn't needed this line of code when working with TCP-IP connection, but hey, at least it's working now =)
 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Honestly, I don't know why this is necessary since I didn't needed this line of code when working with TCP-IP connection, but hey, at least it's working now =)
With TCP/IP GMS creates a temporary buffer for the networking event, here it is your duty to create or rewind the buffer to store data in (unless you want to accumulate it).
 
D

Devious Oatmeal

Guest
I wrote a native extension that allows to set up networking and matchmaking via Steam API. It is currently used in Nidhogg, Ghost Croquet, Take Thy Throne, and few other games.
The extension currently requires some willingness to read the official documentation on principles, but, if you were willing to sponsor the effort, a GameMaker-specific tutorial could be written.
So, like... I've read and re-read the documentation on the GitHub, but I just can't understand how to even add the dll.
I've never worked with one before, and I am extremely new to file management and navigation. I only learned what a directory was -or how to use one- a few months ago. lol
I tried looking up videos on adding an extension, but all of those videos were too old and used methods that weren't possible with your extension- like a vid that just dragged and dropped an extension into GM2. But that needed a thing in the "releases" section on GitHub, which didn't exist for your extension.

But I just don't understand how to add it. Completely lost there.

Can I just... add the extensions from the sample project via Gamemaker's "Add Existing"? I know that I can since I tested it, and it worked, but I don't know if some stuff was left out or if some sort of complication will pop up.
But it is much MUCH MUCH easier to do it like this since it's very quick -like literally 3 clicks- and makes the whole headache of the stuff above avoidable... for now.
I will want to learn that eventually, but I have yet to see a path to learning it at the moment in a timely manner, and this way, I can get right to the work as fast as possible.
And I am sure I will miss out on some sort of live update or something that updates the extension, but I'd rather just keep an eye on any changes manually to avoid the headache.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
So, like... I've read and re-read the documentation on the GitHub, but I just can't understand how to even add the dll.
I've never worked with one before, and I am extremely new to file management and navigation. I only learned what a directory was -or how to use one- a few months ago. lol
I tried looking up videos on adding an extension, but all of those videos were too old and used methods that weren't possible with your extension- like a vid that just dragged and dropped an extension into GM2. But that needed a thing in the "releases" section on GitHub, which didn't exist for your extension.

But I just don't understand how to add it. Completely lost there.

Can I just... add the extensions from the sample project via Gamemaker's "Add Existing"? I know that I can since I tested it, and it worked, but I don't know if some stuff was left out or if some sort of complication will pop up.
But it is much MUCH MUCH easier to do it like this since it's very quick -like literally 3 clicks- and makes the whole headache of the stuff above avoidable... for now.
I will want to learn that eventually, but I have yet to see a path to learning it at the moment in a timely manner, and this way, I can get right to the work as fast as possible.
And I am sure I will miss out on some sort of live update or something that updates the extension, but I'd rather just keep an eye on any changes manually to avoid the headache.
If using the GitHub version, you will want to compile it yourself - see build instructions in the README; you'll only need to compile Mac/Linux versions if you need them.

I have previously distributed the compiled DLL+DyLib+SO together with the source code, but doing so meant that Mac version would be consistently out of date (as I develop on a Windows computer).
 
D

Devious Oatmeal

Guest
If using the GitHub version, you will want to compile it yourself - see build instructions in the README; you'll only need to compile Mac/Linux versions if you need them.

I have previously distributed the compiled DLL+DyLib+SO together with the source code, but doing so meant that Mac version would be consistently out of date (as I develop on a Windows computer).
I read the build instructions. I use Windows as well, and I am very new to this sort of thing, so I am unfamiliar with a lot of the terms.
Coding and using GML I can do, and have gotten fairly proficient at, but adding the dll is something I haven't learned yet- which is why I was also asking if I could just copy it from the sample project to my own project since everything is already in the sample project; which I only really need the extension for a Windows build.
I also looked online to see if there were tutorials on how to do it, but they either show things I can't do with your supplied stuff on GitHub, the ways they did it were too old, or the videos were from the perspective of making them yourself.

The READ ME only helps if I am already familiar with the terms and processes.
I am not familiar with these particular processes nor am I familiar with the terms, and how to apply them.

I just want to know:
If I copy the extensions from the sample project, into my own project, will there be any issues? Things like outdated code in the sample project, or any possible conflicts?
Essentially, I just right-click in the Asset Browser, use the "Add Existing", and get the extension from the sample project. Quick and easy.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I read the build instructions. I use Windows as well, and I am very new to this sort of thing, so I am unfamiliar with a lot of the terms.
You install Visual Studio (2019 Community Edition as of writing this), you open the project in it, and you click menu:Build➜Build solution - not all too intimidating
1608167056525.png

I just want to know:
If I copy the extensions from the sample project, into my own project, will there be any issues? Things like outdated code in the sample project, or any possible conflicts?
Essentially, I just right-click in the Asset Browser, use the "Add Existing", and get the extension from the sample project. Quick and easy.
Once you've built the DLL and verified that it's sitting in the extension directory, that would be it, yes.
 

Attachments

Padouk

Member
@Devious Oatmeal I'm puzzled by your question.
I mean.. the dll is easy to build really. So i'm assuming you are a game design more than a tool builder.
You are enjoying making games and don't want the technical struggles that's why you chose GMS and you are at the right place.
That's all right man!

The short answer to your question is yes do exactly what you said with the Add Existing... but you shouldn't.... you should use that last dll version.
I hope you understand how Business Critical that very specific dll can become if it stop working and running on a 1.5 years old dll .. you would be running on it's last fumes

I'm not known for my short answers so here comes the longer one

I just want to know:
If I copy the extensions from the sample project, into my own project, will there be any issues? Things like outdated code in the sample project, or any possible conflicts?
Essentially, I just right-click in the Asset Browser, use the "Add Existing", and get the extension from the sample project. Quick and easy.
Yes the way GMS packages their extension they can be carried from one project to another.
For that specific one make sure the .yy, the .gml and the .dll follow proprely with the Add Existing option as mentionned.
- It will be fine for a Proof of Concept.
- It will be fine from Development all the way through UAT
But when it comes for a go-to-production how can you have confidence in a unknown dll built 1.5 years ago?

Valve has reworked their network layer and has already started deprecating part of it.
YellowAfterLife knows it, We know that, .. there are imminent issues pending. That's true for this, it will be true for that later and it will always be the case.
If you plan your game to stay live for 2 years+ on Steam, you need take that little extra step to secure your investment (Time and Material).. Knowing how to get the dll updated is kinda mandatory for this particular one.

No worries! YellowAfterLife got you covered one that one.
His build is throughly tested. He provided code visibility for confidence review and even released on MIT Licence.
When he recommends using the Github version. I can only speak for what I saw, but he is constantly active on github and made some reasonable improvment over the last 1.5 years that you want to benefit.
He's been committed to that dll long enough and enough eyes have seen his code to build trust in it.
I would definitivly not be worried about using the dll he published on itch.io 1.5 years ago.... but to secure your overall investment (Time and Material) and to prevent any business critical issues I would definitivly make sure I know how to get an updated version of the DLL.

Again... to be quite honest.. his dll is easy to build.
Once you download the right SDK version and use Visual Studio adequatly... your are just a few clicks away...

You said it youself... building DLL has a learning curve... and a level of complexity that is not so pleasant to learn for a game designer or web developer with no c++ background what so ever.
If you enjoy making games... stay focused on your games...
My best advice here is: Save your time bud... mandate someone you trust to build it on your behalf. It Shouldn't cost you too much and every penny is welcome this time of year.

What better person to mandate than YellowAfterLife himself? Toss him a few buck I'm sure he'll be pleased to provide you with the latest build including all the new goodies and it will give him juice to continue rolling.
And if he is not available... or if you want to go the cheap way... you are soon to learn why those few pennies would have been well invested in the first place! haha!
 
D

Devious Oatmeal

Guest
You install Visual Studio (2019 Community Edition as of writing this), you open the project in it, and you click menu:Build➜Build solution - not all too intimidating.

Once you've built the DLL and verified that it's sitting in the extension directory, that would be it, yes.
Hate to bug you again. lol
So I was installing Visual Studio and then I was hit with lists of things like "Workloads" and "Components" for Visual Studio. Admittedly, it was pretty intimidating since I don't know what any of this is.
Do I just install the core, or do I install a mix of things in case certain components use different components for your particular DLL?
Do I just install everything?
And I assume that once I download the right components and workloads, I can do what you said and just build it easily?
EDIT: Ok. Found this. I assume 2019 is fine for GM2, and I assume the things I should choose are the same as shown in this link.
BUT, apparently I already have Visual Studio installed?! At least, my "Preferences" shows a path to a Visual Studio.


@Padouk
Yeah. I don't touch anything but GML currently, but I will eventually learn broader languages. But that won't be for a while.
As a newer game developer, I am aware of having to learn this stuff eventually, but that comes with time.
Otherwise, I'd be focusing my attention on not having to rely on a DLL from Yellow, but his stuff will definitely help me along the way; this networking with Steam and some of his other code that I plan on buying.
And I don't mind spending that money. In fact, I plan on donating more money to Yellow when the game makes money; not that it will make a ton of money, but this game is also a learning experience with post-support.

But, the plan was to check for updates manually; and assuming Yellow kept the sample project up to date, I would just download it, then carry over the extension.
Granted, this could possibly cause some issues down the line, but I have been wanting to work on the game and the networking, with the plan being to learn this stuff along the way so I can make progress on the game while also learning more about the DLL stuff- in case I wanted to make my own, have someone make one, get them from other sources, or use more of Yellow's extensions.
 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Do I just install the core, or do I install a mix of things in case certain components use different components for your particular DLL?
Do I just install everything?
And I assume that once I download the right components and workloads, I can do what you said and just build it easily?
EDIT: Ok. Found this. I assume 2019 is fine for GM2, and I assume the things I should choose are the same as shown in this link.
BUT, apparently I already have Visual Studio installed?! At least, my "Preferences" shows a path to a Visual Studio.
C++ desktop development is all you need for this - so, if you have followed the setup guide for using YYC, you should be good to go.

I think this is a slightly more dramatic retelling of events,
  1. The project is open-source because that's what I was originally paid for - unless resorting to various hacks, you cannot use two different versions of Steam API in a game (one being used by DLL and one by GM runtime itself), so it is important that the extension can be re-compiled for the current API version when GM changes target Steam API version.
  2. I have not heard of Valve deprecating anything related to networking/matchmaking APIs and games running the oldest (2015!) version of my extension still work fine. Barely anything ever changes with old versions of Steamworks SDK since there are thousands of games any given version that would not be updated.
  3. Itch example's DLL should be fine to use if you do not need any of the newer functions, though I'd generally recommend building the DLL yourself if you are using GMS2.x - GMS1 uses Steamworks 1.35a while GMS2 uses 1.42.
  4. Extension's current development is a mix of me implementing features because I need them for something, me implementing features because people paid me to do so, and people implementing features themselves and sending a pull request.
    None of these three things warrant updating the example/documentation and thus they don't always cover what's available.
    By the time I do get to updating them, the work has usually piled up - for example, to add the 2.3 test project, I had to update my extension generator tool (GmxGen) first, which was a day of work and testing; right now I need to add support for Windows x64 runtime (which involves updating GmxGen again) and subdivide the project into configurations so that GMS1 and GMS2 versions can be built independently against their respective SDK version - that is also some work.
    With decades of different extensions made, maintenance costs can add up to a lot.
 
D

Devious Oatmeal

Guest
You install Visual Studio (2019 Community Edition as of writing this), you open the project in it, and you click menu:Build➜Build solution - not all too intimidating
View attachment 36426


Once you've built the DLL and verified that it's sitting in the extension directory, that would be it, yes.
Took some time to work on some other stuff because I couldn't figure this out, and life got in the way- but now I am back.

So. I opened the project in Visual Studio (I think... Not sure of which one).
And I just got a bunch of errors.

I know I am missing something here, but what that is, I have no clue. Completely new and confused by this whole process.
But I did exactly what you said above. Opened Visual Studio. Opened a project. Did the Build thing. And then errors.
Do I:
- Extract from "Steamworks SDK" ZIP folders and have it be alone, change the data inside (To match my game), then do what you said?
- Use the "Steamworks SDK" folder in my own game already, and do what you said?
- Extract the "Steamworks SDK" and change nothing, then do what you said?
- Not make a whole new SDK and just open the project and Build it?
- Put a second SDK in my project to Build with? (Pretty sure not this, but I honestly don't know)
- Make a new Gamemaker Project and open it with Visual Studio. then Build?
- Copy the Visual Studio Project into my game's files, THEN open it?
- Change something inside the Visual Studio Project?


 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Do I:
- Extract from "Steamworks SDK" ZIP folders and have it be alone, change the data inside (To match my game), then do what you said?
- Use the "Steamworks SDK" folder in my own game already, and do what you said?
- Extract the "Steamworks SDK" and change nothing, then do what you said?
- Not make a whole new SDK and just open the project and Build it?
- Put a second SDK in my project to Build with? (Pretty sure not this, but I honestly don't know)
- Make a new Gamemaker Project and open it with Visual Studio. then Build?
- Copy the Visual Studio Project into my game's files, THEN open it?
- Change something inside the Visual Studio Project?
There are build instructions in the GitHub description:
Create a "Steamworks" directory and place Steamworks SDK there.
You must pick a Steamworks version that matches the recommended version for your version of GameMaker (e.g. 1.42 for GMS2.3 - see helpdesk).
Steamworks' Readme.txt should be located at Steamworks/Readme.txt as result.
So you should be making a directory next to the SLN file.
 
D

Devious Oatmeal

Guest
There are build instructions in the GitHub description:

So you should be making a directory next to the SLN file.
So I got it to initialize. I think...
It says it initialized the .gml, so we will see.

Now, I assume the only real issues I will run into are the actual coding bits, but the documentation for those seems to be really well done.

Also. I think the biggest confusion for me was that the instructions didn't say "where", it just said things like "there" and "here".
Or it didn't specify the "where" in some cases.

Like the line "Create a "Steamworks" directory and place Steamworks SDK there."
I wasn't sure of where the "there" was because the "Usage" section was talking about a different area.
They didn't seem connected, but also kind of sounded like they were since there was nothing saying that the "Building" was different than the "Usage".
Still not sure if they are or not.

So, how I ended up doing it was:
- Downloaded Visual Studio via the instructions you said above about what to do with the options. (Made an account, because you have to do that- might have been because I ran out the trial thing; but it's still free anyways)
- Downloaded the master.zip from the GitHub for the extension.
- Extracted the master.zip to my Desktop. (Didn't seem to matter where, just somewhere)
- Created a new folder in the Extracted master.zip, and named that folder "Steamworks", in the same area as "Steamworks.gml.sln".
- Extracted the SDK I already had from here, and placed it into the "Steamworks" folder I just made. (Didn't need to change anything in the SDK apparently. Just the plain SDK)
- Opened Visual Studio, then selected "Open Project", then selected "Steamworks.gml.sln" in the master.zip.
- Went to "Build" at the top, then "Build Solution". (After having updated Visual Studio for the second time)
- This is where I forget what I did because I failed multiple times to get this all to work.
- If I recall, it made some new files in a folder- might have been the Steamworks folder I made or the .yy.
- I then copied those files (Which had changed because of the "Build" thing I did, and I now had a .dll)
- And then I pasted them into the extensions folder for my game.
- I then added "steam_gml_update();" to the first line of code.
And now it says initialized.

Had I been more experienced with this, it may have been more obvious, but this was a lot to do and it was very confusing at first- still kind of is, but it's initialized now at least.
 
Top