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§
- The non-connection-oriented interface to send and receive messages (whether they be “clients” or “servers”).
Structs§
- A user’s account id
- An id for a steam app/game
- Access to the steam apps interface
- Called when generating a authentication session ticket.
- A handle for an authentication ticket that can be used to cancel it.
- A handle that can be used to remove a callback at a later point.
- A Bevy compatible wrapper around
steamworks::Client
. - Information about a friend’s current state in a game
- Access to the steam friends interface
- A game id
- Access to the steam input interface
- A lobby chat room state has changed, this is usually sent when a user has joined or left the lobby.
- A wrapper for a lobby key string.
- Filters for the lobbies to be returned from
request_lobby_list
. - Access to the steam matchmaking interface
- A filter used for near-value sorting in lobby filtering.
- Access to the steam networking interface
- A filter used for numerical attribute comparison in lobby filtering.
- Called when a user wants to communicate via p2p
- Worshop item ID
- Query handle, to allow for more filtering.
- Query result
- Query results
- A remote play session was established
- A remote play session was closed
- Access to the steam remote storage interface
- The main entry point into the steam client for servers.
- Manages keeping the steam api active for servers
- A handle for a possible steam cloud file
- Name and size information about a file in the steam cloud
- A read handle for a steam cloud file
- A write handle for a steam cloud file
- A user’s steam id
- Called when the connection to the Steam servers fails.
- Called when a connection to the Steam servers is made.
- Called when the connection to the Steam servers is lost.
- A Bevy
Plugin
for adding support for the Steam SDK. - A filter used for string based key value comparisons.
- Called when generating a authentication session ticket for web api.
- A handle to update a published item
- A handle to watch an update of a published item
- Access to the steam user interface
- Result of a request to store the achievements on the server, or an “indicate progress” call. If both
current_progress
andmax_progress
are zero, that means the achievement has been fully unlocked. - see Steam API
- Access to the steam user interface
- Callback type after calling
request_current_stats()
. - Callback triggered by
store()
. - Access to the steam utils interface
- Called when an authentication ticket has been validated.
Enums§
- 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.
- Errors from
begin_authentication_session
- Errors from
ValidateAuthTicketResponse
- Flags describing how a users lobby state has changed. This is provided from
LobbyChatUpdate
. - The visibility of a lobby
- The method used to send a packet
- Used to set the mode that a gameserver will run in
- Covers errors that can be returned by the steamworks API
- A Bevy-compatible wrapper around various Steamworks events.
- A set of
SystemSet
s for systems used bySteamworksPlugin
- 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.
- Available published item statistic types.
- Workshop item types to search for
- Available user-specific lists. Certain ones are only available to the currently logged in user.
- Query result sorting
Constants§
Traits§
- Used to separate client and game server modes
Functions§
- Returns true if the app wasn’t launched through steam and begins relaunching it, the app should exit as soon as possible.