Crate bevy_steamworks

Source
Expand description

This crate provides a Bevy plugin for integrating with the Steamworks SDK.

The underlying steamworks crate comes bundled with the redistributable dynamic libraries a compatible version of the SDK. Currently it’s v153a.

§Usage

To add the plugin to your app, simply add the SteamworksPlugin to your App. This will require the AppId provided to you by Valve for initialization.

use bevy::prelude::*;
use bevy_steamworks::*;

fn main() {
  // Use the demo Steam AppId for SpaceWar
  App::new()
      // it is important to add the plugin before `RenderPlugin` that comes with `DefaultPlugins`
      .add_plugins(SteamworksPlugin::init_app(480).unwrap())
      .add_plugins(DefaultPlugins)
      .run();
}

The plugin adds Client as a Bevy ECS resource, which can be accessed like any other resource in Bevy. The client implements Send and Sync and can be used to make requests via the SDK from any of Bevy’s threads.

The plugin will automatically call SingleClient::run_callbacks on the Bevy every tick in the First schedule, so there is no need to run it manually.

All callbacks are forwarded as Events and can be listened to in the a Bevy idiomatic way:

use bevy::prelude::*;
use bevy_steamworks::*;

fn steam_system(steam_client: Res<Client>) {
  for friend in steam_client.friends().get_friends(FriendFlags::IMMEDIATE) {
    println!("Friend: {:?} - {}({:?})", friend.id(), friend.name(), friend.state());
  }
}

fn main() {
  // Use the demo Steam AppId for SpaceWar
  App::new()
      // it is important to add the plugin before `RenderPlugin` that comes with `DefaultPlugins`
      .add_plugins(SteamworksPlugin::init_app(480).unwrap())
      .add_plugins(DefaultPlugins)
      .add_systems(Startup, steam_system)
      .run();
}

Modules§

networking_messages
The non-connection-oriented interface to send and receive messages (whether they be “clients” or “servers”).
networking_sockets
networking_utils

Structs§

AccountId
A user’s account id
AppId
An id for a steam app/game
Apps
Access to the steam apps interface
AuthSessionTicketResponse
Called when generating a authentication session ticket.
AuthTicket
A handle for an authentication ticket that can be used to cancel it.
CallbackHandle
A handle that can be used to remove a callback at a later point.
Client
A Bevy compatible wrapper around steamworks::Client.
CreateQueryError
DownloadItemResult
FloatingGamepadTextInputDismissed
Friend
FriendFlags
FriendGame
Information about a friend’s current state in a game
Friends
Access to the steam friends interface
GameId
A game id
GameLobbyJoinRequested
GameOverlayActivated
GamepadTextInputDismissed
Input
Access to the steam input interface
InstallInfo
InvalidErrorCode
ItemState
Leaderboard
LeaderboardEntry
LeaderboardScoreUploaded
LobbyChatUpdate
A lobby chat room state has changed, this is usually sent when a user has joined or left the lobby.
LobbyDataUpdate
LobbyId
LobbyKey
A wrapper for a lobby key string.
LobbyKeyTooLongError
LobbyListFilter
Filters for the lobbies to be returned from request_lobby_list.
Matchmaking
Access to the steam matchmaking interface
MicroTxnAuthorizationResponse
NearFilter
A filter used for near-value sorting in lobby filtering.
Networking
Access to the steam networking interface
NumberFilter
A filter used for numerical attribute comparison in lobby filtering.
P2PSessionConnectFail
P2PSessionRequest
Called when a user wants to communicate via p2p
PersonaChange
PersonaStateChange
PublishedFileId
Worshop item ID
QueryHandle
Query handle, to allow for more filtering.
QueryResult
Query result
QueryResults
Query results
RemotePlay
RemotePlayConnected
A remote play session was established
RemotePlayDisconnected
A remote play session was closed
RemotePlaySession
RemotePlaySessionId
RemoteStorage
Access to the steam remote storage interface
Server
The main entry point into the steam client for servers.
ServerManager
Manages keeping the steam api active for servers
SteamFile
A handle for a possible steam cloud file
SteamFileInfo
Name and size information about a file in the steam cloud
SteamFileReader
A read handle for a steam cloud file
SteamFileWriter
A write handle for a steam cloud file
SteamId
A user’s steam id
SteamServerConnectFailure
Called when the connection to the Steam servers fails.
SteamServersConnected
Called when a connection to the Steam servers is made.
SteamServersDisconnected
Called when the connection to the Steam servers is lost.
SteamworksPlugin
A Bevy Plugin for adding support for the Steam SDK.
StringFilter
A filter used for string based key value comparisons.
TicketForWebApiResponse
Called when generating a authentication session ticket for web api.
UGC
UpdateHandle
A handle to update a published item
UpdateWatchHandle
A handle to watch an update of a published item
User
Access to the steam user interface
UserAchievementStored
Result of a request to store the achievements on the server, or an “indicate progress” call. If both current_progress and max_progress are zero, that means the achievement has been fully unlocked.
UserRestriction
see Steam API
UserStats
Access to the steam user interface
UserStatsReceived
Callback type after calling request_current_stats().
UserStatsStored
Callback triggered by store().
Utils
Access to the steam utils interface
ValidateAuthTicketResponse
Called when an authentication ticket has been validated.

Enums§

AppIDs
AppID filter for queries. The “consumer” app is the app that the content is for. The “creator” app is a separate editor to create the content in, if applicable.
AuthSessionError
Errors from begin_authentication_session
AuthSessionValidateError
Errors from ValidateAuthTicketResponse
ChatMemberStateChange
Flags describing how a users lobby state has changed. This is provided from LobbyChatUpdate.
ComparisonFilter
DistanceFilter
FileType
FloatingGamepadTextInputMode
FriendState
GamepadTextInputLineMode
GamepadTextInputMode
LeaderboardDataRequest
LeaderboardDisplayType
LeaderboardSortMethod
LobbyType
The visibility of a lobby
NotificationPosition
OverlayToStoreFlag
PublishedFileVisibility
SendType
The method used to send a packet
ServerMode
Used to set the mode that a gameserver will run in
SteamAPIInitError
SteamDeviceFormFactor
SteamError
Covers errors that can be returned by the steamworks API
SteamworksEvent
A Bevy-compatible wrapper around various Steamworks events.
SteamworksSystem
A set of SystemSets for systems used by SteamworksPlugin
StringFilterKind
UGCContentDescriptorID
Users can control what user-generated content they want to see under the Mature Content Filtering section in their preferences. This filtering is done automatically by Steam servers, but first, user-generated content must be tagged appropriately. Developers can use AddContentDescriptor and RemoveContentDescriptor calls to manage content descriptors a piece of UGC has. These can be retrieved from the result of a query via GetQueryUGCContentDescriptors.
UGCQueryType
UGCStatisticType
Available published item statistic types.
UGCType
Workshop item types to search for
UpdateStatus
UploadScoreMethod
UserList
Available user-specific lists. Certain ones are only available to the currently logged in user.
UserListOrder
Query result sorting

Constants§

RESULTS_PER_PAGE

Traits§

Callback
Manager
Used to separate client and game server modes

Functions§

restart_app_if_necessary
Returns true if the app wasn’t launched through steam and begins relaunching it, the app should exit as soon as possible.

Type Aliases§

NearFilters
NumberFilters
SIResult
SResult
StringFilters