WebAssembly module?

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

User avatar
Rob
Posts: 53
Joined: 01 Jul 2017, 07:33

WebAssembly module?

Postby Rob » 12 Nov 2018, 09:11

Any plans on publishing a wasm version of the api? I have started experimenting with WebAssembly and it would be neat to integrate SFS directly.

Since there's a C++ api, it could probably be used as a basis for a wasm recompile.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WebAssembly module?

Postby Lapo » 12 Nov 2018, 09:58

Hi,
we'll look into the WASM format as it becomes more prevalent and supported on various devices.

I don't think the C++ API is a good candidate however as it depends on low-level libs (socket libs, threading libs etc...) which I suppose can't be ported.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Rob
Posts: 53
Joined: 01 Jul 2017, 07:33

Re: WebAssembly module?

Postby Rob » 12 Nov 2018, 14:09

Lapo wrote:we'll look into the WASM format as it becomes more prevalent and supported on various devices.

WebAssembly is available on all major browsers today. Including the mobile ones. This is why I have started experimenting with it, since it has great potential for more advanced gaming being possible now.

I don't think the C++ API is a good candidate however as it depends on low-level libs (socket libs, threading libs etc...) which I suppose can't be ported.

The web APIs are not (yet) available natively in wasm. The standard solution is to have javascript glue code that interacts with the apis and talks to wasm. Here's a websocket example.

So while the networking is handled by the regular browser WebSocket API, all the logic would be in WebAssembly, which is why I mentioned that the existing C++ codebase could be useful. The low-level library calls could be replaced with calls to javascript instead. Tools like Emscripten also help converting existing code.

Threading is just being added, it's available in Chrome 70.

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 27 guests