Code Monkey home page Code Monkey logo

godot-steam-api's Introduction

πŸš‚ Godot-Steam-API

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

🏁 Getting Started

  1. Ensure your game is in your Steam library.
  2. Download this plugin through Godot's asset library https://godotengine.org/asset-library/asset/1020
  3. 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)

# Check if the game runs on the Steam Deck
Steam.utils.is_running_on_steam_deck()

πŸ“„ 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 flag 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. You can set the flag in two ways:

A. Set Project Settings > Steam API > Disable Steam Integration [x].
B. Or add disable_steam_integration to your export's feature flags.

☁️ Does this support cloud saves?

No and intentionally. You can configure automatic cloud saves in the SteamWorks settings. Just give it a filesystem path and it magically syncs it. We've found this automatic support is, for most use cases, safer than rolling your own.

πŸ€” 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.

πŸ‘» Missing feature?

This plugin doesn't implement the entirety of the Steam API. But if there's a Steam API feature you need, leave a github issue stating why you need the feature and I'll try add support when I can.

⁉️ 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 chnages.
  • Tried uninstalling and reinstalling the plugin πŸ˜…?

godot-steam-api's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-steam-api's Issues

steamapp_id.txt in the readme.md but steam_appid.txt works

The "Testing an exported build" section of the readme.md says to create a file called steamapp_id.txt with the App ID in it, but I found (at least for my Linux builds) that I needed a file called steam_appid.txt in my exported game directory.

And THANK YOU for this plugin, you're a hero!

Godot 4 version of the plugin

Godot 4 is nearing a first non-beta release now, with the betas being more and more stable and feature complete.

It would be greatly appreciated with a 4.0 version of this plugin in the assetLib as I'm looking at eventually trying to get a 4.0 project I've started on to Steam.

Add bindings for headless Linux

I'm currently exporting my project using Godot's headless build. When doing this, it complains - but the build does complete just fine:

ERROR: init_library: does not have a library for the current platform.

This can be fixed by adding Server lines to the .gdnlib:

[general]

singleton=false
load_once=true
symbol_prefix="godot_"
reloadable=true

[entry]

OSX.64="res://addons/steam_api/libsteamsdk-godot.dylib"
Windows.64="res://addons/steam_api/steamsdk-godot.dll"
X11.64="res://addons/steam_api/libsteamsdk-godot.so"
Server="res://addons/steam_api/libsteamsdk-godot.so"

[dependencies]

OSX.64=[ "res://addons/steam_api/libsteam_api.dylib" ]
Windows.64=[ "res://addons/steam_api/steam_api64.dll" ]
X11.64=[ "res://addons/steam_api/libsteam_api.so" ]
Server=[ "res://addons/steam_api/libsteam_api.so" ]

I reckon this wouldn't have any implications outside of build time, as it's unlikely a user will be making a server build which needs the Steam API (for now?)

Order of autoloads changed by the EditorPlugin

Because the steam.gd singleton is added by the EditorPlugin dynamically, it's always put at the end of the autoload list. It seems we can't decide the order when adding a singleton by code unfortunately, unless I missed something?

This is not a huge problem, it's possible to go around this limitation but I just wanted to talk about it in case someone else is having the same problem. It's frustrating to set the order in the settings and then getting it overridden.

If there's no other solution, maybe we could add a warning somewhere in the readme or in the SteamAPI project settings panel?

It doesn't work with 32-bit games.

Hello! The plugins seems works fine, but I noticed that exported 32 bits exe's doesn't works and I got this error messages:

Captura de pantalla (2)

This is plugin only for x64 games? If this is the case, it should be clarified in the readme.

PS: Thanks for this great plugin!

[question] How to get user id?

Hello,
I have a super simple question that got me stumped.
How can I get steam user id with this integration?
I can successfully get everything working in general. The Steam established connection and returns for example user name.

I can ask it for get_steam_id with Steam.user.get_steam_id()
But I have no idea how to extract the id int from the returned value.

Or am I doing it completely wrong?

godot v3.5 wont read steamsdk-godot.dll

