[WIP] SteamBMC - Launch and play Steam games from XBMC (v1.0.0, buggy but works)

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #1
Here's the first release of an addon I've coded in the past few days to do something that I've wanted from XBMC for a while.

Purpose
Essentially this lets you play and launch any installed Steam game on your system. It also fetches artwork and logo images from the Steam server. No messing around with custom Advanced Launchers -- this handles everything automatically, and will fetch new games as they are added to your Steam account. It integrates into XBMC, unlike Big Picture. It's buggy, unlike Big Picture. Hopefully the last one will change.

Features
  • Automatically downloads the list of owned games from SteamCommunity.com
  • Launch games with a single click, all within XBMC
  • Downloads artwork where available (background fanart and logo)
  • Pretty fast to launch games, faster than waiting for the Steam client to start

[Image: X7k3l2x.png]

[Image: uf44b7A.jpg]

Known Bugs (It is an Alpha release!)
  • Sometimes XBMC crashes if you select the settings dialog or items; I'm not sure why and it's hard to consistently replicate. It just seems to shut down. Log file leaves no error message. This needs fixing before any final release, I'd appreciate if anyone has any ideas on why this happens.
  • If an artwork download is in progress and XBMC is quit, the download will continue until all art has been downloaded, even if the XBMC window is gone. This leaves XBMC hanging at 100% CPU on shutdown in some cases, though it does eventually finish after art has been fully downloaded.
  • There are compatibility issues (it doesn't open the games page) with 12.0, or at least my install of 12.0. Use of 12.2 is recommended.
  • Some non-Confluence skin issues when loading, but they go away once loaded. (I'm guessing these occur because the directory entry hasn't yet been defined. Perhaps defining an empty directory before loading will help.)
  • "Border Art" is buggy, and only currently works for wide logo scaling. Don't use it unless you HAVE to (some skins like to scale artwork out of aspect ratio. Most are fairly good with not doing this in my experience.)
  • Time-out for HTTP requests isn't generous enough for some requests.
  • "Playback Failed" may appear in some cases, even if the game launches successfully. This appears to be related to some kind of internal XBMC time out. If the Steam.exe process does not fork quick enough, XBMC thinks the playback was unsuccessful.

TODOs
  • Multiple Steam profiles (different Steam accounts with different games), perhaps with dynamic user-switching (all games in one page, from multiple accounts, with it logging into a different Steam account for each.)
  • Linux/OS X support. Coming shortly.
  • Game time, game ratings, game summaries, etc. Skeleton code for fetching game play time, but nothing more.
  • Clean up code. (Maybe try and pull apart the steamapi and XBMC parts...)
  • Cache games list -- avoid fetching too often.
  • Ability to hide games not wanted on the list.
  • Group games into categories e.g. Kid Friendly. (Maybe...)
  • Add your own fanart.
  • Select higher resolution fanart if available. (Currently, the code only finds the first fanart available, which may be crusty and low resolution. Try and find a 720p/1080p background, if available.)
  • Don't hammer the server too much, I should add a delay between requests...
  • Perhaps move from os.system to subprocess, if it works better on some platforms.
  • You can try and launch Steam games you haven't yet downloaded, and Steam will try to download them. Is this a desired feature? Seems it would be better to abort with an error -- need to see if there's a way to detect if a game is actually installed.
  • Changing the public URL doesn't get reflected after you leave the settings dialog. You need to leave the addon then enter it again to refresh that.
  • Blank icon necessary if no art available.

Set up
In your Steam profile, you need to create a public profile URL. This is then used to download the games list you own. On first run, you will be asked for this URL. You can also change it at any time in the Settings dialog.

Compatibility
Currently Windows only. However, support for Linux will be coming very soon, and would be trivial to add. I just need to get Steam running on my Linux box to give it a try. OS X can be added by anyone who has a Mac or can tell me what the default command line path and format for Steam is.

Download
ZIP for XBMC: http://code.google.com/p/steambmc/downlo...akechanges
Source (GPLv2): http://code.google.com/p/steambmc/source...teambmcdev

Standard disclaimer applies: this may kill you cat, burn down your house, yadadada, make proper backups and all that. It's alpha software, liable to frequent crashes.



Feedback warmly welcomed...
(This post was last modified: 2013-05-18 02:34 by tom66.)
find quote
zarooba Offline
Junior Member
Posts: 10
Joined: Nov 2008
Reputation: 0
Post: #2
This is awesome, additional ideas:

- Categories: support steam categories (rpg, free to play, etc)
- Game trailers / pictures / achievements
- Support game renaming (steam game titles don't sort well, ie: precipice of darkness 1,2,3 don't show in order, same with Price of Persia)
- Support multi game titles (a single entry in steam game list can actually be multiple games. ie: Commander Keen pack, when clicked to start, will popup a window asking which Keen to start)
- uplay games autplay (steam uplay restricted games, upon start, will start uplay, and then require additional click to start the game. Try to start the game from xbmc directly, by starting uplay, and the game within uplay)
- detect installed games ... there are people with 500+ games, and they can't have all of them installed at the same time
find quote
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #3
I think I need to modify the addon so everything is stored in a database, of sorts, and this is then updated. This would allow for easy renaming, removal, etc. As far as detecting installed games goes, this is difficult due to how Steam does not make this information easily available, however, the interim solution is to simply remove them from the database by selecting remove on each item (when that is added...)

Thanks for the suggestions
(This post was last modified: 2013-05-25 19:44 by tom66.)
find quote
cdizzel99 Offline
Junior Member
Posts: 23
Joined: Dec 2012
Reputation: 0
Post: #4
This is very cool, just one question:

1. It seems that when you launch a game from within XBMC this starts Steam and then launches the game, when quitting the game I am then taken back to Steam big picture. I then have to exit Steam Big Picture to exit back to XBMC. Is this the expected response? If so then I would add a suggestion to quit from the game back to XBMC.

Very excited to see this development started, just thinking recently about how cool it would be to do this from within XBMC. Thanks for the hard work.
find quote
cdizzel99 Offline
Junior Member
Posts: 23
Joined: Dec 2012
Reputation: 0
Post: #5
I am able to launch the first three games in my list however once I get to Assassin's Creed 3 I always get a script failed. Maybe has to do with the apostrophe in the title. The following is from the log.

4:36:50 T:4384 NOTICE: The Elder Scrolls V: Skyrim
14:36:50 T:4384 NOTICE: ['208480']
14:36:50 T:4384 NOTICE: <steamapi.SteamGame object at 0x149A4970>
14:36:50 T:4384 NOTICE: 219600
14:36:50 T:4384 NOTICE: NBA 2K13
14:36:50 T:4384 NOTICE: ['208480']
14:36:50 T:4384 NOTICE: <steamapi.SteamGame object at 0x149A44B0>
14:36:50 T:4384 NOTICE: 12200
14:36:50 T:4384 NOTICE: Bully: Scholarship Edition
14:36:50 T:4384 NOTICE: ['208480']
14:36:50 T:4384 NOTICE: <steamapi.SteamGame object at 0x149A4350>
14:36:50 T:4384 NOTICE: 208480
14:36:50 T:4384 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.UnicodeEncodeError'>
Error Contents: 'ascii' codec can't encode character u'\u2019' in position 8: ordinal not in range(128)
Traceback (most recent call last):
File "C:\Users\Christopher\AppData\Roaming\XBMC\addons\plugin.programs.steambmcdev\def​ault.py", line 122, in <module>
print game, game.game_id, game.game_name, cmd['game_id']
File "<string>", line 7, in write
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 8: ordinal not in range(128)
-->End of Python script error report<--
14:36:50 T:4360 DEBUG: ------ Window Init (DialogKaiToast.xml) ------
14:36:50 T:4384 INFO: Python script stopped
14:36:50 T:4384 DEBUG: Thread XBPyThread 4384 terminating
find quote
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #6
(2013-05-25 23:16)cdizzel99 Wrote:  This is very cool, just one question:

1. It seems that when you launch a game from within XBMC this starts Steam and then launches the game, when quitting the game I am then taken back to Steam big picture. I then have to exit Steam Big Picture to exit back to XBMC. Is this the expected response? If so then I would add a suggestion to quit from the game back to XBMC.

Very excited to see this development started, just thinking recently about how cool it would be to do this from within XBMC. Thanks for the hard work.

This may happen if Big Picture is the default Steam start up mode. On mine, when the game quits, it returns to XBMC. Please try with Big Picture disabled. Maybe I can add a command switch to disable Big Picture.

Steam is launched because although you can launch a limited number of Steam games by executing the executable directly, it does not work with all due to the DRM that Steam uses. It calls steam.exe --applaunch [application id] to launch the game. This means if the Steam client is not already running that launching the app will start it, which may take some time and also launch Big Picture. I may be able to get around any limitations of this by starting Steam in the background quietly if it is not already running.

I'll have a look at that bug. I think I need to add unicode support to SteamBMC as the apostrophe is probably not in the ascii charset.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #7
Yeah encoding is a big scary in addon development. If you encode everything you get from the web to utf-8 you should be fine

This is pretty damn impressive. Can you add an option to exit xbmc once the game launches?
find quote
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #8
I'll consider adding that. Is there a good use case for that? The option should not be enabled by default though, as it may confuse users.

New release coming shortly which fixes a lot of bugs. UTF-8 encoding is added where appropriate so there should be no more Unicode bugs. Also improves game launching with better error detect and initialises Steam when first run.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #9
There is for me, some games have trouble with my gfx card if there's a full screen app running in the back ground (Xbmc)
find quote
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #10
(2013-05-26 04:51)Bstrdsmkr Wrote:  There is for me, some games have trouble with my gfx card if there's a full screen app running in the back ground (Xbmc)

Wouldn't minimising do it? If XBMC is minimised, the rendering should stop.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #11
Usually, but sometimes it freezes when minimized. Services and etc still run too so I guess straight performance could be another use.
find quote
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #12
There's a check in with the quit and minimise option added along with some other options, under the Games sub menu. If you're feeling brave, copy the contents of the steambmc repo into an addon zip and try it out. I want to get a few more changes together before releasing 1.0.5, which should include the sqlite3 database and Linux support.

http://code.google.com/p/steambmc/source...5a80a19655
(This post was last modified: 2013-05-26 21:41 by tom66.)
find quote
Dark_Slayer Offline
Senior Member
Posts: 120
Joined: Nov 2012
Reputation: 2
Post: #13
(2013-05-18 02:28)tom66 Wrote:  Here's the first release of an addon I've coded in the past few days to do something that I've wanted from XBMC for a while.

Had you ever tried to use Rom Collection Browser?

It's been around a while and maintained by malte. It's also in python I believe. Perhaps you two could collaborate.

It's an addon originally targeted to emulators I believe, but you can make a simple PC games folder and let it scrape thegamesdb.net for artwork. He's added a "exit XBMC on launch" option called solo mode. You can add steam/origin game links to the PC games folder and use RCB to launch them. I've got a problem with my Origin game not launching when the mouse is unplugged, but otherwise it works for me
find quote
tom66 Offline
Member
Posts: 77
Joined: Feb 2013
Reputation: 2
Post: #14
So, does it combine Steam, Origin, etc. games all together into one app? Can it add them automatically?
find quote
Dark_Slayer Offline
Senior Member
Posts: 120
Joined: Nov 2012
Reputation: 2
Post: #15
(2013-05-28 19:10)tom66 Wrote:  So, does it combine Steam, Origin, etc. games all together into one app? Can it add them automatically?

Yes and at startup

All games into one addon (retroarch, project64, zsnes, mame, steam, origin, windows.exe, etc)

It won't go looking for anything you recently added into steam, but you can force an import or set to import at startup

some
links
find quote
Post Reply