Page 1 of 2

Playing Keen Mods In Web Browser

Posted: Tue Mar 14, 2017 9:23
by Commander Spleen
Following on from discussion in Social Networking for Commander Keen Mods, this thread intends to explain the process for releasing Keen mods and other DOS software to be played in a web browser using em-dosbox in the same manner as the MS-DOS software library at

As well as a convenience to hardcore Keen fans, part of the idea is to make mods more accessible to a wider audience who might not have the knowledge or will to set things up as required to play the mods directly on their system. Hopefully it might even inspire them to do so.

I don't entirely recall the steps I took to set em-dosbox up, but I'm pretty sure the instructions on this page were my primary reference. These are instructions for Ubuntu 14, which also worked on Linux Mint 18 for me.

After setting this up, the process of adapting a game to a web page is fairly straightforward.

Code: Select all

[...]/em-dosbox/src $ ./ [package name] [directory] [main executable filename]
It's probably fine for the directory to be anywhere, but I copy it into the src directory for simplicity.

For example, for Keen Evaders, I copy the "keenev" directory into the em-dosbox/src directory and type:

Code: Select all

./ keenev keenev KEENEV.BAT
This outputs the following new files:

The other necessary files are already present in that directory, so it's possible to open the HTML file in a web browser and run the game locally. To make it available online, just upload the above two files plus dosbox.html.mem and dosbox.js. To save on bandwidth for now, I uploaded dosbox.js to my Public Dropbox folder and changed the line starting with "script.src =" in the HTML file to point to that URL.

Et voila: Play Keen Evaders in your browser!

If you have any troubles with getting emscripten and em-dosbox running, post here and we'll figure it out.

Fleexy: Regarding the central mod arcade project we discussed some time ago, all we need is a subdomain and FTP access and everything else is simple. I'd run it through my own web host but it's not really suitable for something this bandwidth intensive at the moment.

Re: Playing Keen Mods In Web Browser

Posted: Tue Mar 14, 2017 10:32
by Nisaba
yauz! this is neat.
thanks for sharing your knowledge.
I truly adore the idea! this could be a delicious update for the Keen-Wiki, don't your think?!

@Fleexy: do you think this could be done? I'd vote for it!

Re: Playing Keen Mods In Web Browser

Posted: Wed Mar 15, 2017 7:22
by Zilem
I recall seeing this Browser-doxBox linked with a dos game running in it can't recall which (Catacombs 3D or Hover Tank 3D), in an article

My younger cousin (11 years younger then me) didn't grow up with the Spreadsheet machine
as he grew up with Gameboy advanced > xBox and so on
but 1½ year ago he decided get a PC as modding for Skyrim was something he wanted
as he had seen youtube videos of a moded skyrim
so after assembling and setting up he's Rig. I decided to show him him 4 different version Doom:
> Doom with sound of 93 and original keyboard only controls
> Doom with fixed mouse aim (only turning) and modern keyboard controls
> Doom in GZdoom with modern mouse aim, and original sprite rendering but @1080p
> Brutal Doom with Metal music pack and Chaos map pack, with same GZdoom setup.

While all whipped the floor with him (Brutal Doom especially)
till i showed him how you ware meant to play, then it wasn't as bad
but it was clear he was used to slower FPS, like Halo
but he did had have a great time, and later have played a bit of Commander Keen
(likely due to seeing me tinkering with it on my laptop doing Christmas eve)

and with this you can pre-config Dosbox so the user can just "Click and play"
instead of dealing setting everything up yourself like we did in the olden days, till installers was forced on us
and one of the thing my cousin also liked was he just had to hit the .bat file and it executed the code within

Giving many people are not that PC savvy and rather want the console experience.
and as an PC technician, you more often help people with the most mundane things, then you think.
so, yes this can be a great bridge for non-savvy PC users to play old PC Games.
I suppose Dos let's players can use this to have a the setup they used avalible to those that want to tryout what they watched.

If it was possible to have it save your Score online, it would really bring the back value of the score screen
to be like what the modern games with score systems uses: Leader board
as when playing the online version of levellass' space invader i saw you on it was on the score board
so sparked with curiosity i hit F5, and saw that you now was the only non ID name on the scoreboard.

Re: Playing Keen Mods In Web Browser

Posted: Thu Mar 16, 2017 19:34
by Fleexy
I created a subdomain and set up FTP, but my hosting provider does not seem to have a way to restrict FTP accounts from uploading/modifying certain things (namely, .htaccess). Therefore, I can't currently allow FTP without opening security issues. I would be happy to upload and unpack archives you send me. Maybe I can work something out with my provider.

Re: Playing Keen Mods In Web Browser

