Making Beer Dude
In 2004, I was working as a freelance graphic designer and website developer. I had just learned PHP, and I needed a good project to help me learn ActionScript - the programming language used in Flash. I developed a simple game idea that was inspired by some of my favorite early computer games. The game's hero was Beer Dude, a down-on-his luck everyman just trying to make it through the day without being hassled by The Man.
The game was a wild success, somehow being picked up by popular websites and frequently crashing my server. Despite its simplicity and "not quite done" feel, there was something about Beer Dude that spoke to people.
So a couple months ago when I decided to learn iOS development and was looking for my first test project, Beer Dude seemed like a natural fit.
I've thought about bring Beer Dude to smartphones in the past, but there were two major challenges that I didn't know how to solve: smaller screen size and no physical buttons. I had yet to find a good left/right/jump game for the iPhone. The controls always felt weird. I was skeptical about my ability to solve this problem.
I spent the first few weeks of development making small test apps as I followed along with a Stanford iOS development class and some iOS programming books. I was simultaneously learning C, Objective C, Cocoa and Xcode. My brain frequently felt like it could take no more.
But every now and then, I would have a little breakthrough. And I would "get it." And it was so rewarding when those moments would happen.
And one day, I created a new project and called it Beer Dude. I didn't know if I was ready to make the game or not, so I started with a simple rectangle and tried to make it jump when pressing a button.
This brings us to something that is so easy to take for granted when playing a game: simulated physics. You know what you want to happen when pushing the jump button: the Dude jumps, slows as he reaches his peak, slowly starts downward, speeding up as he falls, eventually landing on the ground. This seemingly simple task requires the world to have gravity, the Dude to have weight, know his velocity and have the ability to detect when his feet hit the ground.
These are not new problems. Game developers solved these issues long ago. But part of the reason I was developing Beer Dude was to learn these things for myself. The original Beer Dude code was a mess, and most of it was not reusable. In the end, none of the original code made its way to the finished product.
So I created my own physics engine. It enabled me to have precise control over every aspect of Beer Dude's jump, including one important detail: his jump height should be directly proportional to how long you push the jump button, until he reaches his maximum height. This is harder to program than you might imagine, but it leads to a more natural and satisfying jump than just making him jump his full height every time.
I also created my own collision detection algorithm so that Beer Dude could detect when he hits the ground (and walls, enemies and other objects). This is the most complex piece of software in the game and is computed 60 times each second for each character. With some levels having upwards of ten characters, it needs to be very efficient.
Turns out that the iPhone is fast. Ridiculously fast. Even when I put over a hundred characters on a level, the phone never dropped a frame. This was a welcome change from the old ActionScript version which became sluggish with only a dozen characters at just 24 frames per second.
As the game development progressed, I realized that the small size of the screen was not going to be a problem. It actually made the game faster, requiring less time to complete each level. But I did find myself struggling to create levels. Each level is essentially a grid of numbers that gets converted into tiles, and I didn't yet have a good mechanism to actually create a new level. I decided to build a web-based level editor that would let me draw, edit, save, reorder, name and delete levels.
The level editor alone would have been a hardy programming challenge, and it wouldn't be seen by anyone but me. It runs on my computer, loading and saving levels using a local mysql database. It allows me to draw ground tiles on a canvas just like I was using a pencil. It also helps by calculating all of the points on the current level. I have an additional report that shows an overview of the points on every level, which was helpful in making sure that the point potential increases as you make it further into the game.
As the days went by, Beer Dude was getting to a point where it was fun to play. I would frequently get sidetracked testing a simple update, only to end up playing the game for twenty minutes. Dozens of iterations of the main control pads resulted in the left/right/jump control that I thought could be possible on a touchscreen. It felt accurate and predictable. And you didn't ever have to look at the controls.
At some point, iOS development itself became fun. I no longer felt like I was lost in unrecognizable syntax. I knew what I was doing, and I felt confident that the game's code was organized in the best way possible.
Determined not to get overly bogged down in development, I asked friends to test out a beta version of the game before it was even ready to test. That pushed me to finish things like the leaderboard, the "game over" screen and the "options" screen. After collecting about thirty testers, I hastily made some test levels and sent out the first beta release.
Initial testing went well. No major problems were reported. I discovered a memory leak that I fixed, and I tweaked the jump and collision algorithms. I added more sounds. I created and finalized some graphics.
Within two weeks of the beta release, I was confident that the game was ready for Apple's App Store. I figured I could release updates in the future to fix any bugs. Better to get it launched while momentum was still strong.
As I was preparing to finalize the app, there was this nagging feeling that I was missing something. Then it hit me - I needed a new enemy. I currently had 5, but for some reason I had always wanted 6. So I came up with a landlord, who I turned into a yuppie, then a hipster. I had to further tweak the physics engine to give him properties none of the other enemies had, but I got it. The hipster is a follower: he moves towards you no matter where you are on the level. He's slow but persistent. He fits right in there perfectly between the Bouncer and Uncle Larry.
The game design is pretty simple: you are presented with a level which has some enemies, some beer and a keg. The beer gives you points, and when you get all of the beer, a checkpoint appears, which you have to touch to finish the level. A clock is counting down, and you are awarded points for each second left on the clock at the end of the level. If you get the keg, that bonus is doubled.
The enemies cannot be killed. Some of them can be led through openings in the bottom of the level, but Beer Dude is too passive to be violent.
The most difficult task was designing the levels. The original game had 30; the new version has twice that. If you beat all the levels, you start back at the beginning, but all the enemies move twice as fast. If you beat it again, they move even faster. So each level has to be designed to work at each of those speeds, without being too easy or too hard at any speed. And though each level can be beat in multiple ways, they were designed with a single optimal run that, if done perfectly, times up with enemy positions so that you can remain in almost constant motion. Most levels can be beat in under ten seconds.
After many, many hours of testing and tweaking, I arrived at 6 segments of 10 levels, with the last level in each segment being a bonus level (lots of beer and you get an extra dude if you beat the buzzer). Each segment introduces a new enemy and has a higher point potential than the previous segment.
I created all the sounds for the game. Many were carried over from the previous version (including the guitar riff at the end of the level), but I did create some new ones for this version. When Beer Dude is running, the little "patter patter" that you hear is my voice, doing a little puff of air into a microphone. When you hit your head, that's the sound of a piece of aluminum from a Mountain Dew can being bent. I summoned my inner Beer Dude for the vocal sounds of "Game over, dude!" and "Alright, little man!".
There is no music in the game, but I'd like to make some in the future. It takes me forever to compose and finalize original tracks, so I didn't want that to hold back the initial release. There are other places that would benefit from sound: the flashing clock, characters falling through the ground, the screen you see when beating the game. But in the interest of time, I had to save them for a rainy day.
One Thursday night I settled in and followed the procedure of submitting an app. It was a tedious process, mostly because I was nervous. Years of imagining this moment, weeks of intense development - and it was actually happening! Better not make a typo.
It was submitted on a Thursday and was approved and ready for sale in three business days. It is not currently showing up in the search results on the App Store (that might take several more hours), but you can find it with this direct link: https://appsto.re/us/fxuA0.i
I've developed more pieces of software over the years than I can recall. And though this game is overly basic and won't change the world, it has become one of my most beloved creations. It would mean a lot to me if you tried it out for yourself.