When I try to use the addon, after I set up everything and try to run Steam.is_init() I get this error

error

This happens even if I export the project and I already created the text file next to the exe of my game that contains the appid.
error2

To me seems like for some reason godot is not reading the dll file.
Here's what happens if I run the game in the editor
error3
error4
error5

I've been trying to make this plugin work for a few days with no luck. Hope you can point me into the right direction.
Cheers!

Mac OS 10.13.6 runtime error

Hi and thank you for your library :)

But I have an issue: library gives error on Mac OS 10.13.6
image
image
image

Unfortunately I can't update OS to the latest version, so could you make it backward compatible with 10.x.x ?

Thank you!

Problem with files in linux

  • OS: Manjaro Linux

Hi, once I try to import the SDK Directory it says that it cannot create the file at usr/bin, and I created it myself (just a file with the id and nothing else), however once I try print(Steam.is_init()) it stills return false, and I don't know what I'm doing wrong.

I am using the id of 480 which is just for testing.

Not working on Linux

I've tried to download the add-on to Godot 3.4.3 on Ubuntu 20.04 though the AssetLib section of the client, and I followed all of the steps in the video and added a steam_appid.txt to the root of my project folder.

The example scene starts without any errors, but I don't get the Steam achievement notification, even after I've added the achievement through the steamworks dashboard.

I don't have any errors to put here, and all I get on the console is
[]

I'm sorry I don't have any more information to provide at the moment. What do I do?

Cannot get this to work at all

I have googled everywhere trying to find out what I am doing wrong but this plugin does not work for me in any circumstance and doesn't really say why.

  • SDK downloaded, pressed the button and it said it copied the libs no problem and a green Done

  • Added my game id as requested

  • Tried running example scene in editor, errors

  • Tried running my game from editor, errors

  • Tried building and running from exe errors

  • Steam is on

  • steam_appid.txt is next to the exe when built

  • i put steam_appid.txt in the root directory of my res:// just in case, no difference.

  • i re-installed the plugin, no difference

  • I created a new project with nothing in it other than the plugin running Steam.is_init() - same issue

  • Using Godgot v3.5.stable.official [991bb6ac7]

Any help would be appreciated, thanks.

Error from IDE:

  • Is Steam running? - YES
  • Is the plugin activated? - YES
  • Did you do the setup in ProjectSettings > SteamAPI? - YES

E 0:00:09.603 call: Failed to init steam api. Is Steam running? Is the plugin activated? Did you do the setup in ProjectSettings > SteamAPI <C++ Source> modules/gdscript/gdscript_functions.cpp:775 @ call() <Stack Trace> steam.gd:44 @ _ready()

No other errors, this is the only one.

Error when running from exe:

  • Is Steam running? - YES
  • Is the plugin activated? - YES
  • Did you do the setup in ProjectSettings > SteamAPI? - YES

ERROR: Failed to init steam api. Is Steam running? Is the plugin activated? Did you do the setup in ProjectSettings > SteamAPI at: call (modules/gdscript/gdscript_functions.cpp:775) - Failed to init steam api. Is Steam running? Is the plugin activated? Did you do the setup in ProjectSettings > SteamAPI ERROR: You're running an exported build. Steam integration will only work if the game is launched by Steam. Either upload this 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. at: call (modules/gdscript/gdscript_functions.cpp:775) - You're running an exported build. Steam integration will only work if the game is launched by Steam. Either upload this 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.

Can't get Steam Username

There doesn't seem to be a way to get the user's Steam name.

Steamworks API docs say that I need to call ISteamFriends.GetPersonaName, but for some reason that's not exposed in the API here.

This seems like a very basic thing I might want to do, so is a different method to achieve this already implemented?

Not getting results

Hey :) I followed the youtube video, found that things were a bit different and then followed the instructions here also and made sure EVERYTHING was properly set up. txt file, sdk source path, appid, singleton, enabled, etc etc. And I am getting no achievement from it. REstarted Steam, made sure the overlay showed me online, etc etc. Any ideas?

Querying game language using GetCurrentGameLanguage()

