The Noob

Almost exactly six months ago, I decided to embark on an adventure. Before October of 2010, I had never programmed a day in my life. Okay maybe I had a week-long unit on the very very very basics in sixth grade. But that is all. I had no idea what to expect. October 19th, 2010, I tweeted: “What have I gotten myself into. I’ve just embarked on learning programming, having absolutely no experience. Oh man I’m already nervous.” That was the beginning of a path that I’m so glad I have taken. I’m not looking back.


Beginnings

I’m going to give you a quick overview of my first few months, because it was pretty boring. I started with Invent with Python, a really awesome book for complete noobs. To show you how beginner it was, here is a quote from the book:

The + sign tells the computer to add the numbers 2 and 2. To subtract numbers use the – sign, and to multiply numbers use an asterisk (*).

After I got the very basics down, I made a bunch of random text-based games, like hangman, jotto, and guess-the-number. My first big hit was a game called “The Man-Rodent.” It was about a Man-Rodent, whatever the hell that is, who was terrorizing the village. He was hiding, and you had to guess where he was:


This was also when I received my first piece of cherished fan art. I posted the game on Reddit and Michael Hussinger made this AMAZING cover art for it:


Next, I moved on to my first quasi-graphics based game: Minesweeper. This is when I really started to understand why creating a flexible game engine is really important (yeah, like I created a game engine). The game was still text-based, but it was completely flexible, in that I could specify board size and mine amount. This ended up giving it some replayability and it was fun to play around with crazy numbers just to see what happened. Here’s that game:


Welcome to iOS

At this point, I felt I was ready to move on to actual graphics. I felt at an impasse. I had absolutely no idea where to start. I took a look at SDL but was in way over my head and got quickly discouraged. Since I knew I eventually wanted to make an iPhone app, I asked Matt Rix (Trainyard), who gave me some sage advice. He recommended I start by learning C, then Objective-C, then Cocos2d. I’m happy to say that as of today, I’ve learned all three of those! The basics anyway.

During the period of learning the basics of C and Obj-C, I came across a lot of frustrations and I didn’t make many games. Many times, I really wondered if I could ever get past the hurdle and figure it out. A few of the things that I pulled my hair out over when I first learned of them: structs, arrays, multi-dimensional arrays, properties, views, view controllers, protocols and delegates, memory management and many more. And there is still so much out there that is way over my head. But I’m going to keep trucking because everyone I talk to says the only way to get better is to just keep making games. Being a piano player, I am well aware that practice pays off, so that’s what I’ve been doing (and will keep doing).


Welcome to Cocos2d

Once I finally got the basics of creating an iPhone app down, I was ready to delve into Cocos2d. I was nervous but excited. Now, I don’t know if I’m crazy or stupid but I have found that the Cocos2d documentation is not very good. All the classes, methods, and properties are listed, but I am constantly struggling to understand things because they are not explained well. An example: every “node” (the main Cocos2d element) has a “(BOOL) isRunning” property. It sounds simple enough, but it could easily mean any number of things. All the documentation says about this property is: “whether or not the node is running.” Uh, okay . . . Needless to say, I’m still pretty confused about a fair amount of things in Cocos2d.

But enough of the insults. I am loving Cocos2d. Once I got a hang of the basics, I started to see how much easier it was to get a simple game up and running in no time. And since I already know how to do music and sound, and also know a little bit of Photoshop, I was really starting to see some pretty cool results. Since I was really confused by Cocos2d at first, I started with a few of Ray Wenderlich’s awesome tutorials.


A Bunch of Sorta-Games I’ve Made

Here is my first Cocos2d game, which I created by directly following Ray’s tutorial (it even had my own music and stupid sound effects for when an enemy died!):


Next, I made a Pong clone. It even had multiplayer!:


After Pong, I was feeling encouraged, and decided to try to make Tetris. Big mistake. I was not ready. I ran into a lot of really annoying errors and bugs, and when I finally got the basic framework down, I tweeted something like: “So proud of myself. I just created a really complex class/subclass system for my Tetris clone.” Noel Llopis quickly informed me how bad of an idea that was. So I looked at some tutorials and tried to completely revamp my Tetris clone, but it was still too difficult. I will return and defeat you one day, Tetris!

After my failed attempt at Tetris, I made a little Tilt to Live inspired prototype, except in this version, you get points for collecting red dots, instead of avoiding them. And this one didn’t have the music I did for the real game (that is a link to the Tilt to Live soundtrack. Buy it now or red dots will eat you while you sleep.):


After a lot more learning of Cocos2d, I had a random inspiration to make an endless crumpled paper background. So I crumpled paper and made it an endless background. Then I put a little paper circle in the game that you could roll around using the accelerometer. I was really proud of myself when I figured out how to roll the circle because it involved some math that I hadn’t done in a long time (even though it was fairly simple trigonometry). The background was buggy – there were frequently gaps between the images of the repeating background – but it worked:


Next, after seeing a trailer for the awesome looking upcoming game Bumpy Road, I got inspired and wondered if I could recreate an effect similar to its bumpy road element. Needless to say, my graphics were a bit more barren, but you can compare.

Bumpy Road:

My version:


After this, I wanted to try my hand at actually animating something. I had never animated anything before and gave it a go on Photoshop. Man was it tedious. Even for just a stupid little line drawing. But what I came up with was who I like to call PARTYMAN. All he did was open and close his mouth over and over again, each time making a randomly chosen grunt noise. You could also move him around the screen. And the background flashed different colors. And he only grunted and partied when you were actually touching the screen:


Somehow, PARTYMAN gained a small following. I think he might be next in the long list of icons including Mario, Link, Samus, and others. I actually ended up sending a copy to Jared of Touch Arcade (hey, he asked for it). Then, to my great surprise and utmost joy, Craig Sharpe of Retro Dreamer created my second official piece of fan art! Here is Craig’s AWESOME take on PARTYMAN:


His drawing was so awesome, in fact, that I had to include it in one of my next games. But first, on a whim I started making a game about a guy jumping over poles. The original point was just to see if I could make a parallax background with a simple game mechanic, but I just kept going with it. It ended up having a title screen, score-tracking, replayability, music, sounds, variable jump heights, a jump height progress bar indicator, and even a credits page! It was my most complete game yet. I drew some pretty awful sprites for my game, as you can see here:


Since my drawings sucked, I asked Michael Hussinger (of “The Man-Rodent is in the Barn” fame) if he wanted to do a few quick doodles for it, and he did! He drew this awesome pizza guy in probably 20 minutes. It would take me hours upon hours to draw something that good, if I even could at all. He also drew a nice mountainous background for my parallax scrolling. Here’s how the game looked after his help, along with my title and credits pages:

The game in action!


My next game was inspired by Trainyard. I wanted to see if I could create a grid that I could draw roads on that a vehicle would follow. What better opportunity for a return of PARTYMAN, right? So I called it Partybus. The point of the game was to click a spot on the grid to make a party (a flashing, color-changing spot with music coming out of it), then to draw a road to the party and have PARTYMAN drive there in his Partybus. Needless to say, it was a really easy game. But the cool thing is, when he reached his party destination, the music got louder and bassier, the bus started doing a dance, and Craig’s fan art of him appeared above the bus and started shaking to the beat!


The code was very buggy and pretty damn broken. I tried to have my brother play the app and it took him three tries to do anything at all because he would click the wrong square at the wrong time and it would basically ruin the game. And I would have to completely restart the app each time because I didn’t build in a “restart” feature. But I was still pretty proud of my crappy Trainyard ripoff. Matt should pay me for it.

My next project was a Snake clone. I found this tutorial on how to build Snake in flash and basically just ported it to iPhone. It gave me a lot of insight into how to make this game. Before the tutorial, I was planning on having the snake move once per frame, but was having a lot of trouble figuring out how to make his tail follow him. I was considering building up an array of all the past moves and assigning them to each of his tail pieces every tick, but that would have gotten really annoying really fast. This tutorial flipped my world upside down when I realized the Snake was not actually moving. Instead, the illusion of movement was given by simply adding and removing snake pieces from the grid on every frame. Then, when you picked up an apple, all it did was tell the program not to remove any pieces for five turns. I need to remake this game for sure, because the UI sucked, the controls were awful, and the code was pretty messy due to my hacked together port. But for a basic Snake game it turned out pretty well!


After Snake I tried making Partybus 2: Partyman’s Big Weekend. I got a little further than before. Ended up adding a speed slider like in Trainyard, a depot that the train could leave from, sound effects (when he crashed there was the sound of a massive car accident and he yelled “No partying today!”) and just overall cleaner code. But again, I soon ran into entangled code and whenever I tried to fix one thing, another thing wouldn’t work. My biggest problem was that when I set the speed slider all the way to its highest value, the bus would crash at a random joint in the road. This was due to the updates being called too often and the code not updating enough before the next tick. Even though I sort of knew what the problem was, it would take too much work to go back and fix it. I think I will have to make a Partybus 3: The Final Party.


My most current project is a remake of Doodle Jump. So far it’s coming along quite nicely. I have platforms that keep moving higher and higher, a jumper guy, some items (well, so far only a spring), custom music and sounds, and a UI that totally rips off the original game. I’m pretty happy with this one so far. I’m going to try to keep adding a bunch of stuff to it.


Conclusion

It truly is amazing how much practice helps. Every time I write a new program, I run into a ton of unforeseen problems and bugs. While frustrating at the time, I usually plan around them the next time I program. This makes me feel like I’m in my very own while loop:

while (stillPrettyBadAtProgramming) {
    programmingPracticeTime++;
    Program *newProgram = [Program programWithType:ProgramTypeGame];
    if (newProgram.isReallyGood == YES && programmingPracticeTime >= A_HUGE_AMOUNT) {
        stillPrettyBadAtProgramming = NO;
    }
}

I’m going to keep creating. It’s been a blast so far, and I can’t wait to see what the next six months entails. Be sure to return next time, when I will talk about the long process that went into making the music (and a few sounds) for Casey’s Contraptions!

56 Responses to "My First Six Months of Programming: From Man-Rodent to Partyman"

  1. @Matt Rix

    That’s what I thought! Never realized Obj-C was difficult for games though. Makes me feel even better.

  2. @Lokesh

    Yeah that’s a good question. I didn’t really know, but I was really antsy to keep moving forward. A few times I tried to move on to Obj-C too early. I started reading a book about it, got really confused, and went back to do some more practice in C. Same with Cocos2d!

  3. @Luke

    Please let’s make this a meme!

  4. @Antoni

    Yes I’ve been thinking of providing the source code if I ever get around to it!

  5. I must say this has been a great read. Especially since I have recently taken to game development myself and I do not have a clue as to what I am doing or should be doing.

    Just like you I am embracing books and reading them.
    PS: I love the book “invent with Python” you mentioned thanks for introducing me to it.

  6. Nice to see your growth: from a “man-rodent” & “party-man”. Good luck!

Leave a Reply