Steam API

An asset by samsface
The page banner background of a mountain and forest
Steam API image holder but it is empty

Quick Information

0 ratings
Steam API icon image
samsface
Steam API

Steam Integration without rebuilding Godot.- Supports Windows, Linux & MacOS(x86_64/arm64).- Supports disabling the integration without needing to change code.- Supports the following APIs:# check is steam integration is working and enabled, useful if you publish to multiple storesSteam.is_init()# achievementsSteam.set_achievement("gator_god")Steam.get_achievement("gator_god")Steam.clear_achievement("gator_god")# leaderboardsSteam.set_leaderboard_score("High Scores", 1000)# Get the first 10 global high scoresvar top_10_global_scores = yield(Steam.get_leaderboard_scores("High Scores", 0, 10), "done")# Get just the current user's high scorevar players_score = yield(Steam.get_leaderboard_scores("High Scores", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")# Get the current user's high score and the two scores infront and behindvar player_rivals_score = yield(Steam.get_leaderboard_scores("High Scores", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")# overlaySteam.friends.connect("game_overlay_activated", self, "_on_game_overlay_activated")Steam.friends.activate_game_overlay_to_web_page("https://steamcommunity.com/")Steam.friends.activate_game_overlay_to_store(1435470, Steam.OverlayToStoreFlag.AddToCart)

Supported Engine Version
3.4
Version String
1.3.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

πŸš‚ Godot-Steam-API

Godot Steam integration without rebuilding Godot. Supports πŸ’°Windows, 🐧Linux & 🍏MacOS (x86_x64/arm64).

🏁 Getting Started

  1. Download this plugin through Godot's asset library https://godotengine.org/asset-library/asset/1020
  2. There should now be a SteamAPI tab in your Project Settings, follow the instructions to configure the SteamAPI for your game (Takes a few seconds).

Now you can use the following functions:

# check steam integration is working and enabled, useful if you publish to multiple stores
Steam.is_init()

# achievements
# check if player already unlocked this achievement
var has_alredy_unlocked_achievement:bool = Steam.get_achievement("gator_god")
# give the player this achievement, benign if they already have it
Steam.set_achievement("gator_god")
# clear this achievement (only for debugging)
Steam.clear_achievement("gator_god")

# stats
# set an integer stat
Steam.user_stats.set_stat("kills", 5)
var kills_stat:int = Steam.user_stats.get_stat("kills")
# set a float stat
Steam.user_stats.set_stat("time", 10.3)
var time_stat:float = Steam.user_stats.get_stat("time")
# show the progress of a stat towards some achievement
Steam.user_stats.indicate_achievement_progress("gator_god", 1, 4)