Exposing GetCurrentGameLanguage might be useful to get the language the user has selected in Steam.

As Steam suggests here, if you have only one depot for your game with all the languages, you can query the language selected by the user using ISteamApps::GetCurrentGameLanguage. At the same time, GetAvailableGameLanguages might be useful too.

Is it possible to separate out NDA files into a subdirectory?

Background: I'm working on a (currently) closed-source game that I'm hoping to open-source. If that happens, I need to make sure I don't have anything in Git that is covered under the Steam NDA.

From what I can see, right now, running the plugin with it being correctly configured, copies three files into the addons/steam_api directory.

Is it possible to, instead, move those files into a subdirectory? That would make it rather easy for developers to open-source their games, while only needing to add a single directory to the .gitignore file.

Prevent orphan node warnings on export

When exporting, I'm finding that Godot spits out a lot of warnings saying that steam.gd has been orphaned, a la:

WARNING: cleanup: ObjectDB instances leaked at exit (run with -
-verbose for details).

It appears this can be fixed by changing _exit_tree to disable_plugin in plugin.gd.

Workshop support would be appreciated.

I didn't anticipate that some of my players would ask for it so I didn't mind that that this addon didn't support it. I don't really want to yank this addon out and put in a different one after the game has already launched so I'm in a bit of a rough spot.

[BUG] Cannot get it to work between Godot and Steam

  • OS: Windows 10 / Godot 3.4.4

I don't think it is necessarily a bug, but I cannot get it to work.

Describe the issue
The game/ID is in my library (but there is no game executable on Steamworks yet), steam_appid.txt has the correct number, and is located next to godot.exe. Steam.is_init() returns true after launch. Steam.set_achievement("xyz") does nothing, and Steam.get_achievement("xyz") returns false.
Same for the leaderboards, which are also defined in Steamworks. I must have missed something, but cannot locate the error.

Paste the code causing the issue

func _ready():
	if(steamVersion):
		if Steam.is_init():
			Steam.set_achievement("burger_time")
			var has_alredy_unlocked_achievement:bool = Steam.get_achievement("burger_time")
			print(has_alredy_unlocked_achievement) #prints false
			set_steam_leaderboards()

func set_steam_leaderboards():
	if GameManager.current_game_mode == GameManager.current_player_game_data["easy_mode"]:
		Steam.set_leaderboard_score("EasyMedium", GameManager.Score)
	elif GameManager.current_game_mode == GameManager.current_player_game_data["medium_mode"]:
		Steam.set_leaderboard_score("MediumHard", GameManager.Score)
	elif GameManager.current_game_mode == GameManager.current_player_game_data["speedrun_mode"]:
		Steam.set_leaderboard_score("SugarRushSpeedrun", GameManager.TotalGameTime)
	elif GameManager.current_game_mode == GameManager.current_player_game_data["daily_challenge"]:
		Steam.set_leaderboard_score("DailyHighScore", GameManager.Score)
	print("Leaderboards updated") #number of entries on Steamworks are still at 0

Paste any error appearing in the console

None

godot_steam

