Subbania now has an online demo

Click here for an online demo that works best on Chrome or here for a version that works better on Firefox.

Firefox seems finicky for many users depending on their version, so I can’t make any guarantees.

The above is now mostly irrelevant; you can play an online version that should work on Chrome and Firefox here:

Posted in Uncategorized | 13 Comments

Subbania is complete – Two years of work for one HTML5 game

**UPDATE: The below online versions are out of date. Either get the Chrome Web Store version, or play it here.

Get it from the Chrome Web Store: Click here

+Play online now (works best on Chrome)
+Here’s a downloadable version


Five word summary: Nazis in Hell fighting demons.

Five more words: It’s pure Javascript and HTML5.

Today’s the day I finally decided to release Subbania to the public. Countless times I wanted to drop the project and even give up game development entirely. Many frustrations came from unexpected bugs introduced in Chrome updates, poor testing of my old code that resulted in game-breaking bugs months down the road, and my own poor work ethic. It’s a game I should’ve finished a year ago, but I let it stew.

I’m glad I did.

Most of my greatest ideas were conceived in the last 4-5 months of production. If I’d given up and simply released it when I’d thought it merely felt “good enough”, the game would’ve lacked a cutscene system, most of its object interactions, many of its bosses and enemies, and the current plot. It would’ve lacked little graphical refinements and the soundtrack it has now. All of these came together in the last days and left me with a work that I’m not only satisfied with, but proud of.

A somewhat dated screenshot

So what’s the end result?

118 levels, 25 songs, around 20000 lines of code, so many enemies and entities that I’m not even going to bother counting them, and a few solid hours of content. I’d estimate that a typical playthrough will take a good 3-5 hours, with most leaning towards the longer side.

As for my frustrations that led me to consider quitting, what was the biggest? Chrome, probably.

Two-thirds of the way through development, a small update was released for Chrome. This update yielded one hell of a strange bug: if no wall tiles were visible, the game would slow down. Frustrating, yes, and my frustration was compounded by the fact that this slowdown would continue to worsen even after walls came into view. The only solution was to restart. The only “fix” was to plop small, essentially worthless walls in open spaces.

Problem solved, right? Not exactly. In rooms with no shadows enabled, this same error would occur. Obviously it was an issue with shadows not being cast off walls. The problem only existed when a function wasn’t being called, and this function’s sole purpose was to draw a polygon.

It gets worse: this issue only seemed to exist on my laptop, which was running OS X Lion at the time (which is a disaster in many other ways), and my desktop had zero issues entirely. Clearing out all browser-related data did nothing to fix it, and the only full solution was installing Mountain Lion, which unexpectedly fixed everything. If anybody out there is still running Lion, then I’m sorry—any slowdown can safely be pushed onto Apple.

Yet another annoyance from Google, but mostly a consequence of my own negligence, was discovering that Chrome store apps need to be packed into 10 MB zips. Subbania was 90 MB of content at the dawn of my realization, resulting in an assload of fat being trimmed by compressing my audio all to hell. As somewhat of an audiophile it pained me, but it was the only way to cut size without cutting content. Simply converting my MP3s to OGG of similar quality reduced my file size by about 40%. Still, this clearly wasn’t enough and I had to settle for Q1 for most files, and Q0 for a small number of larger files that didn’t have any majorly audible drop in fidelity.

In the end, I managed to pack all of my assets into a 13.5 MB folder. I feared the worst—cutting content. The music couldn’t be compressed any further and nothing else could possibly be shrunk.

Then I zipped up the folder.

9.8 MB. Disaster narrowly avoided.

Other aggravations of note included some versions of Chrome killing audio; the one that pushed manifest version 2, which as a byproduct made me push even the smallest snippets of code out of my HTML files and throw them in a JS file, and having to use this file to reinsert these functions into the HTML file (this was more of a headache for one afternoon, but it does result in some sloppier code); and a couple other less-notable bugs. One side effect of Google’s “security measures” was me having to push my init() function that executed at the onload of the body, which sometimes wouldn’t be recognized in the javascript file, which resulted in what looked more like a symptom of save corruption since clearing out save data seemed to fix it. When I encountered this bug again after a thousand “fixes”, I decided to just execute init() directly in my code, ignoring the body, and it seemed to fix it. At least, I think it did and all tests seem to indicate so.

