## love-steam - Steamworks integration for LÖVE

Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

### love-steam - Steamworks integration for LÖVE

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
D0NM
Party member
Posts: 247
Joined: Mon Feb 08, 2016 10:35 am
Contact:

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

Thank you very much.

upd: I think that
Steam = require("love_steam")
should be moved into love.load func
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
Nelvin
Party member
Posts: 118
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

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

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

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

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

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!
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

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

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!
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

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

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

Btw. there is also a project called lua-steam and they provide already precompiled binaries: https://github.com/uspgamedev/luasteam

### Who is online

Users browsing this forum: No registered users and 21 guests