The ID (1779560) is also correct (https://store.steampowered.com/app/1779560/Donut_Dodo/)
Thanks.

Cannot install plugin

I'm already stuck on Step 1. I'm using Godot 3.5.3 and I'm trying to install the plugin. I tried downloading it from the Asset Library and importing the file from Github, but I get the following error:
Can't open dynamic library: D:/Awf/Projects/_TEST PROJECTS_/SteamIntegrationTest/addons/steam_api/steamsdk-godot.dll, error: Error 126: The specified module could not be found. . modules/gdnative/gdnative.cpp:510 - No valid library handle, can't get symbol from GDNative object modules/gdnative/nativescript/nativescript.cpp:1503 - No nativescript_init in "res://addons/steam_api/steamsdk-godot.dll" found Can't open dynamic library: D:/Awf/Projects/_TEST PROJECTS_/SteamIntegrationTest/addons/steam_api/steamsdk-godot.dll, error: Error 126: The specified module could not be found. . modules/gdnative/gdnative.cpp:510 - No valid library handle, can't get symbol from GDNative object modules/gdnative/nativescript/nativescript.cpp:1503 - No nativescript_init in "res://addons/steam_api/steamsdk-godot.dll" found Can't open dynamic library: D:/Awf/Projects/_TEST PROJECTS_/SteamIntegrationTest/addons/steam_api/steamsdk-godot.dll, error: Error 126: The specified module could not be found. . modules/gdnative/gdnative.cpp:510 - No valid library handle, can't get symbol from GDNative object modules/gdnative/nativescript/nativescript.cpp:1503 - No nativescript_init in "res://addons/steam_api/steamsdk-godot.dll" found

Plugin unable to connect after Godot version change

  • OS: Windows 10

Describe the issue
When changing Godot versions (e.g. 3.4.4 > 3.5 or 3.4.3 > 3.4.4) the plugin seems to stop working.
I get the error message that the plugin is unable to connect to Steam.

Fix
What helped now for a second time was completely removing the plugin and deleting the directoy in addons - then doing a clean install.

Inconsistent Behavior With Setting Rich Presence

Hey, Sam! Gramps here. I'm opening this issue to get your input on a problem with setting rich presence in Steamworks which seems to affect both your project and mine; though my module and GDExtension are immune to this issue. Perhaps a second set of eyes will help.

I have tested it with Steam's console, their rich presence tester (which isn't super helpful), my GDNative plug-in, my GDExtension plug-in, my module, and your GDNative plug-in; the results are always the same: failure on the GDNative side.

When not using a "special key" specified by Steam, it seems to have an inconsistent behavior when setting keys/values. Since you can pass key/values that will substitute in the rich presence tokens, this kind of needs to work right. If you pass, like Valve's example, the key score then your score as the value, it will sometimes pass the key as the value:

# in GodotSteam
Steam.setRichPresences("score", 40)

# in your system
Steam.friends.set_rich_presence("score", 40)

# both occasionally show as:
06058352 Godot_v3.5.2-stable_win64.exe:3670020 > IClientFriends::SetRichPresence( 480, "score", "score", ) = 1, 
06058534 Godot_v3.5.2-stable_win64.exe:3670020 > IClientFriends::SetRichPresence( 480, "score", "40", ) = 1,

In a test of 100 attempts, it did this 19 times; both with your GDNative plug-in and mine. However, with my module or GDExtension plug-in, this succeeds 100% of the time. Also if you pass one of the "special keys", this will succeed 100% of the time:

# Passing 40 with "steam_display" as key consistently gives
06250305 Godot_v3.5.2-stable_win64.exe:4194309 > IClientFriends::SetRichPresence( 480, "steam_display", "40", ) = 1, 

Printing the currently set rich presence with getRichPresence( steam_id, key ), on the GDNative end, shows that the value is indeed set as "score" or sometimes just blank. While in the module/GDExtension, this prints the expected value of 40 each time.

Given these tests, I assume this is an issue with GDNative. I have another odd behavior with lobby lists that can be solved with the most illogical (to me) solution.

Again, I figured I'd bring it up here first instead of the Godot issues since it affects both of our projects.

Changing Steam App ID doesn't work

Hi, I needed to change the Steam App ID for my project and it doesn't work.

I go into Project Settings -> SteamAPI.
Then I rewrite the ID in Steam App ID and it keeps connecting to the old ID.

Thanks!

Please clarify license of src/Godot.cpp

Hi,

The license of this file is unclear. I can only find MIT license in addons/steam_api. Is this code on Godot.cpp also meant to be MIT licensed? Would probably be best to just have it at the beginning of the file as comment to have clarity.

Steam.utils.is_running_on_steam_deck() returns an error and crashes engine

Steam.utils.is_running_on_steam_deck() returns nonexistent function 'is_running_on_steam_deck' in base Reference() error and crashes the engine.

Perhaps the official Godot repositories are not updated yet? However, I did download a zipped version of the master and the same thing occurred.

