Tyrian in Your Browser – em-dosbox

Tyrian in Your Browser - em-dosbox

We still don’t have our flying cars, but we can run DOS games from 1995 natively in our browsers – this this is the future after all!

Click here to play Tyrian in your browser!

(Needs Firefox to run smoothly – for now…)

 spacer01


“Large enemy approaching!”

If you don’t know Tyrian, you probably never owned a 80486 PC – this game is awesome²!

I could go on for hours about why I think it might have been the definitive shooter on the PC platform – but instead I’ll get a bit more technical and just leave that to the youtube Tyrian review by Ross Scott.

Tyrian 2.1 is freeware, the original source and artwork have been released – opentyrian provides for ports for many platforms.

The enhanced and final version “Tyrian 2000” can be downloaded for free at gog.com.

spacer02


Emscripten

How does this black magic work?

Emulation of a suitable environment for the original DOS binaries is handled by DosBox which has already been ported for the Emscripten C++ runtime – see em-dosbox.

Emscripten is a C/C++ to JavaScript transcompiler. It compiles LLVM byte code to JavaScript and supports the asm.js standard – a JavaScript subset optimized for JIT and AOT compilation within modern JavaScript engines.

It already brings support for the standard libs, SDL, even OpenGL(ES 2.0) and more.

Calling this a mighty tool would be an understatement – at minimum it enables you to run your old C/C++ code in a modern browser – at best it powers a first person shooter like Q3 or even Webkit itself.

Hell, with a bit of help by Mozilla, it ran the Citadel Demo!

The fact that its not only possible to have a working C runtime in JavaScript, but also a relatively performant one is mind-boggling – the browser speed race has really done wonders for the development of modern JavaScript engines.

spacer04


Known Bugs

As for now, this experiment works only in FireFox – it works in Chrome, but the performance is just a bit too far below ‘playable’.

This is because Mozilla has developed OdinMonkey – a special asm.js optimizer for it’s ‘SpiderMonkey’  JavaScript engine.

If you really want to enjoy the sound and gameplay, FireFox is the only option :( (And you will still experience some fps drops)

Also, the network-game option does not work and the game may freeze when idling for multiple levels in ‘demo’ mode… or just randomly.

spacer03


 Jukebox

I also uploaded a version that loads the ‘setup.exe’ – allowing you to use the jukebox option at the bottom.

One of the best Features of Tyrian – enjoy the excellent soundtrack by Alexander_Brandon and the trippy visualisation.

jukebox


Why?

When I started to look at Emscripten, I immediately thought of porting  opentyrian to the browser.

Sadly, this proved quite time intensive – while certainly not impossible – and I had to keep this from becoming a full project. This was just meant to test-drive Emscripten and maybe share the results.

Still, I had a very crude version ‘running’ – or better showing parts of the menu and levels – when I found that DosBox was available.

So I dropped work on the port. Running the original binaries just feels more old-school anyway and now this was just a matter of compiling DosBox and packaging.

Granted – the result is still not ‘quite’ there yet – mostly because of performance issues – but Emscripten and em-dosbox already do a far better job than I hoped for.

Big kudos to all who contributed to that toolchain.


Good news everyone! [Edit 06.01.2015]

Tyrian has recently become part of the Internet Archive’s MSDOS game software library.
You can try their version here.

Unfortunately, it suffers from the same sound buffer issue but not only in Google’s Chrome but also in FF, music is disabled and it cashes while loading the first level (demo works though) :(

tyriancrash

But still, it is comforting To know that Tyrian will be preserved by the Opentyrian project AND the Internet Archive – as it should.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="">