Wintermute Engine Forum

Wintermute Engine => WME Lite => Topic started by: HCDaniel on October 13, 2018, 06:16:59 PM

Title: Proof of concept: WME lite engine running in browser
Post by: HCDaniel on October 13, 2018, 06:16:59 PM
Hi,

I have created a proof-of-concept port of WMElite to run in a (modern) browser. You can check it out here:

http://wmelite.bplaced.net/wmelitedemo/test.html (http://wmelite.bplaced.net/wmelitedemo/test.html)

The port is using Emscripten https://github.com/kripken/emscripten (https://github.com/kripken/emscripten) to compile the engine C++ code plus dependencies into JavaScript. Although I have not yet spent a lot of time for optimizations, it already seems to work well, without using too much resources. Nevertheless, there will likely be bugs.

Please try it and let me know what you think.
Title: Re: Proof of concept: WME lite engine running in browser
Post by: Mikael on October 14, 2018, 06:15:07 AM
Impressive! Works flawlessly here.
Title: Re: Proof of concept: WME lite engine running in browser
Post by: Mnemonic on October 14, 2018, 09:00:45 AM
Wow, I didn't expect to see anything like that. That's awesome. How does it translate the graphics/sound stuff?
Title: Re: Proof of concept: WME lite engine running in browser
Post by: HCDaniel on October 14, 2018, 09:44:54 AM
Wow, I didn't expect to see anything like that. That's awesome. How does it translate the graphics/sound stuff?

The overall concept of WMElite hasn't changed since you created it, with the exception of replacing BASS by SDL_Mixer, and the addition of audio processing libraries for sound effects. I did not need to do sth special for this port to work.

The major work is done by SDL2, audio is provided by SDL_Mixer, images by the freeimage library and true type fonts by the freetype library.

All the libraries and the WMElite engine compile with minor modifications using the emscripten tools.

The data.dcp is preloaded and provided in something called "emscripten virtual file system", eliminating the need to adjust file system operations in the WMElite engine.

So it's basically the emscripten port of SDL2 that does all the translation work, from opengles2 to webgl, and also handles audio output somehow. I did not even have to look at how it is done, it "just worked". (Well, ok, I had to adjust the game main loop, emscripten wants to use it as callback, an endless loop would block the browser).
Title: Re: Proof of concept: WME lite engine running in browser
Post by: lacosaweb on October 16, 2018, 02:36:43 PM
Great job! This is amazing!

Thank you!  ;)
Title: Re: Proof of concept: WME lite engine running in browser
Post by: Jerrot on October 19, 2018, 06:36:07 PM
Hah! Impressive!  :)