ScummVM in JavaScript?

Discussion about other and unofficial ports of ScummVM

Moderator: ScummVM Team

Post Reply
shurlogg
Posts: 18
Joined: Sat Jun 09, 2007 2:03 pm

ScummVM in JavaScript?

Post by shurlogg »

A JavaScript port of ScummVM may have actually become a lot easier to do than it used to:

https://github.com/kripken/emscripten/wiki

Aparrently, some awesome people have created a tool called Emscripten that compiles LLVM bytecode to JavaScript, so in theory anything that can be compiled with LLVM (including C/C++ code) could be translated to JavaScript. The developers say that it probably still has lots of bugs, and is about 90% slower than the original code, but it may be a first step that could ultimately result in ScummVM running in a web browser.
User avatar
sev
ScummVM Lead
Posts: 2304
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Post by sev »

MinGW-built stripped ScummVM binary with all engines and features enabled (SDL port) takes about 20M in size. Fat chance for JavaScript.


Eugene
agf
Posts: 8
Joined: Fri May 13, 2011 5:39 am

Post by agf »

The project apparently has built in SDL support, so I wonder if a one-engine build with the simplest engine and all features turned off might work?

Does ScummVM work with LLVM-gcc and/or Clang?

Edit: Yeah, works fine with llvm-gcc.
NovaCoder
Posts: 74
Joined: Wed Sep 23, 2009 11:53 pm

Post by NovaCoder »

Well if you can get Quake 2 running in a browser, I guess it must be possible to get ScummVM online :wink:

I'll then be able to play DOTT all day at work, awesome :P
agf
Posts: 8
Joined: Fri May 13, 2011 5:39 am

Post by agf »

NovaCoder wrote:Well if you can get Quake 2 running in a browser, I guess it must be possible to get ScummVM online :wink:

I'll then be able to play DOTT all day at work, awesome :P
That's not really running in a browser, and it's not the original source code. It's running in the Java VM and it's a source port to Java.

JavaScript ScummVM would be way cooler :).
NovaCoder
Posts: 74
Joined: Wed Sep 23, 2009 11:53 pm

Post by NovaCoder »

agf wrote:
NovaCoder wrote:Well if you can get Quake 2 running in a browser, I guess it must be possible to get ScummVM online :wink:

I'll then be able to play DOTT all day at work, awesome :P
That's not really running in a browser, and it's not the original source code. It's running in the Java VM and it's a source port to Java.

JavaScript ScummVM would be way cooler :).
No actually the Quake 2 port is using Javascript...
Quake II GWT Port¶The Quake II GWT port brings the 3d gaming experience of Quake II to the browser.
In the port, we use WebGL, the Canvas API, HTML 5 <audio> elements, the local storage API, and WebSockets to demonstrate the possibilities of pure web applications in modern browsers such as Safari and Chrome.

The port is based on the Jake2 project, compiled to Javascript using the Google Web Toolkit (GWT).
Quake 2 port

So it's gone C++ > Java > Javascript :D
juj
Posts: 3
Joined: Tue Jun 11, 2013 8:52 am

Post by juj »

Hi,

I have now finished a first version/proof-of-concept port of ScummVM over to Javascript using the Emscripten compiler. (I am a Windows maintainer of the Emscripten project, so I've gotten quite familiar with the toolchain over time)

The demo works best in the desktop Firefox browser. The optimized code size for scumm0-6 engine turned out to be about 8MBytes.

The demo link and a technical discussion thread about the port can be found on the emscripten-discuss google mailing list.

Unfortunately I am not able to provide a link because the forum rules suggest I should first contribute a number of forum posts without links before I am empowered to posting a link. I don't think it makes much sense for me to spam a number of threads just to get around an anti-spam feature, so perhaps someone with those powers can find the demo URL and post the link here. Sorry about that, but I didn't make up the forum rules. :/
User avatar
sev
ScummVM Lead
Posts: 2304
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Post by sev »

juj
Posts: 3
Joined: Tue Jun 11, 2013 8:52 am

Post by juj »

Thanks sev!
OmerMor
Got a warning
Posts: 176
Joined: Thu Nov 17, 2005 9:29 pm
Location: Israel
Contact:

Post by OmerMor »

Amazing!
OmerMor
Got a warning
Posts: 176
Joined: Thu Nov 17, 2005 9:29 pm
Location: Israel
Contact:

Post by OmerMor »

juj,
do you believe it'll be possible to port munt into javascript as well? Of course it'll be very cpu intensive, but scummvm+munt is a winning match.
juj
Posts: 3
Joined: Tue Jun 11, 2013 8:52 am

Post by juj »

I am not familiar with munt, but had a quick look at it. Briefly looking, I don't see anything fundamentally limiting. Generic C/C++ code that does audio wave buffer synthesization without resorting to platform-specific code should be easy to get compiled.

The only thing is that to actually play out audio from the speakers, one needs to use OpenAL or SDL Audio - these are the only currently implemented audio backends to Emscripten, or develop a custom Web Audio -based JS sound API. There is no OSS/ALSA/other linux audio API support in Emscripten, so any code interfacing with those will not work.
User avatar
lazylazyjoe
Posts: 131
Joined: Mon Oct 01, 2007 4:14 pm

Post by lazylazyjoe »

I tested the MI1 demo with my android phone using the standard web view browser and it seemed to work well.
Nice job and good luck !
Post Reply