Open Source Software Brings Classic Gaming To Your Browser

dune_feat

By combining multiple open source projects, some know how, and a love for retro gaming, developer Aleksander Guryanov has been able to bring the groundbreaking real time strategy (RTS) game Dune II into modern web browsers.

While unquestionably a fun diversion for classic gaming aficionados, this project is more importantly an excellent demonstration of the incredible capability of the modern web and flexibility of open source software.

OpenDUNE

Dune II was released for MS-DOS in 1992 and while it wasn’t the RTS ever released, it did lay the groundwork for most of what we now take for granted in the genre. Features such as context sensitive controls, resource gathering, and building dependencies were introduced in Dune II and have continued on in basically every RTS since.

The game is so popular with RTS players that in 2009 a project was started to create a GPL implementation of the Dune II engine which would use the original game resources (artwork, sound effects, etc). This new project, aptly named OpenDUNE, would not only allow modern computers and operating systems to play this 20+ year old game, but also make updates and improvements using more modern development methods and technologies.

Development of OpenDUNE has continued ever since, and as of December 2012, the project made its source available on the popular social development site GitHub so other developers could more easily submit patches and follow the project. If the commits are any indication on GitHub, the move has gone very well for the project in terms of activity, and according to the official blog; a new stable release could hit within a month or so.

The availability of the OpenDUNE engine, written in the portable C language and licensed under the GPL, opens up the possibility of porting the game to new devices and platforms that didn’t even exist at the time of the game’s original release. Already, developers have put together ports to SymbianOS, Maemo, and talk on the forums has pointed to a possible iOS build in the future.

Emscripten

Taking OpenDUNE, cross-compiling it for a different architecture, and fixing any compatibility issues that come up is one thing; but how do you get it to run in a web browser? To make the leap from C to a web-compatible language (in this case, JavaScript), Aleksander used a ingenious piece of software called Emscripten.

The first step is to take your C program and compile it into what is known as LLVM (which stands for, somewhat inaccurately, Low Level Virtual Machine) with either llvm-gcc or clang. The LLVM code is then run through Emscripten to create the final JavaScript. With JavaScript in hand, it’s relatively easy to get that hosted up on a site and running from within the browser.

Looking Ahead

Technology to take existing C Linux applications, and with only slight modifications, get those running in a modern web browser with JavaScript, holds incredible promise. As software becomes less and less focused on the local machine and moves into the “cloud”, being able to move existing software into a browser-based environment will save development time and break the traditional limitations of platform and operating system.

This technology is certainly not limited to games (though Aleksander has also given OpenTTD the web treatment), and hopefully will become more common in the future.

Deploying software in this method could let you take an existing application written in a language like C or C++ and have it work the same whether it was loaded from a browser on Linux, Windows, or a mobile device; completely skipping over the native development environments for each respective system.


Tom Nardi

Tom is a Network Engineer with focus on GNU/Linux and open source software. He is a frequent submitter to "2600", and maintains a personal site of his projects and areas of research at: www.digifail.com .

Top