Posted: Fri Mar 17, 2017 11:44
by Commander Spleen
If you can upload this JavaScript file somewhere and send me the URL, that'll keep a lot of the load off my host for now. I'll see how the actual usage affects my resources from there, and possibly look for other hosting options in the future if increased traffic becomes a problem.

Re: Playing Keen Mods In Web Browser

Posted: Fri Mar 17, 2017 13:12
by Fleexy

Re: Playing Keen Mods In Web Browser

Posted: Wed Mar 29, 2017 17:52
by Zilem
I have tried to get this to work for a 1-day joke Mod.
but obliviously i don't have Linux, I have Windows 7 and windows XP
and i don't know a thing about Linux... <.<

I have it working with JS-Dos, but that seems to have a memory Leak, and there is some mods it just won't launch with it.
and the hanging sound occurs if you switch to another tap... >.<

Re: Playing Keen Mods In Web Browser

Posted: Thu Mar 30, 2017 1:40
by Commander Spleen
It looks reasonably straightforward on Windows without having to install a full development environment, but I can't say for sure without having tried it myself. First, download and install emscripten from here. The portable SDK should be fine.

The next step after that is to get a copy of the em-dosbox source and compile it from within the emscripten command prompt. Hopefully the instructions under "Compiling" in the readme text below the file list should be enough, but there may be some extra steps I'm forgetting somewhere in between.

Re: Playing Keen Mods In Web Browser

Posted: Thu Mar 30, 2017 9:44
by Zilem
This area isn't my strong suit, and so far i have got more migraines then progress....
likely due to that I'm visual minded?...

I think i have done the installation of the emSDK, but i don't know as the guide kinda stops before it ends....
and then it just isn't used in the other?.... and i can't get past
since .sh that is not a familiar file-extension to windows, nor is there any links for what you need to run that.
(or if it even it Windows 7 compatible)

If there had been a guide from a windows user, i might had made it past this.
and instead been looking at what part of the Html's code that isn't needed. as it's 200 Kb+

where This is only 1 Kb, +27 kb for Javascript and +614 kb for the content package
(no this isn't the joke-mod.)

Re: Playing Keen Mods In Web Browser

Posted: Thu Mar 30, 2017 13:17
by Commander Spleen
It looks like this js-dos derives somehow from em-dosbox anyway. At a casual glance I can't tell whether there are any major differences in functionality, but it does have a nice tidy html file and much simpler process of generating new releases. You might as well continue using that since it's obviously working well for you. I'll try it out as well and compare with the raw em-dosbox approach.

Your mod in js-dos seems to run fairly smoothly. It started to lag a bit after a while on the first try while I was switching between tabs. Adjusting core speed didn't improve it, so it wasn't DOSBox itself at fault. Reloading the page fixed the issue and it has continued to run well despite more tab-switching.

Re: Playing Keen Mods In Web Browser

Posted: Thu Mar 30, 2017 17:04
by Zilem
Yeah, only added the background color to it, not a of clear white.

Yeah that was the memory leak i mentioned, although looking back i forgot to mention the likely cause <.<;
but yes it is related switching tabs and time it have been active.
although refreshing the tab didn't seem to work for Firefox, restarting Firefox does of course.
Also, some mods of the 5 i have tested with "Buried in Oblivion" "Episode -3" and "keen 10" don't seem to work
and I'm unsure whats up with that. they just stop at the launch .bat and just hangs there...
(and they work locally)

and EM-DoxBox don't seem to have that those issues, but also it's code is 203,2 times longer/larger.

Re: Playing Keen Mods In Web Browser

Posted: Sat Dec 09, 2017 4:34
by Commander Spleen
A few months ago I jumped ship to js-dos. It dynamically loads zip files so you don't need to generate a new set of files for every single project, and requires only minimal HTML allowing for simplified embedding.

There's no command line, and it halts after the first executable terminates. Some mods that have additional commands ahead of the main batch or exe need slight modification. Apart from that (and non-shareware episodes with no included binary) many should be able to run directly from the wiki if we were to embed it there.

Some test mods are operational here:

I'll be adding more soon and integrating it into the Commander Keen Mods site that is still in development.

Re: Playing Keen Mods In Web Browser

Posted: Sat Dec 09, 2017 5:51
by Roobar
In Firefox, when you press Alt for pogo, it brings the file menu down, thus making these mods unplayable.

Re: Playing Keen Mods In Web Browser

Posted: Sat Dec 09, 2017 6:00
by Commander Spleen
I haven't had that problem in Firefox, but it has been known to happen in Vivaldi. Maybe it's a Windows thing in this case. Does it do it in full screen?

I'll see if there's any way to override it.

Re: Playing Keen Mods In Web Browser

Posted: Sat Dec 09, 2017 6:39
by Roobar
Fullscreen works fine.