Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Steamworks P2P Integration #143

Merged
merged 2 commits into from
May 23, 2018
Merged

Conversation

cschoenig
Copy link
Contributor

Integrating Steamworks.NET to make use of Steams Peer2Peer networking, Lobby systems, and matchmaking systems. With Steam's matchmaking:

  • MasterServer is no longer necessary via public/private lobby searches
  • NatHolePunch is no longer necessary via Steams relay servers for users who cannot direct connect.

In order to connect to a user all we need is their Steam ID or the ID to the lobby they are hosting.

public void ConnectToLobby(CSteamID lobbyId)
{
SteamP2PClient client = new SteamP2PClient();
client.Connect(lobbyId);
networkManager.Initialize(client );
}

Hosting a lobby requires your Steam ID, the type of lobby you want to create, and optionally a delegate for further actions (like updating lobby metadata) once it has been registered.

public void HostNewLobby(bool isPrivate)
{
SteamP2PServer myLobby = new SteamP2PServer(5); //Max connections
myLobby.Host(SteamManager.Me, isPrivate ? ELobbyType.k_ELobbyTypeFriendsOnly : ELobbyType.k_ELobbyTypePublic);
}

A list of active lobbies can be retrieved via SteamMatchmaking:RequestLobbyList()

UDP classes have been cloned and modified to their SteamP2P variants.
UDP still left intact as SteamP2P is merely an alternative for Steam applications and not a replacement of current implementations.

This is tested and working for up to 2 players. I have been having issues with 3 or more devices being connected (Mainly with NetworkBehaviors and NetworkObjects not being paired correctly).

See the following:
https://github.com/rlabrecque/Steamworks.NET
https://partner.steamgames.com/doc/api/ISteamMatchmaking#functions
https://partner.steamgames.com/doc/api/ISteamNetworking#functions

Integrating Steamworks.NET to make use of Steams Peer2Peer networking, Lobby systems, and matchmaking systems. With Steam's matchmaking:
- MasterServer is no longer necessary via public/private lobby searches
- NatHolePunch is no longer necessary via Steams relay servers for users who cannot direct connect.

UDP classes have been cloned and modified to their SteamP2P variants.
UDP still left intact as SteamP2P is merely an alternative for Steam applications and not a replacement of current implementations.

This is tested and working for up to 2 players. I have been having issues with 3 or more devices being connected (Mainly with NetworkBehaviors and NetworkObjects not being paired correctly).

See the following:
https://github.com/rlabrecque/Steamworks.NET
https://partner.steamgames.com/doc/api/ISteamMatchmaking#functions
https://partner.steamgames.com/doc/api/ISteamNetworking#functions
@BrentFarris
Copy link
Member

There are conflicts because of the merges from a couple other PRs, it is probably just some code shifting. Do you mind resolving the merge conflicts. We will get to resolving the conflicts ourselves otherwise, just want to make sure they are working with your requirements after the resolve

@BrentFarris BrentFarris merged commit e9a8546 into BeardedManStudios:master May 23, 2018
@BrentFarris
Copy link
Member

👍 Thanks for the contribution!

Are you on the Discord server? If so what is your username (we add the contributor role to people who do PRs that make it in) :)

@cschoenig
Copy link
Contributor Author

Are you on the Discord server? If so what is your username (we add the contributor role to people who do PRs that make it in) :)

I am on the Discord server. My username is Alrok#3697 :)

@mcguinnessdr mcguinnessdr mentioned this pull request Sep 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants