ceifa / steamworks.js

A steamworks implementation for nw.js/electron games
MIT License
408 stars 66 forks source link

Possible to use steamworks.js with nwjs on Windows? #61

Open MikalDev opened 1 year ago

MikalDev commented 1 year ago

I am new to rust / napi-rs. I am trying to see if it is possible to use the precompiled steamworks.js node binaries or build new binaries to work with nwjs, instead of electron (I am using a build service which uses nwjs.)

I have tried nwjs with the npm node files on MacOS and it seems to work fine, with various versions of nwjs.

However on Windows, I can only get electron versions of my app to work.

When I try using steamworks.js with nwjs on Windows, the app crashes when loading the steamworks node binary.

I am able to build the node binaries on Windows, but I am not sure if I need to do something specific to get it compiled for nwjs (I did add nw to devDependencies with same version as my runtime (and removed electron), but that did not seem to help. Is there a step I am missing? I have seen comments about the possibility of different native node modules requiring different compiles on node vs electron vs nwjs.

ceifa commented 1 year ago

Related https://github.com/napi-rs/napi-rs/issues/1096

MikalDev commented 1 year ago

Thanks for the reference, it appears like this issue has been corrected 9 months ago and pushed into main, so I would have though that the napi-rs being used would now work with nw.js? The version I see being used in steamworks.js is "@napi-rs/cli": "2.14.4", which was released two weeks ago.

I have done local builds of the node files on Windows and I still get crashes. Any other thoughts? Have people gotten the steamworks.js npm module to work with nwjs already?

MikalDev commented 1 year ago

As I continue to research this, one thing I am considering is to see if I can target nwjs in a build using napi-rs or trying to use some intermediate files and building the final node file with something like gyp-nw. If anyone has experience with this, please let me know. I will also post a question over at the napi-rs repo.

ceifa commented 1 year ago

Related https://github.com/napi-rs/napi-rs/issues/1480

MikalDev commented 1 year ago

Checking in on this again, in the description of this project, it mentions nw.js, but I have not been able to get projects to work with nw.js on windows (on macos I have with nw.js and on electron I have projects work w/ windows and mac). Has anyone else had success using this project with nw.js and windows?

MikalDev commented 6 months ago

I have created a PR on napi-rs for nwjs detection. It looks like it may come in napi-rs 3.x. One change to note on napi-rs is that they deprecated ErrorStrategy. So steamworks.js will need some changes to support it when it becomes available (3.0 is still in beta)

https://github.com/napi-rs/napi-rs/pull/2042

ceifa commented 5 months ago

Just for tracking, there is a new PR by @MikalDev on napi-rs to solve this: https://github.com/napi-rs/napi-rs/pull/2053