Godotsteam: What is the suggested workflow for creating a multiplayer game with godotsteam?

Created on 11 Jul 2020  路  7Comments  路  Source: Gramps/GodotSteam

I've started prototyping some multiplayer interactions in a project using godotsteam, and after following the lobby tutorials, I'm wondering what what the network workflow for multiplayer games should be.

Godot's multiplayer support makes it seem almost like an idiomatic implementation of steam multiplayer in godot would be done by implementing by a custom PacketPeer, over the Steam P2P networking interface.
Being mostly inexperienced with Steamworks, I'm not even sure how that would fit in with Godot's authoritative client-server model and if steamworks has alternatives to p2p networking.

Is godotsteam designed to require p2p messaing and maual replication? Or is godotsteam designed to facilitate a handshake that leads to a regular godot high-level networking connection (although this would fail if a nat-punch can't be achieved, only a PacketPeer subclass could idiomatically use the p2p relay)? Maybe godotsteam is just not designed for godot's multiplayer, and instead just for achievements and etc?

multiplayer question

Most helpful comment

Updated the lobby/P2P tutorial with the repo from @JDare linked in as well as a brief message and link to Valve's networking section from the SDK documentation. Please let me know if there is anything specific I should add.

This week I'm going to get those last three classes added in and start building a new example project with the newer functions. Afterward it might be a good time to get back to my GodotSteam server branch.

All 7 comments

Hey there. Multiplayer can be handled a few ways; and I will say I am definitely not an expert or even really knowledgeable about networking.

I have tried a combination of Godot's high-level networking and Steam's P2P functions, which didn't work so great. I kind of think it should probably be one or the other, as it makes the whole process a lot easier. That being said, there are still two Networking classes I have yet to implement in GodotSteam, as well as Matchmaking Server. From glancing at them, it appears they will definitely make things a bit easier and could probably allow better integration between Steamworks and Godot's high-level networking. Mostly because the biggest issue I found mixing the two was that Godot's HLN used IP addresses for initial connection and Steamworks used server ID's, which made things difficult. It definitely really made Steam's invite system break.

As far as I know, there is no real way to differentiate between a server or client in Steamworks; you basically have to set that up somehow in your code. I usually have a variable for server or client, which gets set when a player creates a lobby and subsequently set for each player that joins. All their data is sent at lobby join and added to a client list on the server then updated through functions I write and passed with P2P packets. A lot of it is modeled on Godot's setup.

I don't know Steamworks was specifically designed to mix with a different networking framework (like Godot's) but it doesn't appear to really hamper it if you have access to all the Steamworks classes. I think GodotSteam / Steamworks has better lobby functionality, for sure; as well as messaging, since there are specific functions for it.

Once those last three classes are added in, I will probably put together a tutorial based on my understanding at the time as well as a new sample project. I will definitely be using it in my own game to upgrade the current multiplayer I have; which is now just pure Steamworks.

I don't know if that answers all your questions or not but I'm happy to continue figuring it out with you!

You can also check out @JDare's (GodotSteam High-Level Networking repo)[https://github.com/JDare/GodotSteamHL]. It might be useful or point you in the right direction.

From my understanding, GodotSteam is exposing the underlying steamworks SDK which has very little direction in terms of how you architect the networking for your game. As Gramps mentioned they provide both p2p as well as dedicated server support (although I believe that's in Beta right now).

You're correct in assuming you can do either p2p networking yourself or use their relay. The lobby system Steam provides is completely separate from any concept of networking. They include an example of where you group up users in a lobby and then use your own custom P2P networking to actually connect them (which would require punchthrough or a relay etc.).

If you're looking to just connect a handful of players together its probably easiest to use their P2P relay and implement it however you see fit. In a perfect world you could certainly do a deeper integration with Godot's core networking and look at creating a native high level abstraction along the lines of their ENet or WebRTC classes. I briefly investigated that option before rapidly deciding that creating a high level solution in GDScript would probably be _good enough_ and a lot quicker to implement.

If you do want to dive deeper into Steams networking APIs, I strongly recommend their docs at https://partner.steamgames.com/doc/features/multiplayer/networking and https://partner.steamgames.com/doc/api/ISteamNetworking

And finally a shameless plug for GodotSteamHL if you want to see a proof of concept or one way you can architect networking for your game using GodotSteam.

No shame in that.

Thank you there's a lot of useful information here! I think I may eventually consider writing a custom PacketPeer subclass over the steam P2P interface because I like the idea, but I'll definitely table that for now and it indeed sounds non-trivial and probably me doing research will change my mind.

For my particular case which is more prototyping, I think I will try to bootstrap a godot ENet connection via steam lobbies, which is very much not long term. I'll definitely look into GodotSteamHL but I'm using C# so I'm afraid it'll be hard to use since there won't be any type info from the gdscript.

@JDare Haha, no plug is ever shameful. And awesome reply!

Can this issue be closed after adding some comment to the documentation answering this question, maybe referencing GodotSteamHL?

Sure. I had planned on linking in GodotSteamHL as a resource for people to check out. I can try to sum up the discussion here too.

Updated the lobby/P2P tutorial with the repo from @JDare linked in as well as a brief message and link to Valve's networking section from the SDK documentation. Please let me know if there is anything specific I should add.

This week I'm going to get those last three classes added in and start building a new example project with the newer functions. Afterward it might be a good time to get back to my GodotSteam server branch.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Halfwhit picture Halfwhit  路  12Comments

Luekuu picture Luekuu  路  8Comments

SapphireMH picture SapphireMH  路  6Comments

MichaelBelousov picture MichaelBelousov  路  11Comments

robertarnborg picture robertarnborg  路  11Comments