For reference, I'm on Ubuntu 22.04.1 LTS. Steam is currently running in the background, but Godot is being launched via Itch.

[SOLVED] godot 3.4 support

Hi, thank you for taking the time to read this. I am a solo independent game developer, and my game is incompatible with the 3.5 version of Godot. I was wondering if there was a simple way to release a 3.4-compatible branch, or some guidance on making this steam API integration compatible with 3.4?

This seems like a worthwhile asset especially for 3.5 adopters, I would like to also use this API for the game's Steam Release.

I appreciate your investigation.

Exported Release cannot connect to Steam

I exported my game as a release and when I launch it, it doesn't connect to Steam, so the Steam API integration stops working.
When I ran the game from Godot editor, it worked fine.

Another to thing to note is that when I upload it the build to Steam and launch it from there, it works fine.

[BUG] Couldn't fully load the singleton script "Steam" (possible cyclic reference or parse error)

  • OS: MacOS

Describe the issue
Basically, if I try to use a function with the Steam library (like, say, Steam.clear_achievement("test") for example), I have an error message saying that "Couldn't fully load the singleton script "Steam" (possible cyclic reference or parse error)". At first I did not have any message errors in the console, but now I have a few (listed below).
I tried it on a copy of my current project, and for one of them it seems to work fine, but not for the other one.
Weirdly enough, even in the one with all the error messages, it now seems to work (in the sense that the achievement is unlocked), even though I have a bunch of scary error messages.

Paste the code causing the issue

func _ready():
# Test steam achievements
	Steam.clear_achievement("test")
	Steam.set_achievement("test")
	print(Steam.user_stats.get_achievement_name(0))

Paste any error appearing in the console

 Resource: 'res://addons/steam_api/steam.gd' is already being loaded. Cyclic reference?
 res://addons/steam_api/steam.gd:5 - Parse Error: The identifier "Steam" isn't declared in the current scope.
 modules/gdscript/gdscript.cpp:566 - Method failed. Returning: ERR_PARSE_ERROR
 Resource: 'res://addons/steam_api/steam.gd' is already being loaded. Cyclic reference?
 res://addons/steam_api/steam.gd:5 - Parse Error: The identifier "Steam" isn't declared in the current scope.
 modules/gdscript/gdscript.cpp:566 - Method failed. Returning: ERR_PARSE_ERROR

Godot 3.6 SteamAPI Asset issue with leaderboards

For some reason,, I can update a leaderboard from one scene, but not another. I have this that sets my leaderboards right now:

func _ready():
	#SETTING LEADERBOARD VALUES
