flame_steamworks

Last updated:

0 purchases

flame_steamworks Image
flame_steamworks Images
Add to Cart

Description:

flame steamworks

⚠️Until this issue is fixed, this package only support windows. There is a workaround though, you can generate platform specific api using https://github.com/aeb-dev/steamworks_gen
flame_steamworks #
A package that makes it possible to make a game in steam with flutter! It combines steamworks and flame.

Features #
The goal of this library is to provide complete coverage possible over steam api. We can split functionality provided with the steam api into three categories:

Initilization, common apis
Asynchronous callbacks
Asynchronous call results

You can get detailed information about these from the steam docs

Requirements #
You need to steam_api.dll and steam_api.lib to be able to use this package. You can either download from here by signing in or you can use the files under the example. If you chose to download from steam, the files are under redistributable_bin.

How to use #
Flame Game Instance #
First we need a game right! Lets make it.
class GameInstance extends FlameGame with KeyboardEvents, HasSteamClient {
GameInstance() {
init(); // it is important to call this to initialize steam api
}
}
copied to clipboard

Registering for a callback #
HasSteamClient mixin provides a simple api to register a callback. You can register a callback in any place in the code
class GameInstance extends FlameGame with KeyboardEvents, HasSteamClient {
GameInstance() {
init();
registerCallback<UnreadChatMessagesChanged>((data) => /*do what you want*/);
}
}
copied to clipboard
There are many callbacks in steam api, you check all of them on steam docs.

Registering for a call result #
HasSteamClient mixin provides a simple api to register a call result. Call results are a little different from callbacks. Before you subscribe to call result, you need to make a request and subscribe to result of that request.
class GameInstance extends FlameGame with KeyboardEvents, HasSteamClient {
// We wait for space key to be pressed and if it is then we make a request for UserStatsReceived an subscribe to its result
@override
KeyEventResult onKeyEvent(
RawKeyEvent event,
Set<LogicalKeyboardKey> keysPressed,
) {
bool isKeyDown = event is RawKeyDownEvent;

bool isSpace = keysPressed.contains(LogicalKeyboardKey.space);

if (isSpace && isKeyDown) {
CSteamId steamId = steamClient.steamUser.getSteamId();
SteamApiCall callId =
steamClient.steamUserStats.requestUserStats(steamId);

registerCallResult<UserStatsReceived>(
callId,
(ptrUserStatus, hasFailed) {
print("User stats received");
print("GameId: ${ptrUserStatus.gameId}");
print("SteamIdUser: ${ptrUserStatus.steamIdUser}");
},
);

return KeyEventResult.handled;
}
return KeyEventResult.ignored;
}
}
copied to clipboard
There are many call results in steam api, you check all of them on steam docs.

Published games #
Here are a list of games that have been published on Steam that utilise this package:

Omnichess - https://store.steampowered.com/app/2009510


What is next? #
Well, steam is the limit!

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.