# leaderboards
Steam.set_leaderboard_score("High Scores", 1000)
# Get the first 10 global high scores
var top_10_global_scores = yield(Steam.get_leaderboard_scores("High Scores", 0, 10), "done")
# Get just the current user's high score
var players_score = yield(Steam.get_leaderboard_scores("High Scores", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
# Get the current user's high score and the two scores infront and behind
var player_rivals_score = yield(Steam.get_leaderboard_scores("High Scores", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")

# rich presence
# Read the docs: https://partner.steamgames.com/doc/features/enhancedrichpresence as this call has lots of hidden magic
# and use this tool to test: https://steamcommunity.com/dev/testrichpresence
Steam.friends.set_rich_presence("status", "cactus")
Steam.friends.clear_rich_presence()

# overlay
Steam.friends.connect("game_overlay_activated", self, "_on_game_overlay_activated")
Steam.friends.activate_game_overlay_to_web_page("https://steamcommunity.com/")
Steam.friends.activate_game_overlay_to_store(1435470, Steam.OverlayToStoreFlag.AddToCart)

πŸ“„ Documentation

This plugin follows the structure and naming of the offical C++ SteamSDK almost verbatim. The only major difference is I use snake_case to better integrate with Godot. That is to say, you can just rely on the offical docs: https://partner.steamgames.com/doc/api.

πŸ§ͺ Testing an exported build

Steam integration doesn't work with exported builds straight away. You'll have to either:

  • Upload your build to Steam or
  • Create a file in the same directory as your exported build named steam_appid.txt with just your steam app id in it. Though do not upload this file as part of your build.

πŸ˜Άβ€πŸŒ«οΈ Can I publish to Itch.io still?

Yes. There's a switch in Project Settings > Steam API that disables the integration, i.e. all calls on the API just do nothing and return/yield null. However it is up to the caller to then safely deal with the null values returned by the API in disabled mode.

πŸ€” Who uses this?

A ton of projects on Steam use this plugin. Here's just a few of my favourite:

πŸ‘Ύ Beat Invaders, πŸš€ Space Bandit, πŸš— Franz Fury, 🏌️ The Ballad of Bonky, πŸ”² Hack Grid, πŸ’€ Dark Crypt, πŸ”οΈ Red Nivis, 🏰 Sokobos, πŸ‘ Dark Sheep, πŸͺž Mirrorama, πŸŒ‘ Letters from the Moon, πŸ‘©πŸΎβ€πŸ¦° ROTA, 🍩 Donut Dodo.

⁉️ Troubleshooting

  • Did you follow the instruction in the project settings Steam tab?
  • Is Steam running?
  • Have you published your acheivments in the SteamWorks console? Publishing isn't releasing the game, I mean the button that publishes your Store page.
  • Tried uninstalling and reinstalling the plugin πŸ˜…?

Steam Integration without rebuilding Godot.

- Supports Windows, Linux & MacOS(x86_64/arm64).
- Supports disabling the integration without needing to change code.
- Supports the following APIs:

# check is steam integration is working and enabled, useful if you publish to multiple stores
Steam.is_init()

# achievements
Steam.set_achievement("gator_god")
Steam.get_achievement("gator_god")
Steam.clear_achievement("gator_god")

# leaderboards
Steam.set_leaderboard_score("High Scores", 1000)
# Get the first 10 global high scores
var top_10_global_scores = yield(Steam.get_leaderboard_scores("High Scores", 0, 10), "done")
# Get just the current user's high score
var players_score = yield(Steam.get_leaderboard_scores("High Scores", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
# Get the current user's high score and the two scores infront and behind
var player_rivals_score = yield(Steam.get_leaderboard_scores("High Scores", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")

# overlay
Steam.friends.connect("game_overlay_activated", self, "_on_game_overlay_activated")
Steam.friends.activate_game_overlay_to_web_page("https://steamcommunity.com/")
Steam.friends.activate_game_overlay_to_store(1435470, Steam.OverlayToStoreFlag.AddToCart)

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Steam API icon image
samsface
Steam API

Steam Integration without rebuilding Godot.- Supports Windows, Linux & MacOS(x86_64/arm64).- Supports disabling the integration without needing to change code.- Supports the following APIs:# check is steam integration is working and enabled, useful if you publish to multiple storesSteam.is_init()# achievementsSteam.set_achievement("gator_god")Steam.get_achievement("gator_god")Steam.clear_achievement("gator_god")# leaderboardsSteam.set_leaderboard_score("High Scores", 1000)# Get the first 10 global high scoresvar top_10_global_scores = yield(Steam.get_leaderboard_scores("High Scores", 0, 10), "done")# Get just the current user's high scorevar players_score = yield(Steam.get_leaderboard_scores("High Scores", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")# Get the current user's high score and the two scores infront and behindvar player_rivals_score = yield(Steam.get_leaderboard_scores("High Scores", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")# overlaySteam.friends.connect("game_overlay_activated", self, "_on_game_overlay_activated")Steam.friends.activate_game_overlay_to_web_page("https://steamcommunity.com/")Steam.friends.activate_game_overlay_to_store(1435470, Steam.OverlayToStoreFlag.AddToCart)

Supported Engine Version
3.4
Version String
1.3.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers