Saturday, January 25, 2014

Why to Start Programming with Homebrew

When I was in High School, I decided to learn to program for the Nintendo DS.  I absolutely loved the games on the system, and thought it would be awesome to be able to create my own games on it.  A little bit of research at the time however showed that professional development on it was out of the question.  Thousands of dollars for a development kit?  I needed to buy an office building?  There was no way I could afford that, but I wanted to learn to program.

What about developing for the PC?  At the time, finding a good, cheap, and well documented PC game engine to learn was incredibly tough.  The tools tended to be very obscure, or super expensive, or limiting with what I could do.  I picked up Game Maker for a little while (which I still believe is a great starting tool), but eventually reached a point where I couldn't do much more with it.

I went back to looking at video game consoles and came across this "new" thing called homebrew.  Researching more into it, I realized that this would allow me to make games for the Nintendo DS, Gamecube, the Sony PSP, and more later on.  This seemed incredible, but there was one big thing: I had to "hack" my systems to do so.  Now as someone brand new to the homebrew scene, that worried me a bit at the time.  Hacking? Wasn't that illegal?  Couldn't I get into trouble with that?  Is this a good way to go about learning to code?

To start tackling all of this, I began looking into what exactly I could do with it and whether it was worth even starting.  The tools I was using (PAlib at the time) were fairly well documented and included tons of examples.  Within a few days I had a simple demo up and running and had begun programming a game.  This prompted me to go through and actually read about what I was using and the legalities with it.

Within a few months, I had discovered that homebrew really doesn't require anything illegal (usually, I'll explain more on that later though).  While yes, you do have to "hack" the system, there isn't actually wrong with doing so to your own hardware.  It's similar to if you got locked out of your car and had to break back in, it's your car, you own it.  If that's the case though, why do people get so up and arms about it sometimes?  It's because of what you can do with it.

To elaborate, let's image that you get locked out of your car and then break back in.  Now imagine that you drive the car through a red light and get pulled over.  Is the problem that you broke into your car?  No, it's what you did with it.  Homebrew is very similar.  If you "hack" your device to play music you own on it, then that's perfectly fine.  But if you create an application that plays music you don't own, then that's obviously not okay.  These days, homebrew seems to have a very bad rap for what it is: A way for anyone to learn to program.

The Oculus Rift is another example of something that was
started as a homebrew project and grew to something more!
If you don't trust this, just read up on the history of companies such as Electronic Arts.  EA was founded by two guys who did nothing more than tinker with homebrew tools of their own.  Homebrew has been around since computers were first invented.  It provides a cheap way to program on things you already own.  It's nothing more than making something of your own at home, rather than as a business.  If that's the case though, why does homebrew have such a bad rap?

I think a huge part of why homebrew has become viewed in this way is due to what people have begun to use it for, especially in recent years.  A big offender of this is software piracy, as most of these tools easily lead to it, mainly due to the sheer nature of these tools.  It's not the fault of the tools' developers, it's just how these things work, and there's only so much one person (or even a group) can do to prevent piracy.

Another huge issue however is only showing up more recently, and that's the creation of tools using code by the companies make these systems.  The PS3 saw this for a while, where homebrew developers would use tools owned by Sony, which was obviously not allowed.  In some cases, making the tools is difficult, which can lead to an impassible barrier for making homebrew.

With all of that being said, is homebrew something worth learning?  Absolutely!  It's a cheap entry point for coding and allows you to learn a lot more than you normally would when coding for a PC.  A good starting point for this actually is the Nintendo Wii.  The system, while old hardware wise, is easy to get started with, and is a great entry point for learning how to work with systems that have these huge limitations.  When you develop on a PC, you usually have a near-unlimited amount of resources for basic games.  But when you work with something like the Nintendo Wii, or especially the Nintendo DS, you have to be very careful about what resources you use.  A computer may have on average two gigabytes of ram, but the Nintendo DS?  You're going to be using at most four megabytes of ram, a fraction of a PC.

These limitations, while tough to overcome, will ultimately help make you a better coder.  You learn how to use faster sorting methods, so as not to slow down the CPU.  You learn about memory management, and why it's important to release resources when you no longer need them.  You also have to learn how to make most of the high-level tools you need.  On top of all that though, the hardware to get into this is very cheap usually, and you may have most of it lying around your house right now.  Just be cautious of what you make, and you'll be fine!