Godotsteam: Questions about integrating Steam matchmaking with Godot multiplayer functions.

Created on 12 Dec 2018  路  12Comments  路  Source: Gramps/GodotSteam

It's me again, but this time I'm not bothering you with bugs, instead I'm bothering you with questions ;-)

Now that the lobby functions are working, there's one last step that we don't fully understand. After the player has joined the lobby and knows the Steam ID of the lobby owner, a connection needs to be established using Godot's networking functions. One person told us that the Steam ID could be used like an IP address, so we'd just have to use the Steam ID instead of the other player's IP.
I was skeptical, because don't see how that would work. And apparently it doesn't work.
So how do we have to approach this, so that the players can connect after joining the lobby? I thought that we may need the Steam networking functions to create a P2P Session (https://partner.steamgames.com/doc/api/ISteamNetworking), but it seems this is not implemented in GodotSteam yet. So how do we go about this to make it as painless as possible for our players?

question

Most helpful comment

You may want to check out this issue thread: https://github.com/Gramps/GodotSteam/issues/145. You can also check out @JDare's GodotSteamHL library.

There is a way to use Steamworks lobby with Godot high-level networking API, but it's a little messy. Steamworks relies mostly on Steam ID's for lobbies and servers, not IP address. Godot's high-level networking relies on IP for connection. You essentially have to create a master server list somewhere, have newly created user lobbies generate a Steam lobby ID and pass that over along with their IP address. Then your master server list passes these back to your users looking for lobbies and games. They then use the Steam lobby ID to join the host's Steam lobby, but also retain the IP address for connecting to them through Godot's high-level networking. As I said, it's kind of messy.

After the last two networking classes from Steamworks get ported into GodotSteam, you should be able to do this much easier. If I remember, there are functions to send the server's IP address out for clients to use in connecting.

In my opinion, I would just use all of Steam's P2P functionality unless you plan on making the game accessible outside of Steam, in which case you'll need a hybrid. I personally find it easier to work with than Godot's networking and more feature-rich.

All 12 comments

Hey there! Bugs are always OK too.

It does not work; at least not how you were told. Steam can provide a connection string which is the IP and port. That should be translated in a way that Godot can understand and use.

There are a few ways to do it. I personally have my game ping my server to get the current game version and global stats; it also returns the player's IP address. That is then used to send connection (server) data to Steam to be passed on to other players. I also host my own master server lists, which do the same thing. This, however, might not work for you.

Godot used to, I think, have a way to resolve the player's public IP address. You would need to pass that to Steam. Steamworks also had a way to do it, but I don't quite remember what it was and I think it was depreciated.

Since I am going off memory for some of this, I will look into my notes and respond back with better information. I should also probably write a guide up once we get some of this ironed out!

I am still actively getting the P2P and dedicated server stuff up and running; hope to have it early in January.

Also I believe the Steam P2P stuff would replace the Godot networking stuff. You'd have to use one or the other or some weird combination of the two.

How does Steam provide this "connection string" then?
So far the only solution I see is sending an HTTP request to a server, so the player who acts as the host knows their own public IP and can provide that information to the other players. Steam doesn't seem to have a way to resolve your public IP address, I only see functions that can provide local IP adresses. Steam doesn't seem to be able to provide this either. So that means we either need to run a little server or depend on an external service (like myexternalip.com) that provides the public IP?

Yeah, Steam does not have a way to get the IP address. If I remember, there used to be a function that did a long while back but it usually crashed the engine. I went searching for what I vaguely remembered and turned up nothing.

You can just have Godot do an HTTP query to something like http://icanhazip.com/ or https://www.ipify.org/ and capture the response. Or, like I do, and just have a script that returns it as JSON.

Yes, that's what we're doing for now. Thanks for your help!

Yeah, it is a pain but just how it is currently. I wish the Steamworks function to do it still existed.

I'll make sure to add all this to my networking guide.

By the way, Godot 3.1 can resolve the public IP address via UPnP. But for routers that don't support it, an external service might still be needed as a fallback.

Oh really? That's awesome. It is supposed to have some kind of NAT punching too. Currently I can't get players to match-make together without using port forwarding.

Not sure about nat punch-through, but in Godot 3.1 you can use UPnP to add port mappings, so users who have routers with UPnP support don't have to do this manually.

That's pretty cool too. Yeah, I brought the issue up previously and someone said it was being added in 3.1; however, plans change through-out release cycles so it might have been cut for some reason.

I also wish the font tools would... well... exist. They were way better in Godot 2 than 3. I have seen threads about that but seems none of the developers are on-board with it. If I had more time and know-how, I'd just make the pull requests myself.

Sorry for reviving this issue, but i'm really stuck at this same problem.
Is there any way to use Godot HLAPI with steamworks lobby? Or I need to change my entire networking code to use steam's p2p functions?

You may want to check out this issue thread: https://github.com/Gramps/GodotSteam/issues/145. You can also check out @JDare's GodotSteamHL library.

There is a way to use Steamworks lobby with Godot high-level networking API, but it's a little messy. Steamworks relies mostly on Steam ID's for lobbies and servers, not IP address. Godot's high-level networking relies on IP for connection. You essentially have to create a master server list somewhere, have newly created user lobbies generate a Steam lobby ID and pass that over along with their IP address. Then your master server list passes these back to your users looking for lobbies and games. They then use the Steam lobby ID to join the host's Steam lobby, but also retain the IP address for connecting to them through Godot's high-level networking. As I said, it's kind of messy.

After the last two networking classes from Steamworks get ported into GodotSteam, you should be able to do this much easier. If I remember, there are functions to send the server's IP address out for clients to use in connecting.

In my opinion, I would just use all of Steam's P2P functionality unless you plan on making the game accessible outside of Steam, in which case you'll need a hybrid. I personally find it easier to work with than Godot's networking and more feature-rich.

Was this page helpful?
0 / 5 - 0 ratings