My only remaining hope is that no major update with game-breaking “features” is released immediately before or after Subbania, killing it at launch.


Now, why am I asking for money for “just” a browser-based game? Because it’s more than “just” a browser game. It’s a full game that happens to be played through a browser. HTML5 up to this point has been nothing but Pacman clones and 40 second minigames made to test the technology. I want to push this with games that have a little more meat and story. Just thirty minutes would be a pretty damn good length for any browser-based game. Subbania is eight times that.

So here’s my game. It started as a simple test of HTML5 tech back around June of 2010. By July it was decided that it’d be a short, simple game about pirates with a submarine. Around November was when I decided that it’d be a game about Nazis in Hell, and now, over two years since I started, it’s a full adventure with more content than any other native HTML5 game I know of.

Since I’m sure players would like to know what they’re getting, here’s a more thorough description: Subbania’s an action-adventure game with a considerable degree of focus on exploring and dialogue between characters. The player comes to face countless demons, many aggressive, some with mitigating backstories, and some who only want the player to succeed. The player takes up the role of a Nazi captain and his crew assigned a mission to lead a silent invasion against the American fleet on the east coast.

I’m shit at describing my own work, so just watch the video or play it. 30 seconds of video says more than a dozen paragraphs ever could. It’s a game with shooting, Nazis, Hell, some light puzzle solving—not a brain-busting overabundance of “How the hell was I supposed to figure that out?” puzzles that most indie games these days have—and loads of action and bosses with some dialogue in between to make you want to play even more. If this sounds like your kind of game, then it’s probably worth the price or more.

Posted in games, html5, javascript | 106 Comments

My first game ever

A long time ago, I made a very simple text adventure called Zidork. It was okay, I guess.

Here it is.

Posted in Uncategorized | Leave a comment

Why developing an HTML5 game is too damn risky

I’ll preface this by saying that yes, I’m running Google Chrome Beta as my main browser, and yes, some bugs are to be expected from running a beta browser. That’s besides the point. So what am I complaining about?

Any small bug on any browser can instantly kill a product you’ve worked months or years on.

A few months back, the Chrome Beta had a bit of an issue. By a “bit”, I mean a massive issue that would’ve left Subbania dead in the water if I’d released it. What was the issue? Sounds wouldn’t loop or play more than once. This is one hell of a problem when you realize games are all about sound and graphics working together to make the player feel like he’s in a world. Having a damage sound effect trigger only once every 5-200 attempts makes a game unbearable, and it’s much worse when it’s completely inconsistent. I’d sometimes refresh and sound would work perfectly, only to be in complete silence 5 minutes later. Bugs are to be expected and it can be a pain in the ass to find them, but it’s a nightmare when everything that can go wrong will go wrong, and it’s entirely out of your hands and completely up to some other entity that doesn’t give a damn about your little app.

You might still say, “It’s a beta! Of course there’ll be bugs like this!” Yeah, but what if these make it past the beta phase and into a final release? Hell, this bug took about 3 weeks to patch. And what about those people that use the beta (e.g., me) and see the bugs and glitches as a result of your incompetence? Nobody’s going to say Google programmers are idiots, so all the blame goes on that little indie dev making a crappy little game. The most vocal people on the internet are the people with bad experiences, and it only takes those 5% of beta users to completely kill your product the day it launches.

That isn’t all. At the moment, there’s some bug in the beta version of Chrome that literally makes my game unplayable when going into certain levels. Memory usage swells to 800 MB for that tab in under 60 seconds and the game slows down from 60 FPS to 10 to 1. I don’t know what’s causing it. I literally woke up one day after having not changed my code in half a week, Chrome Beta updated, and my game was ruined. It works in Chrome 17 just fine, and my biggest fear is this bug somehow making it through the beta and into a final release. Then all hope is lost on the game I’d been working on for a year.

And this doesn’t even begin to go into the inconsistencies across browsers. Subbania in Chrome and Subbania in Firefox look like two completely different products.

Text and line rendering in FirefoxText and line rendering in Chrome
Firefox first, Chrome second. Note Firefox’s “fuzziness.”

My solution? Learn from me and don’t develop an HTML5 game unless you absolutely know all browsers will abide by web standards and never introduce bugs ever. It’s nice that all these browser vendors are getting their shit together and making more frequent releases to keep up with the rapidly evolving internet, but it also means more things will break more quickly and you can’t do anything about it.

Now, this isn’t anything against Javascript or HTML. I love Javascript as a language. It has its inconsistencies, but as a whole, it’s a beautiful language with tremendous flexibility and I’d love to use it everywhere. However, I can’t trust my browsers. I’ll consider development in Lua in the future.

Posted in games, html5, javascript, Uncategorized | 15 Comments

First game-related blog post

Things I’ve added in the past month:

  1. Loads of new enemies (With actual animation!)
  2. A “loose” camera system that doesn’t make movement feel choppy (i.e., the sub isn’t always in the exact center now)
  3. Vector-based lighting instead of tile-based (see screenshot). It looks smoother, but I’m still considering removing lighting altogether
  4. Up to about 40 areas designed. Each area is about the size of a mid-to-large Super Metroid room.
  5. Moved dialogue boxes to the bottom; they no longer cover up the status bar
  6. Special effect blocks, like lava, have been added
  7. New decorative items
  8. More dialogue/plot
  9. More sound effects
  10. First actual song for the game now exists

Posted in Uncategorized | 3 Comments

Managing sounds in HTML5 games and playing multiple instances of a sound in javascript

One thing I had trouble with in my development of a game for HTML5’s canvas was playing multiple instances of a sound. When I tried googling for answers, I pretty much just got results from people saying “just embed an audio element in the page” or “just replay the sound lol.” My problem was that the sound wouldn’t replay until it’d completed, which is awful when you want to trigger it rapidly, e.g., a chain of explosions or bullet fire. Simply doing wouldn’t do the job.

Then I realized the solution is stupidly simple: use that handy “currentTime” variable that’s bound to every javascript Audio object and just reset it, and manage all sounds with an associative array.

//Sample sound table
var sounds = {"smallexpl":new Audio("Sounds/Explosion.ogg"), "longexpl":new Audio("Sounds/LongExplosion.ogg")};

//Resets a sound's timer and plays it from the start
function playSound(name){
sounds[name].currentTime = 0;

Now if you want to play “smallexpl”, just do a playSound("smallexpl");

While it doesn’t play multiple instances of a sound at once, it allows it to be rapidly retriggered and is good enough for most games.

If you insist on playing multiple instances concurrently, you could probably do something like this (not real code below, but should be easily understood):

//For each sound, we'll want an array of duplicates
//The number of duplicates is the number you can play concurrently
var sounds = {"snd1":[new Audio("snd1.ogg"), new Audio("snd1.ogg"), etc], "snd2":[new Audio("snd2.ogg"), more duplicates, etc]};
i = 0

//Now the below pseudocode would be inserted wherever you want to play 'snd1'
//We'll increment i to go to the next item in the list of duplicates
if (!sounds["snd1"][i].ended)
//play sound 'name' at index i++
if (i > sounds["snd1"].length)
i = 0

Posted in html5, javascript | Tagged , , | 4 Comments

First Post

DoMaInTools is for, whatever reason, capitalizing this domain as “EkTomArch” and is the top google result for this domain.

It’s “ektomarch”. I’m guessing their bot tried to decode a human name and it made it sound infinitely dumber.

Posted in Uncategorized | 2 Comments