greenworks
greenworks copied to clipboard
Electron support
Custom building Greenworks for latest Electron seams to work.
Calling greenworks.initAPI()
from steam works as intended.
Achievements: The Steam UI is not visible but the achievement is triggered on Steam.
Overlay: No UI or overlay is visible when triggering the API calls, it seams to be unresponsive and not working.
Question:
Most of the API calls seams to work but the visual ones.
Is there any overlay support for Electron with special workarounds
like the nw.js version or is just not supported at this current time?
If so, what are the special settings to get it working in Electron?
forceRefreshCanvas
diden't do the trick.
The game-overlay
doesn't work on Electron is a known issue. I have tried it serval times before, but failed. I don't figure out a solution yet. The working solution might be different with nw.js's due to the difference architecture between nw.js and electron.
We probably need some help from Electron's community and Valve for making game-overlay
works on greenworks.
Just some additional information here.
electron v0.31.2 is the last version that had the game-overlay
working (on Windows only - I don't think game-overlay
has ever worked on Mac OS/Linux for electron?). On electron v0.32.0 we can see the functionality broken. Is there an easy way to see what would be effecting this when looking at the diffs between the two? My personal guess is it's something Chromium related?
We seen the same unexpected broken game-overlay
functionality on NW.js for Mac OSX support between two versions (mentioned here https://github.com/greenheartgames/greenworks/issues/28) with little connection to it in the changelog/diffs.
@vaughnroyko This is the changelog between 0.31.2 and 0.32.0. There are probably lots of changes not listed here though.
- Upgrade to Chrome 45.
- Upgrade to io.js 3.3.0.
- Add partition attribute for
tag. - Add partition attribute for web-preferences option of BrowserWindow.
- The preload, zoom-factor, node-integration options of BrowserWindow have been moved to web-preferences option.
- Fix using Buffer created with external native C buffer.
- Fix exception when accessing process.stdout.
And here are the commits:
https://github.com/atom/electron/compare/v0.32.0...master
[Win7 Only] Seems like the problem is that all mouse/keyboard input is dropping through to the underlying browser-window when the steam overlay is open. If I have dev tools open when I trigger the overlay display, then I can still select things and type in the dev tools window in the background.
[EDIT: This describes a problem with win7 and electron 0.34.2, which the in-process-gpu switch fixes]
So I opened a ticket with electron about this. They responded that it's probably related to chrome, but promptly closed the issue.
We've found that it's possible to get the overlay working on Windows7 (using the method below). However, Windows8 and Windows10 both refuse to display the overlay at all.
Add this to main.js for the Win7 fix:
app.commandLine.appendSwitch('in-process-gpu');
Now I'm trying to figure out what would be different on Win8/10...
@bgSosh Thanks for your work on this.
We've found that it's possible to get the overlay working on Windows7 (using the method below). However, Windows8 and Windows10 both refuse to display the overlay at all.
Does this solution work on all versions of electron or just v0.31.2? I'm wondering whether game-overlay issue on Windows 8/10 is relevant to Steam. Could you try to use the solution described in http://steamcommunity.com/groups/SteamClientBeta/discussions/1/530646080844571939/?
@hokein In our tests the latest electron (v0.34.2) works properly with Windows7 if that switch is used. I haven't tried other versions yet.
Yeah it crossed my mind too that the difference between 7 and 8/10 could be down to steam itself. I'll try the solution in that thread and report back (though my Win8 is a VM from a fresh image).
@hokein The solution described in the steam thread had no effect unfortunately.
Since the electron guys are suggesting that it's probably a chrome change that broke things, it might be interesting to test on NW.js v0.13.0-alpha4 (not alpha5), which is using Chromium45 (same major version as current electron). If there's no problem there, then it would suggest some electron breaking change, rather than chrome/chromium.
Hey guys, I'm working on a project with electron that will lead me to integrate with Steam so this is very relevant to my interests...
- Have you guys made any progress since November?
- Is this still the only node/webkit/electron steam library?
- Did you you guys end up going back to NW or end up using electron here?
Thanks!
@framerate We are in a situation which isn't ideal, but we are doing what we can in our team. We are about to release a product on Steam with the following situation:
- Electron v0.31.2 used (fairly old at this point).
- Windows 7/8/10 has overlay working.
- Linux/Mac OSX overlay does not work (we have fallback to not use the overlay for those platforms).
This is the best configuration we could find with what is available currently.
Did you find that > 31.2 didn't work with the overlay at all?
What seems to be the problem that won't allow the overlay on Linux/Mac? Maybe I can help when I get to that point.
@framerate That is correct. We could not get anything past 31.2 to work with the overlay in all Windows 7/8/10 together. It's been awhile though, I can't quite recall on the Linux/Mac OSX side. It simply did not work trying all sorts of different args/switches - and in some cases with the args/switches, it would crash Electron. My information may be out of date though, I'll reply after trying some of the new Electron builds.
At this point, I'll pay/reward anybody that can get Electron to run the Steam Overlay across all platforms. But I feel it's like a mixture of Steam and Chromium itself and all the money I could offer wouldn't actually get it solved, hah.
@vaughnroyko Thank you, sir. I'll have my electron app running in alpha state this month but it may be a while before I get to integrating in steam. I'm more than happy to try and help when it gets to that point.
I'll watch this thread in the meantime!
@vaughnroyko @framerate @bgSosh @hokein Sorry to ping everyone but has anyone had any luck getting this to work on Electron? We are trying to integrate payments via Steam in our app and without overlay support, it seems like it is impossible. I've tried various versions of Electron with no luck (hoping to have Windows and OSX support).
Looking on the Steam forums - it doesn't seem Valve is interested at all in supporting Chromium based solutions. What are our options here? Not really sure where to begin trying to solve this problem but we are definitely willing to put up a bounty on this.
@marwanhilmi Overlay is working once again in the newest Electron on Windows (using a few tricks); however, still no luck on the OSX/Linux side of things, so we are currently using a workaround which involves launching a webpage in their default browser/application on those platforms. Not the best solution obviously, but we are kind of at the mercy of Electron/Valve and I think it's too obscure of a use case for either to pay attention to the issues.
I'll gladly tip/fund anybody that helps fix the issue :)
@vaughnroyko
(using a few tricks);
Could you post those tricks so they're ready when I need them? O.o
@vaughnroyko You mean Electron 1.2.x?
@marwanhilmi Yep! Although we haven't tried the latest versions 1.2.x+ as of yet. Hopefully they are still working. We are currently on the release before 1.x but we tried right after and it did work.
@framerate
We use the following switches: in-process-gpu
and disable-transparency
- although I'm unsure if those still actually have an effect. Can't test at the moment.
As well as two refreshing canvases so the screen is always being updated (a requirement for the Steam overlay). Two single pixel canvases, one in the left top, and one in the bottom right. These are setup in an requestAnimationFrame and just have a clearRect executed on them. We tried using a single canvas that is just the size of the screen, but clearRect is abysmally slow, so the less it clears, the better.
@vaughnroyko My prototype is developed using react and the virtual dom for rendering. Am I understanding that I have to use canvas/double buffering instead for steam?
@framerate Sorry, should of mentioned. that is just what we needed to do since we don't constantly update/render in our game. If you have a canvas (gpu-enabled css transform stuff works too), that is constantly being updated/re-painted, then you won't need the canvas refreshing trick. All depends on your game I guess.
Hmm. yeah it's just a card game (like Heartstone) but simpler, UI-wise. I only currently update/render when the game state changes. So I'm assuming that's going to be a problem? Or am I misunderstanding?
@framerate Yep, then you will need to do the canvas trick/fix. Unless you can find another solution.
@vaughnroyko so if I'm understanding, I can just do 2 pixels in the corner of the React-JS UI I have now that constantly refresh and that'll do the trick?
We had to the same in Game Dev Tycoon when we show popup windows. Normally the canvas would then stop updating since no animation is playing but the Steam overlay requires a redraw to function. To summarize: You can absolutely use the DOM to do your game but for the Steam overlay to work properly, it's best to add two little canvas elements (as @vaughnroyko described) and refresh them every frame.
I don't think that we use any of the mentioned flags though, so not sure if those are really necessary.
Just want to update with my results @framerate @vaughnroyko. So far from my testing - it appears the steps you mentioned are required. No luck on OSX but Windows can work.
The window does need to be refreshed on every frame for the overlay to work correctly, it can otherwise get 'stuck' on the screen. Having things like the dev tools open may also cause issues. It also appears just moving or resizing the window will 'unstick' the overlay.
Furthermore, the in-process-gpu
flag is definitely required. I've tried various other combinations of settings but no luck without in-process-gpu
. I believe Steam can't figure out how to hook into Chromium's GPU process if it is running separately.
Unfortunately, I am having problems with the in-process-gpu
flag. On Electron 1.1.x, our WebGL application will completely lock up frequently with the flag enabled. I've had success with Electron 1.2.x on OSX but not able to get 1.2.x working on Windows (Chromium seems to have broken hardware acceleration for me).
Have you guys had any luck with the in-process-gpu
flag and noticed any performance / stability issues? I've had difficulty finding documentation on exactly what it does and if there are any alternative solutions.
Has anybody been able to build for Electron 1.3.3, Steamworks 137, Greenworks 0.5.3?
I was able to create the build; at least the npm returns successfully and creates a greenworks-win32.node. When trying to require it in code, the import fails due to a missing module, even though the file is there. I read somewhere that this might be to missing dll files, so I copied the steam sdk dll into the root folder of the electron app. Now the module seems to be found, but I get the a "Devtools was connected from page" error dialogue as soon as I import the module now.
I don't get any output on the console, now on the command line. I have no idea how to proceed at the moment. If somebody could maybe upload the .node file for the mentioned release configuration that would be great as it would allow me to check if the error is on my end or not. Also any comments welcome.
@riadd, could you try to use the prebuilt greenworks binary v0.6.0 for electron? It works fine for me on electron v1.3.3 ia32 on windows.
@hokein Thanks again. The prebuilt binary works, at least I'm not getting a crash anymore and the module can be imported properly. I'm still unsuccessful at bringing up the overlay though when starting the game through steam. I have a canvas that is drawn in every frame, so that shouldn't be the problem.
@marwanhilmi How do you apply the --in-process-gpu flag? Just adding it via command line or through a config file as with nw.js?