Bolt For Steam SDK

Hello boys and girls. Its time to make your networked game integrate with Steam. Let's get started.

Start with the latest version of Bolt imported into your project. Then import the "bolt_steam.unitypackage" in your "/bolt/packages/" folder.

You'll now have some fancy new files in your Bolt/scripts/udpkit/Steam folder, and a full working example in the Bolt-Steam folder that works with the tutorial included with Bolt. Neat!

Let's assume we want to start from scratch and look at the example later. Make a new script for finding and creating lobbies. Invoke SteamHub.LobbyManager_Start like this:

Create a lobby by calling SteamHub.Lobby_Create(bool onlyInvite, int memberLimit);

Refresh list of available lobbies by calling SteamHub.Lobby_RefreshList(). The lobbies available can be found in the SteamHub.LobbyList property.

Join a lobby by calling SteamHub.Lobby_Join(SteamHubLobby lobby), the lobby that is joined will be available in SteamHub.SteamHub.LobbyActive after successfully joined.

Leave the lobby you are in by calling SteamHub.Lobby_LeaveActive();

That was easy! Now let's move on to connecting over Steam.

You should start the Steam server locally so all other members can connect to you, start by filling out the SteamPeer.Settings and SteamPeer.Callbacks struct, like this:

If you are the lobby creator/owner, you should call SteamPeer.StartHost(settings, callbacks), you will receive the SteamID the clients should connect to in the Host_Connected callback.
If you are a member of a lobby and the creator/owner has started it, you can connect to the SteamID of the game server by first calling SteamPeer.StartClient(settings, callbacks);

After you have called StartHost/StartClient, you should call BoltLauncher.SetUdpPlatform(new SteamPlatform()); and then start bolt with BoltLauncher.StartServer(); or BoltLauncher.StartClient(); depending on if you are host/server, you do not need to specify any addresses/ports here.

If you are the server, everything is done now. If you are the client you need to connect to the Host by calling BoltNetwork.Connect(lobbyGameServerSteamId.ToEndPoint());

Let's now take a look at the example provided with the SDK.

First, add bolt-steam/Lobby and the Level1 scene from the tutorial to your Build Settings scenes in build, then compile assembly. Make sure you have Steam running and are signed in. Load up the Lobby scene, and push play. If you're using the default Spacewar steamid in the steam_appid file in the root of your project, you should see other people's lobbies. Otherwise you probably changed the file to your game's id. You can create a lobby, join a lobby, and see all the details of the lobbies. Joining random people's lobbies will probably cause problems, as they probably have a very different configuration.

Once you are in a lobby, you can see who is in the lobby, chat with people in the lobby, kick others if you are the owner, and invite people in your friends list. Inviting will only work if you have built the game and are running the game by adding it to your Steam games and opening it in Steam, otherwise you won't have the Steam overlay.

Let's enter the game. You will only be able to enter the game if the the host is in game. The game will be started using Steam sockets, and you will see the Bolt tutorial sample.

 To Document Top