Page 1 of 1

love-steam - Steamworks integration for LÖVE

Posted: Fri Aug 10, 2018 9:03 pm
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

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

Posted: Mon Aug 20, 2018 7:19 am
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

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

Posted: Mon Aug 20, 2018 9:28 am
by Nelvin
Great idea - we're going to release our game on Steam at some point in the future, so thanks already.

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

Posted: Mon Aug 27, 2018 7:49 am
by drikdrok
Awesome!! This will definitely save me a lot of headaches in the future!

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

Posted: Tue Sep 04, 2018 10:02 pm
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++.

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

Posted: Wed Sep 05, 2018 7:05 pm
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.

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

Posted: Wed Sep 05, 2018 8:51 pm
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!

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

Posted: Tue Oct 02, 2018 2:30 pm
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:

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

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

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

Posted: Sun Sep 26, 2021 9:27 pm
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