#	Steam.set_leaderboard_score('Longest_Dominoe_Streak', 10)
#	Steam.set_leaderboard_score('Most_Colorful_Creation', 3)
#	Steam.set_leaderboard_score('Most_Games_Played', 12)
	
	

	#GETTING USER LEADERBOARD VALUES
	var players_longest_dominoe_streak_score = yield(Steam.get_leaderboard_scores("Longest_Dominoe_Streak", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
	var players_most_colorful_score = yield(Steam.get_leaderboard_scores("Most_Colorful_Creation", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
	var players_games_played_score = yield(Steam.get_leaderboard_scores("Most_Games_Played", 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")

	#GETTING TOP 10 LEADERBOARD VALUES
	var top_10_global_longest_dominoe_streak_scores = yield(Steam.get_leaderboard_scores('Longest_Dominoe_Streak', 0, 10), 'done')
	var top_10_global_most_colorful_scores = yield(Steam.get_leaderboard_scores('Most_Colorful_Creation', 0, 10), 'done')
	var top_10_global_most_games_played_scores = yield(Steam.get_leaderboard_scores('Most_Games_Played', 0, 10), 'done')
	
	#GETTING USER AND ONE USER UP AND ONE USER DOWN ON LEADERBOARD VALUES
	var player_rivals_longest_dominoe_streak_scores = yield(Steam.get_leaderboard_scores("Longest_Dominoe_Streak", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
	var player_rivals_most_colorful_scores = yield(Steam.get_leaderboard_scores("Longest_Dominoe_Streak", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
	var player_rivals_most_games_played_scores = yield(Steam.get_leaderboard_scores("Most_Games_Played", -1, 1, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")
	
	
	#SET LEADERBOARD NAMES AND VALUES
	for i in range(10):
		var mgp_label_name = Label.new()
		mgp_container_names.add_child(mgp_label_name)
		var mgp_label_value = Label.new()
		mgp_container_values.add_child(mgp_label_value)
		
		var lds_label_name = Label.new()
		lds_container_names.add_child(lds_label_name)
		var lds_label_value = Label.new()
		lds_container_values.add_child(lds_label_value)
		
		var mcc_label_name = Label.new()
		mcc_container_names.add_child(mcc_label_name)
		var mcc_label_value = Label.new()
		mcc_container_values.add_child(mcc_label_value)


	populate_labels(mgp_container_names, mgp_container_values, top_10_global_most_games_played_scores)
	populate_labels(lds_container_names, lds_container_values, top_10_global_longest_dominoe_streak_scores)
	populate_labels(mcc_container_names, mcc_container_values, top_10_global_most_colorful_scores)

func populate_labels(container_names, container_values, scores):
	for i in range(min(scores.size(), 10)):
		container_names.get_child(i).text = scores[i].persona_name
		container_values.get_child(i).text = str(scores[i].score)

and if you notice the commented out parts, those are just from the API for set_leaderboard_score. THOSE actually work but I dont need to do it there. When I play the game, I have another script after loading everything that tries to update the Most_Games_Played leaderboard score. BUT it wont do it there, though it works by uncommenting it out here (which is a scene no longer in the tree when playing so I cant do it from here, this is ONLY for the menu leaderboard).

SO, in the other script, I have this:

func _ready():
	Engine.time_scale = 2
	Engine.iterations_per_second = 60
	
	viewport.fxaa = Configurations.fxaa
	viewport.msaa = Configurations.msaa
	viewport.sharpen_intensity = Configurations.sharpen
	fader.get_node("AnimationPlayer").play("fade_to_clear")
	yield(get_tree().create_timer(1.5), "timeout")
	fader.queue_free()
	
	#SET GET STEAM ACHIEVEMENTS
	
	# check if player already unlocked this achievement
	var unlocked_achievement:bool = Steam.get_achievement("Welcome_to_the_game!")
	if unlocked_achievement == false:
		Steam.set_achievement("Welcome_to_the_game!")
		
	
	# Set initial window position
	OS.center_window()
	SaveLoad.update_leaderboard_score("Most_Games_Played", 1) 

where in my SaveLoad script as an autoload, it calls this:

func update_leaderboard_score(leaderboard_name, increment):
	var players_score = yield(Steam.get_leaderboard_scores(leaderboard_name, 0, 0, Steam.LeaderboardDataRequest.GlobalAroundUser), "done")

	if players_score.size() > 0:
		var score = players_score[0]["score"]
		print("Current score: ", score)

		var updated_score = int(score) + increment
		print("Updated score: ", updated_score)

		Steam.set_leaderboard_score(leaderboard_name, updated_score)
	else:
		print("No scores found for ", leaderboard_name)

BUT even if I dont use the SaveLoad pass, or even if I directly set it using just a number typed in the script, it will not update the leaderboard score. I can even do exactly this in the game ready function: Steam.set_leaderboard_score('Most_Games_Played', 12) and it wont do it, but it will update it in the first script. It SHOULD be a global thing as Steam is global as an API, and its already a game on Steam so its set up correctly I promise that.

Any thoughts?

Ability to disable plugin at runtime

Is it possible to add a function I can call, to disable the Steam integration at runtime?

I use the same code-base for the demo and full version of my game. In my export settings, I have two exports for each platform: one for the demo, and one for the full game. If possible, I would like to disable Steam integration in the demo version, by calling some function to disable the API if I detect the game is running in demo mode.

Questions

Can I add this plugin, make my game (without Steam features) and then add project ID and extract SDK? Otherwords, can I make my game and after that add SteamSDK and plugin?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.