Crate bevy_steamworks[−][src]
Expand description
This crate provides a Bevy plugin for integrating with the Steamworks SDK.
Installation
Add the following to your Cargo.toml
:
[dependencies]
bevy-steamworks = "0.1.0"
Ensure that your computer has all the needed requirements to use bindgen.
Download and install the steamworks sdk
and set the environment variable STEAM_SDK_LOCATION
to point to it.
At runtime, a “steam_appid.txt” file with the registered Steam App ID of the game is required in the same directory as the executable.
Usage
To add the plugin to your game, simply add the SteamworksPlugin
to your
AppBuilder
.
use bevy::prelude::*; use bevy_steamworks::SteamworksPlugin; fn main() { App::build() .add_plugins(DefaultPlugins) .add_plugin(SteamworksPlugin) .run() }
The plugin adds steamworks::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. However,
any asynchronous callbacks from Steam will only run on the main thread.
The plugin will automatically call SingleClient::run_callbacks
on the Bevy
main thread every frame, so there is no need to run it manually.
NOTE: If the plugin fails to initialize (i.e. Client::init()
fails and
returns an error, an error wil lbe logged (via bevy_log
), but it will not
panic. In this case, it may be necessary to use Option<Res<Client>>
instead.
use bevy_steamworks::{Client, FriendFlags}; fn steam_system(steam_client: Res<Client>) { for friend in client.friends().get_friends(FriendFlags::IMMEDIATE) { println!("Friend: {:?} - {}({:?})", friend.id(), friend.name(), friend.state()); } } fn main() { App::build() .add_plugins(DefaultPlugins) .add_plugin(SteamworksPlugin) .add_startup_system(steam_system.system()) .run() }
Modules
stats |
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 | The main entry point into the steam client. |
ClientManager | Manages keeping the steam api active for clients |
CreateQueryError | |
DownloadItemResult | |
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 | |
InstallInfo | |
ItemState | |
Leaderboard | |
LeaderboardEntry | |
LeaderboardScoreUploaded | |
LobbyId | |
Matchmaking | Access to the steam matchmaking interface |
Networking | Access to the steam networking interface |
P2PSessionConnectFail | |
P2PSessionRequest | Called when a user wants to communicate via p2p |
PersonaChange | |
PersonaStateChange | |
PublishedFileId | Worshop item ID |
QueryResult | Query result |
QueryResults | Query results |
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 |
SingleClient | Allows access parts of the steam api that can only be called on a single thread at any given time. |
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 |
SteamworksPlugin | |
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 |
UserListQuery | Query object from |
UserStats | Access to the steam user interface |
UserStatsReceived | Callback type after calling
|
UserStatsStored | Callback triggered by |
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 |
AuthSessionValidateError | Errors from |
FileType | |
FriendState | |
LeaderboardDataRequest | |
LeaderboardDisplayType | |
LeaderboardSortMethod | |
LobbyType | The visibility of a lobby |
NotificationPosition | |
SendType | The method used to send a packet |
ServerMode | Used to set the mode that a gameserver will run in |
SteamError | Covers errors that can be returned by the steamworks API |
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 |
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 Definitions
SResult |