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

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: 201
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

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

Post by D0NM » Mon Aug 20, 2018 7:19 am

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). Follow @Zabuyaki.
Twitter @FaMeSoft / GP32 Free Platformer: SUPER PLUSHA
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:

Nelvin
Citizen
Posts: 51
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

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

Post by Nelvin » Mon Aug 20, 2018 9:28 am

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: 34
Joined: Sun Mar 15, 2015 9:53 am
Contact:

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

Post by drikdrok » Mon Aug 27, 2018 7:49 am

Awesome!! This will definitely save me a lot of headaches in the future!

Rickton
Party member
Posts: 110
Joined: Tue Mar 19, 2013 4:59 pm
Contact:

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

Post by Rickton » Tue Sep 04, 2018 10:02 pm

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 now has a Steam Page!

User avatar
bartbes
Sex machine
Posts: 4943
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post by bartbes » Wed Sep 05, 2018 7:05 pm

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: 110
Joined: Tue Mar 19, 2013 4:59 pm
Contact:

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

Post by Rickton » Wed Sep 05, 2018 8:51 pm

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 now has a Steam Page!

Pebsie
Party member
Posts: 136
Joined: Mon Nov 11, 2013 12:35 am
Location: Lincoln, United Kingdom
Contact:

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

Post by Pebsie » Tue Oct 02, 2018 2:30 pm

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: 764
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

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

Post by SiENcE » 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

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests