Uzem ported to HTML5/JavaScript

The Uzebox now have a fully functional emulator! Download and discuss it here.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by Artcfox »

uze6666 wrote:Pretty awesome stuff, thanks for the explanation. I had heard about it and asm.js, but it's the first I see something out of it.
According to the porting examples and demos page, the entire Unreal Engine 3 was ported in 4 days, and as of May last year they got the Unreal Engine 4 working. Asking it to render and display a single scaled texture for Uzem should be peanuts compared to running Unreal Engine 4!
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by nicksen782 »

This is awesome! I tried to set this up some months ago but I couldn't get it to compile (probably because of the environment that I was using.)

Thanks for this.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by Artcfox »

nicksen782 wrote:This is awesome! I tried to set this up some months ago but I couldn't get it to compile (probably because of the environment that I was using.)

Thanks for this.
No problem! If you have the RAM (my desktop has 32 GB), I recommend doing it inside a Debian Live CD (I used debian-live-8.2.0-amd64-gnome-desktop.iso). The Emscripten website has great instructions for getting the environment setup for Linux. The next time I reboot my computer I'm going to lose the environment, but now that I know it works I'll take notes the next time I set it up from scratch, and those notes should be good for both the Live CD, and for a normal hard drive install of Debian.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by Artcfox »

For my next trick I merged Uze's recent speed improvements to the uzem140 branch with Jubatian's crazy speed improvements on his uzem140-hacks branch, and then figured out how to get an SDL2 app to compile using Emscripten. :D

And then I figured out the real trick!

Don't use Chrome. Use Firefox on a fast computer.

Image

Firefox is capable of playing it at full speed.

There is still a slight audio static sound going on, but it's not too terrible.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Uzem ported to HTML5/JavaScript

Post by CunningFellow »

Yes - Firefox does it.

3.6ghz quad core i7 wont run full speed in Chrome

Has no problems in Firefox.

This is awesome having the emulator in a browser. As you said - you can put playable versions of the games on the wiki page :)
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by uze6666 »

Won't run full speed on my other machine, a 3ghz Core2 duo. Firefox is indeed faster than chrome by perhaps 20%. Almost there!
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by Artcfox »

uze6666 wrote:Won't run full speed on my other machine, a 3ghz Core2 duo. Firefox is indeed faster than chrome by perhaps 20%. Almost there!
Based on the stuff going on in the other optimization thread, I think it might be possible with some more algorithmic improvements.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by Artcfox »

Using Jubatian's newest uzem140-hacks-01 branch (since it's even faster now that write_io and read_io have been optimized, and the pixel output has been inlined, and the timer code has been optimized!) I went back and re-packaged and re-uploaded all of the Asm.js games I had posted in this thread. The sounds are much improved now, and the speed is phenomenal!

I also added Joyrider. :D

Here are the games all together in a convenient list:
Lode Runner
Megatris
Bugz
Joyrider
Alter Ego

And both Firefox and Chrome can run them well!

Edit: I fixed the undefined behavior in SDEmulator.cpp, and now Alter Ego works!
Last edited by Artcfox on Mon Oct 12, 2015 2:23 am, edited 2 times in total.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Uzem ported to HTML5/JavaScript

Post by D3thAdd3r »

Artcfox wrote:(Unfortunately, when I tried to package Alter Ego, all it says is "SD ERROR" despite including the aedat.bin file along with the ROM and the eeprom.bin file. I'm not sure what that's about, as everything runs fine when using the native build.)
Not sure if it will help, but I think it it still one of the few things that actually uses PetitFS. SD ERROR should give a number which will tell where it failed, if it is 0 then it failed to mount if I recall.

Off the top of my head, the only other thing using PetitFS is this, I wonder if that works?

Edit-did some optimizations get done to the SPI code at all?
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzem ported to HTML5/JavaScript

Post by uze6666 »

Awesome!!! :D That's a big thing. When announcing a game, folks will be able to play it on the spot in their browser. Really cool.
(Unfortunately, when I tried to package Alter Ego, all it says is "SD ERROR" despite including the aedat.bin file along with the ROM and the eeprom.bin file. I'm not sure what that's about, as everything runs fine when using the native build.)
I suspect this have to do with the sd card and SPI emulation. Can emscriptem enulate those? You can try any game with sd requirements like Uzeamp, Uze8 etc. I assume they won't work either.
Post Reply