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 » Tue May 31, 2011 2:52 pm

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: 1967
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Post by sev » Tue May 31, 2011 5:41 pm

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 » Wed Jun 01, 2011 3:38 am

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 » Wed Jun 01, 2011 11:46 pm

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 » Thu Jun 02, 2011 12:00 am

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 » Fri Jun 03, 2011 2:55 am

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 » Tue Jun 11, 2013 12:26 pm

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: 1967
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Post by sev » Tue Jun 11, 2013 2:44 pm


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

Post by juj » Tue Jun 11, 2013 2:50 pm

Thanks sev!

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

Post by OmerMor » Tue Jun 11, 2013 6:43 pm

Amazing!

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

Post by OmerMor » Tue Jun 11, 2013 8:15 pm

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 » Thu Jun 13, 2013 9:15 am

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: 132
Joined: Mon Oct 01, 2007 4:14 pm

Post by lazylazyjoe » Sat Jun 15, 2013 2:09 am

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