Advanced users tutorial: Unlockable Steam achievements

Discussion in 'Visual Novel Maker Tutorials' started by Tuomo L, Sep 21, 2018.

  1. Tuomo L

    Tuomo L Oldbie Veteran

    Messages:
    2,278
    Likes Received:
    1,235
    Location:
    Finland!
    First Language:
    Finnish
    Primarily Uses:
    RMMV
    Warning, this is for advanced users only. This is NOT a plug and play, you do need to know what you're doing or else your achievements won't work.

    If you still need help setting this stuff up and cannot make this on your own, I can offer assistance with my publisher services

    Prequisities

    • Steam Appid for your VN which you can pay for at Steamworks (Costs about 80€).
    • Active Steam account with which to test your achievements on
    • Understanding of Steamworks, depots and branches, this is not a tutorial how to setup your game on Steam
    • Understanding of at least basic levels of Javascript for debug purposes
    • Understanding of basic computer terminology such as root folder

    Preparations

    Download the following zips

    • https://dl.nwjs.io/v0.26.6/ <- Pick SDK version for the OS that you use. The SDK will be used to test your achievements and functionality, when actually releasing your games you want to use the regular version instead.
    • https://github.com/greenheartgames/greenworks/releases <- Pick the 0.266.6 version for the OS that you use
    • Steamworks SDK version 1.41 <- You can find this when you become steam partner under "View SDK change notes"
    Go to Steamworks and create a new achievement. For purposes of this, call it "Test" without brackets. Be sure to publish your changes or else it will not be obtainable.

    Error Check: Make sure you don't have brackets in your api name.

    Scripting

    Make a new Coffee Script in your VN, call it "Achievements" or something as equally easy to identify. Copy and paste this code exactly as is.

    Code:
    greenworks = (require||requireNode)("./greenworks")
    greenworks.init()
    Next, go to the scene where you want to insert your achievement. For purposes of the test, we'll go to the very first scene, at the top of the load order. Now, use script call and use

    Code:
    greenworks.activateAchievement("Test", function() { console.log("Success!")}, function(err) { console.log(err) })
    You replace "Test" with the name of Api name you have setup in the previous step.

    Error check: Make sure you have quotation marks in the script call around your achievement's Api name.

    Export project

    Now export your project as you normally would. Then go to the exported folder and do the following
    • Replace all files with the ones from your downloaded Nw Js version. Delete Game.exe
    • Export the contents of greenworks into the root of the exported folder
    • Open your Steamworks SDK and go to redistributable bin. Go into the folder of the OS you run and copy the contents in the lib folder of your exported project's root folder that contains greenworks node file.
    • From the SDK, go to public->Steam->lib->your OS-> and copy all the files inside to the place with greenworks node.
    Next, go to your project's root folder and create a text file called "steam_appid" exactly like that. Inside, only write your appid number, nothing else.

    Error check: Make sure you have extensions visible and that your full text file name with extensions should be "steam_appid.txt"

    Testing the project

    Run nw.exe and press F12.

    Run the following console command

    Code:
    console.log(greenworks.getAppId())
    Make sure the AppId is correct, if it is not you need to go back and check your steps, you've done a goof somewhere.

    Next, start a new game while still having the console window open. It should tell you "Success!" but if it says anything but that, you need to address the issue.

    If you now go to your Steam library and check the game out, it should tell you that you've gotten the achievement. Congratulations, you've done it! Now, all you need is copy the rest of the achievements and set each of them the same way.
     
    #1
    gRaViJa and SimProse like this.
  2. gRaViJa

    gRaViJa Veteran Veteran

    Messages:
    732
    Likes Received:
    265
    Location:
    Belgium
    First Language:
    Dutch
    Very valuable information! I bookmarked it in case I ever get to the state where I need this :)
     
    #2
  3. kory_toombs

    kory_toombs Villager Member

    Messages:
    17
    Likes Received:
    14
    First Language:
    English
    Edit:

    I finally got it done.

    Note: This tutorial is a bit out of date. I might be making a new one sometime in the future.
     
    Last edited: Jun 15, 2019 at 2:58 AM
    #3

Share This Page