---
{
  "title": "Now Playing: \"Camp Happy Island Massacre\" for DOS",
  "date_pub": "2018-10-29T12:03:00-04:00",
  "date_upd": "2018-12-03T19:29:00-05:00",
  "tldr": "I wrote a simple computer game in 1997 called <strong>Camp Happy Island Massacre</strong> which I now have running online <a href='/chim/index.html'>here</a>.",
  "content_type": "journal",
  "tags": "DOSBox chim games js WebDev"
}
---

Way back in 1997, I released my first (and, so far, only) computer game, **Camp Happy Island Massacre** (hereafter referred to as #CHIM), a comedy-horror text game for the DOS operating system. Originally written while I was still in college, the game is about a cursed summer camp and the 3 surviving counselors who try to stop a horrific force before it claims them. I put it out for free (more-or-less) on the [internet of 1997](https://www.youtube.com/watch?v=A81IwlDeV6c), and though it was never a huge success, I've always been proud of it.

Fast forward to 2018: although I've known about the [Internet Archive's MS-DOS Software Library](https://archive.org/details/softwarelibrary_msdos_games) for some time, I'd never really thought about the specifics of how it works until I read [an article](https://news.ycombinator.com/item?id=10977424) which talked about the [Em-DOSBox project](https://github.com/dreamlayers/em-dosbox/). Em-DOSBox is a port of [DOSBox emulator](https://www.dosbox.com/) which runs in the browser via the [Emscripten JavaScript library](http://emscripten.org/). As I was reading the article, a thought struck me: could I get *CHIM* running in the browser?

I decided it was at least worth a shot, so I began with step 1, [building Emscripten from source](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). That went off without an issue, so I moved on to the next step, building the DOSBox JS files, and that's where I ran into my first snag: the only way I was able to get it to build was by disabling the "emterpreter sync" function (`emconfigure --disable-sync ./configure`). It complained about the lack of empterpreter sync, but it built, and that lead me to the next step, packaging the `dosbox.js` file for use in a browser via the `./packager.py` command. Even though this seemed to work great, there was obviously something wrong with my resulting files, as the JavaScript engine in my browser kept throwing an error ("missing function in Module"). After toying around with it for a while, I found that, if I used `./repackager.py` (the Emscripten-less version of the packager) to package my files, I could get an empty DOSBox window to come up, but it still wouldn't load the actual EXE.

By this point, I was flummoxed, and was about to give up. And that's when I found the answer: [js-dos](https://js-dos.com/)!

After 30 minutes with [this tutorial](https://js-dos.com/getting-started/) (and some source viewing on a couple of js-dos  [game](https://js-dos.com/games/pac-man.exe.html) [pages](https://js-dos.com/games/doom.exe.html)), I was able to get *CHIM* working.

But my work wasn't finished yet. Even though I'd kept nearly all of the files for *CHIM* for the last 21 years (with the exception of the game's original C++ source files, which were lost in a hard drive crash shortly after it was released), I hadn't really messed with them much in the last decade, so there was some cleaning up to be done. I updated some of the questions (and answers) in the FAQ, replaced the license, and generally tried to clean up the supporting text files. And that's when I ran into one last unexpected issue: text encoding.

You see, I had forgotten that, when I first wrote the game and the supporting files, I had used some primitive ANSI graphic characters in an attempt to enhance the look of it. And now, when I tried to view those files on my Linux laptop, those graphics came out... weird.

The fix was to convert the files from the "IBM-862" format to the modern UTF-8 format:

```shell
> iconv -f IBM862 -t UTF8 INTRO.TXT -o INTRO.UTF.TXT
```

This allowed me to edit the files in Mousepad (and serve them up with Nginx), while still keeping the graphics intact. Finally, I added the Unicode Byte Order Mark, which makes it display correctly in the browser, even when served from a `file://` URL (you can add the BOM via Mousepad, under "Document -> Write Unicode BOM").

So, if you'd like to try the game out, [check it out here](/chim/index.html), and good luck - you're gonna need it!
