love-steam - Steamworks integration for LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

love-steam - Steamworks integration for LÖVE

Post by adnzzzzZ »

The main motivation for this repository is to hopefully have a central solution for Steamworks integration with LÖVE. The main solution that people always point to also doesn't work because it doesn't handle Steamworks' callbacks system properly, which means that you can't use the majority of the API.

And going through the forums I'd say about 10 people released their LÖVE games on Steam and each one of them had to come up with their own way of solving the problem. This is a big waste of effort and it'd be much better if everyone could use and contribute to a single version that is used in many games. The hope for me is that everyone who wants to release their games on Steam can come to this repository and use the already implemented functions as well as contribute with implementing parts of the API that they need for their games that aren't already implemented.

https://github.com/SSYGEN/love-steam
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by D0NM »

Starring your love-steam.
Thank you very much.


upd: I think that
Steam = require("love_steam")
should be moved into love.load func
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
Nelvin
Party member
Posts: 124
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: love-steam - Steamworks integration for LÖVE

Post by Nelvin »

Great idea - we're going to release our game on Steam at some point in the future, so thanks already.
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by drikdrok »

Awesome!! This will definitely save me a lot of headaches in the future!
Rickton
Party member
Posts: 128
Joined: Tue Mar 19, 2013 4:59 pm
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by Rickton »

I know nothing about C++, but I messed around with trying to get this to work in Linux. I made a small change to the code to to get it to compile, but haven't gotten it to actually work in LÖVE. I'll be looking at it more later, but here's what I have so far, as a starting place in case anyone else tries.

To get it to compile, in love_steam.cpp:

replace:

Code: Select all

__declspec(dllexport)
with:

Code: Select all

__attribute__((visibility("default")))
I was then able to compile into an .so by using:

Code: Select all

gcc -fPIC love_steam.cpp -shared -o love_steam.so
(You might need to install g++ to compile C++ code. It wasn't installed by default on my system)

Unfortunately, when I try to load the .so from lua, I get the error:

Code: Select all

error loading module 'love_steam' from file './love_steam.so':
./love_steam.so: undefined symbol: SteamAPI_RegisterCallback
My guess is I'm compiling it wrong somehow.
Possibly it's not including the code from the header files? Or I might need to somehow include the libsteam_api.so that comes from Steam?
I'm not sure, and I could be totally off. Like I said, I've never actually programmed in C++.
Possession - Escape from the Nether Regions, my roguelike made in LÖVE for the 2013 7-Day Roguelike Challenge
And its sequel, simply called Possession , which is available on itch.io or Steam, and whose engine I've open-sourced!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by bartbes »

Rickton wrote: Tue Sep 04, 2018 10:02 pm replace:

Code: Select all

__declspec(dllexport)
with:

Code: Select all

__attribute__((visibility("default")))
I would assume, considering you're setting the visibility to default, that you can simply remove the declspec, and it will work.
Rickton wrote: Tue Sep 04, 2018 10:02 pm I was then able to compile into an .so by using:

Code: Select all

gcc -fPIC love_steam.cpp -shared -o love_steam.so
Unfortunately, when I try to load the .so from lua, I get the error:

Code: Select all

error loading module 'love_steam' from file './love_steam.so':
./love_steam.so: undefined symbol: SteamAPI_RegisterCallback
You'll need to link it against the steam dynamic library. The easiest way, considering it's probably in some weird path, is simply to pass the .so file as extra argument to gcc.
In the likely scenario it can't find the steam library when you've done that, try setting the LD_LIBRARY_PATH environment variable to steam's path. I assume it automatically gets set when launching from steam.
Rickton
Party member
Posts: 128
Joined: Tue Mar 19, 2013 4:59 pm
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by Rickton »

bartbes wrote: Wed Sep 05, 2018 7:05 pm I would assume, considering you're setting the visibility to default, that you can simply remove the declspec, and it will work.
Yep, seems to.
bartbes wrote: Wed Sep 05, 2018 7:05 pm You'll need to link it against the steam dynamic library. The easiest way, considering it's probably in some weird path, is simply to pass the .so file as extra argument to gcc.
In the likely scenario it can't find the steam library when you've done that, try setting the LD_LIBRARY_PATH environment variable to steam's path. I assume it automatically gets set when launching from steam.
You know, I tried to do that, tried passing the location to both -I and -L, and tried setting the LD_LIBRARY_PATH, and just couldn't get it to find the file.
Then today I look again and see that when you use -l it automatically adds "lib" to the beginning, so when I tried to look for "libsteam_api" it was looking for "liblibsteam_api."

It seems to work now, thanks for the help!
Possession - Escape from the Nether Regions, my roguelike made in LÖVE for the 2013 7-Day Roguelike Challenge
And its sequel, simply called Possession , which is available on itch.io or Steam, and whose engine I've open-sourced!
User avatar
Pebsie
Party member
Posts: 144
Joined: Mon Nov 11, 2013 12:35 am
Location: Lincoln, United Kingdom
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by Pebsie »

I was literally just about to have to start doing this from scratch. Thank you endlessly from the bottom of my heart :awesome:
Website: http://peb.si
Twitter: @Pebsiee http://twitter.com/pebsiee
Steam: pebsie
User avatar
SiENcE
Party member
Posts: 805
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: love-steam - Steamworks integration for LÖVE

Post by SiENcE »

Btw. there is also a project called lua-steam and they provide already precompiled binaries: https://github.com/uspgamedev/luasteam
User avatar
darkfrei
Party member
Posts: 1197
Joined: Sat Feb 08, 2020 11:09 pm

Re: love-steam - Steamworks integration for LÖVE

Post by darkfrei »

SiENcE wrote: Wed Oct 17, 2018 9:09 am Btw. there is also a project called lua-steam and they provide already precompiled binaries: https://github.com/uspgamedev/luasteam
Thanks!

Could you please explain how to make steam stats, achievements and leaderboards? For example with as-small-as-possible-example.
For example
stats: "stat_1"
achievements: "NEW_ACHIEVEMENT_1_0"
Leaderboard: "Best Time" and "High Score"

Update: found https://luasteam.readthedocs.io/en/stab ... arted.html

:awesome: Place the luasteam.dll and steam_api64.dll to the Love folder: D:/Lua/love (near the lovec.exe)

See also: https://luasteam.readthedocs.io/en/stab ... stats.html
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests