u/cip_games

Tutorial on how I implemented a Wishlist button for my Steam game, with the luasteam library
▲ 14 r/love2d

Tutorial on how I implemented a Wishlist button for my Steam game, with the luasteam library

Hello,

I shared this tutorial on how I implemented a Wishlist button for my Steam game on the LÖVE forum (link), but I thought that I could share it on Reddit as well. I think that such a button can increase the overall wishlists for your game. This link has a helpful discussion on this topic.

The code I am about to post is based off of a helpful post from Reddit.

I am using the wonderful luasteam library.

Also, if you would like to see how I implemented luasteam in my LÖVE games, I have created a tutorial for this here. If you are following the linked tutorial, as I mentioned in the forum post, please take note that I have switched to a newer version of the luasteam library, so capitalization for the functions has changed. For example, instead of calling Steam.init() you would need to call Steam.Init().

The first step is to require the luasteam library and to create a global variable, in our main.lua, before love.load(),

Steam = require 'luasteam'
initializedSteam = false

And then, inside the love.load() function,

initializedSteam = Steam.Init()

And now for the actual button. Creating buttons and implementing the logic behind them is out of the scope of this tutorial, as most likely everybody has their own ways of implementing them. So, like you would have a button for starting your game, for entering Options, etc., you will need to implement a similar logic for this Wishlist button. Let us assume that you have a button object, and you might have something like this when you select the button,

if self.text == "WISHLIST" then
   local url = "https://store.steampowered.com/app/3840860/Combo_Vectors/" 
-- !!! REMEMBER TO REPLACE THIS URL WITH YOUR GAME PAGE HERE, THIS IS JUST FOR DEMONSTRATION PURPOSES !!!
   if initializedSteam then
      Steam.Friends.ActivateGameOverlayToWebPage(url, 0)
    else
      love.system.openURL(url)
   end
end  

Please also check out the official documentation for this function on the Steamworks website as well.

For UX/UI purposes, I decided to add some text that describes what will happen if someone clicks this button. For example, when hovering over the Wishlist button, I used the following texts,

Wishlist button example

If you would like to check out the game from the screenshot, here is a link to the game, Combo Vectors.

If you have any questions or feedback, please let me know! Thanks.

reddit.com
u/cip_games — 13 days ago