samsface / godot-steam-api

Godot Steam integration using GDNative.
403 stars 16 forks source link

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

Closed zapposh closed 2 years ago

zapposh commented 2 years ago

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.

samsface commented 2 years ago

@zapposh I don't think you need any executable up on Steam :thinking:, everything should work right out of the Godot editor.

Is it possible you didn't click publish after adding your achievements? What happens if you run this code:

for i in Steam.user_stats.get_num_achievements():
       print(Steam.user_stats.get_achievement_name(i))

Another option I saw someone have also now that I think of it. Go into Steam tab in project settings and disable and re-enable the checkbox saying "Disable Steam Integration".

zapposh commented 2 years ago

Thanks for trying to help.

leaderboards achievement

samsface commented 2 years ago

@zapposh I'm thinking maybe the no build uploaded to depot could be the issue because it looks like you've done everything right.

Can you dm me on discord, I want to test something https://discord.gg/rPvvUAZJ

samsface commented 2 years ago

@zapposh OK so the issue here was we were launching Godot from Steam. So Steam injected Godot's appid into the application meaning we were trying to set the achievements for Godot : )

There's no work around for this. You just have to launch outside of Seam. I'll add an error message to this effect:

https://github.com/samsface/godot-steam-api/commit/386f2d233ca4d99b44869b3e022098b6cde24ed9