Implementing Steam achievements?

  • #1, by UraalSunday, 05. April 2015, 01:06 10 years ago
    Hey everyone, I am on last stretch with my project and I am currently trying to tie up game's secrets system into Steam's achievements. I am using the following LUA command:

    setSteamAchievement(BUNKER_SECRET_1, {flags=1, 
        clear = true|false})
    


    I did check out the Wiki, but I am afraid I don't quite understand how "flags" or "clear" works. I am simply trying to call a script that would set a achievement with apiname BUNKER_SECRET_1 completed. Noteworthy that only thing I've done for adding Steam functionality right now is the script above. Should I prepare my project somehow otherwise for the Steam functions/api? The reason I am asking is that I read something about wrapper being needed, but I don't really understand what that means smile

    Newbie

    93 Posts


  • #2, by afrlmeSunday, 05. April 2015, 14:42 10 years ago
    Well, not really sure how to answer this. I think the wrapper is detected if game was launched via steam. I'm not entirely sure how that works as not needed to sort it out myself yet. As for the code.
    setSteamAchievement("BUNKER_SECRET_1") -- this will add the specified achievement to the players achievement list.
    

    ... you don't need to worry about the flags. By default the flag will return false, even if you don't add it. The flag "clear" is actually to reset the steam achievement. Here's a quick example of how to remove the achievement from the players account....
    setSteamAchievement("BUNKER_SECRET_1", {flags=1, clear = true}) -- this will remove the specified achievement from the players achievement list.
    


    You can actually query if steam was initialized too...
    if getProperty("steam_initialized") then -- if it returns true then...
     setSteamAchievement("BUNKER_SECRET_1")
    end
    


    Hope this helps, somewhat.

    Imperator

    7285 Posts

  • #3, by UraalWednesday, 22. April 2015, 21:09 10 years ago
    Hmm, my game is running in Steam and at start of the game I execute this script:

    if getProperty("steam_initialized") then 
    print("Steam has been found!")
    else 
    print("No Steam anywhere to be seen")
    launch_url()
    end
    


    launch_url() executes only if steam is nowhere to be seen and unfortunately it does open that website, meaning that Steam wrapper can't be accessed?

    I have not done anything/loaded/installed anything from Steam/Valve for this. Do I need to extract some files or something into my game's root folder before I can use or access Steam wrapper?

    Newbie

    93 Posts

  • #4, by BigStansThursday, 30. April 2015, 09:11 10 years ago
    if getProperty("steam_initialized") then 
    print("Steam has been found!")
    … do something here
    else 
    print("No Steam anywhere to be seen")
    … or do something here
    end
    


    The code is right, but did you read the steam documentation?
    You need to drop the .dll, so, dylib files from the steam SDK (available in the steam partner site) into the executable directory.
    This means:
    Under WIndows:
    yourgame/steam_api.dll
    Under Linux:
    yourgame/steam_api.so
    Under MacOS:
    yourgame.app/Contents/MacOS/steam_api.dylib

    Now, if you upload the game (with steam) with the shared library files, and if the api can be initialized (you see it if the overlay starts) , then it returns true smile

    EDIT:
    With the next visionare version we renamed the Steam commands from getSteamStat to getGameClientStat, because we have added an cool thing smile

    Great Poster

    361 Posts

  • #5, by UraalSunday, 03. May 2015, 16:45 10 years ago
    Thank you so much, bleh I had forgot that .dll file smile everything works just like it should now smile

    Newbie

    93 Posts

  • #6, by MachtnixSunday, 03. May 2015, 16:51 10 years ago
    Was ist denn "steam achievement"???

    Thread Captain

    1097 Posts

  • #7, by UraalSunday, 03. May 2015, 17:14 10 years ago
    Steam achievements found with games distributed through Steam. They are kinda like badge of honors for doing something extraordinary, but I've seen them being used other ways too (http://en.wikipedia.org/wiki/Achievement_(video_gaming))

    (Sorry I don't know a word German but I did google translate what you just said smile )

    Newbie

    93 Posts

  • #8, by BigStansMonday, 04. May 2015, 01:38 10 years ago
    And with 4.2 rename the word in the Lua Commands from Steam to GameClient, because we're supporting now Steam and Gog Galaxy smile

    @ Machtnix: Ein Achievement ist praktisch etwas "freischalten". z.B. aufheben einer Zahnbürste schaltet den "Spielfortschritt" frei.
    Die Spieler sammeln diese und spielen durchaus das spiel mehrmals durch um alle Achievement freizuschalten. Hört sich komisch an, iss aber so ^^

    Great Poster

    361 Posts

  • #9, by MachtnixTuesday, 05. May 2015, 02:03 10 years ago
    And with 4.2 rename the word in the Lua Commands from Steam to GameClient, because we're supporting now Steam and Gog Galaxy smile

    @ Machtnix: Ein Achievement ist praktisch etwas "freischalten". z.B. aufheben einer Zahnbürste schaltet den "Spielfortschritt" frei.
    Die Spieler sammeln diese und spielen durchaus das spiel mehrmals durch um alle Achievement freizuschalten. Hört sich komisch an, iss aber so ^^

    Kenn' ich von der PS3. Mehrmals durchspielen, um alle Trophäen einzusammeln. 10 Cyborgs mit Kopfschuss und Energieball töten... 30 Artefakte einsammeln... 10mal die blöde Tussi am Hangareingang ansprechen... 50 Kombiangriffe ausführen... Gottlob werden die Trophäen intern gespeichert... :-)
    Also gibt es in Visionaire jetzt soetwas wie einen zweiten Spieldurchlauf? (mit unendlicher Ammo und komplettem Inventar, z.B....) ;-) ;-) und freigeschalteten Bonus-Dungeons?

    Machtnix

    Thread Captain

    1097 Posts

  • #10, by BigStansTuesday, 05. May 2015, 11:57 10 years ago
    Genau. smile
    Bloß setzt Du halt vorher bei Steam oder Gog die Achivements fest.
    Die Client's machen dann ein Overlay und zeigen das an smile

    Great Poster

    361 Posts

  • #11, by hallinniklasWednesday, 29. July 2015, 21:07 10 years ago
    Hi all

    I am also struggling with this.

    I have the steam_api.dll in the game's folder. When I start the game via steam I get the "Access Steam while playing"- popup in the corner, so I'm pretty sure that works.

    My version of Visionaire is 3.7.1. The wiki says this should work since version 3.6..

    Do I literally just write it like in the attached screenshot? Or are there other ways to put code into your game? These are the first lines of code I have written in Visionaire.

    Thanks!

    Newbie

    15 Posts