This week I’m in Denver, CO, where the 360iDev conference is currently going on — it’s a gathering of iPhone developers that I’m covering for TUAW (you can see most of my coverage right over here, with more to come). All week long, I’ve been chatting with developers, listening in on conversations and talks, and just generally learning about what iPhone and iPad app developers are dealing with and learning about.
Every time this conference meets, they do something called a “game jam,” in which all of the developers park themselves in a room with soda and snacks, and just jump into Xcode and work overnight on a brand new, original products. Some developers do it just for fun, some do it just to mess around with a new framework or check out a new feature of the language, and some of these developers have actually prototyped or even just coded games that later were actually released out for sale on the App Store. I’ve been to one of these before, but as you may have read, I recently started messing around with game development, and recently have been playing with iPhone dev as well, so I’m going to actually sit in on the game jam tonight, and try to get a working iPhone game made before I go to bed this evening.
I have no idea how it’s going to work, so I promise nothing. The theme, announced today at lunch, is “opposite,” and since I heard that theme (I tried not to come up with any ideas before they announced it, so I’m starting completely from scratch), I have narrowed down a pretty solid idea that I think I can pull off with the Cocos2D framework. It’s inspired by a few different things I’ve seen this week: It’s simple (because I’m not a very good or experienced coder — I need simple), it’s based on an old arcade game (because I went to a bar last night with old school arcade games, and really enjoyed the reminder of how pure and enjoyable old school arcade games can be), and it’s a pretty standard game with a crazy little twist (because Mike Lee said yesterday that the best ideas are 80% boring, with a nice 20% crazy frosting on top).
I’ll be liveblogging the whole process right here as I do it this evening — the game jam starts up at 8pm mountain time here in Denver, so come back here then if you want updates. I’ll be posting pictures, videos, and maybe even streaming, depending how the network connection here at the conference hotel holds up (spoiler: it probably won’t). I do want to document this, though (because I want to really test myself in terms of development, and really try to learn from it), so there will be plenty here to see if you come back later. In other words, stay tuned. This will, hopefully, be a lot of fun.
6:39pm: I’m about to head out to dinner, and then off to the game jam proper, but before I go, here’s a quick sketch I drew together in Sketches for iPhone with my original idea. As you can see, I am not an artist.
The basic influence (remember, the theme is “opposite”) is Pong, obviously. As soon as I heard the theme, I got an image in my mind of two forces, black and white, fighting it out in abstract, and Pong seemed like the ideal way to portray that. Plus, I just coded a breakout clone in cocos2d on the plane out here, and there’s a pretty complete Pong sample in the cocos2d documentation, so I think Pong is an idea I can actually code and get running without too much issue.
Instead of just battling with one ball, though, I had the idea that my black and white pong paddles will fight with a bunch of different balls. There will be a dynamically moving line separating the two (I’ve been meaning to mess around with the particle system in cocos2d, so hopefully I can make some black and white particles fly around and make the line sort of a “leaky vortex” kind of thing as it moves), and every time the ball passes over that line, I imagine it splitting into one of each color, as well as pushing the line a little bit to one side or the other. So the goal of the game won’t just be to keep balls from falling off the screen, but to bounce them back at the line, trying to push it back away towards the other player.
I have a few other ideas, much more murky. As you can see, some of the balls are bigger than the others — I have this idea that maybe the balls pick up steam and grow as they cross the line, which means keeping a ball bouncing for longer makes it more powerful with each bounce. Unfortunately, that would also make it more easy to keep in the air, so I can foresee some balance issues there.
I’m not sure if the opposing paddle (the white one) will be AI-driven, or an actual mirror of the black paddle, maybe requiring the player to move both his paddle and the opposite at the same time, but only trying to bounce the balls with the black one. And the other idea I have is that the line will move across the screen — it’ll start out as a relatively tame and quiet game with a black paddle and one ball on the white screen, but eventually that black vortex-y line will crawl leftward (maybe I can even do a dark humming sound effect that grows louder as the game goes on), and as it moves towards the black paddle, the player will be left with less and less room to maneuver as more and more action takes over the screen. That works with the theme too — you’ll be getting frightened by your opposite color crawling ever closer to you (even though that threatening color is the one your paddle happens to be as well).
Anyway, that’s my basic idea — we’ll have to see how that all plays out in with my very, very rudimentary coding and artistic skills. I have a feeling it’ll change a lot once I get things moving in the game; I’m not sure if I’ll be able to keep it interesting and playable as just a basic Pong game, especially one that’s meant for one player rather than two (I know I could do two players on the same iPhone touch screen, but I’d rather make a single-player experience). But I think there’s enough to start with — I’ll go grab some dinner, and will update when I’ve actually sat down to start coding. If you’re around and watching, let me know what you think on Twitter, please!
8:22pm: Here we go. Xcode up and running, cocos2d Hello World built. First thing I’m going to do is create a new scene in cocos2d, and then a front and back layer. If this game works out, I will probably have a few different scenes, and I think it’ll be worth it to break from the template right now.
I’ll try to remember to update this often — from what I know about these things, it’s easy to get involved in the work and forget to document it. So I’ll try to make a note here every 20 minutes or so. Will set my iPhone timer if I forget.
9:07pm: Ran into my first issue — had to set the background color of the first layer to white. Got some good help from developer friend Markus (@markusn on Twitter) who I’m sure I’ll be bothering quite a bit this evening.
9:32pm: Had an issue trying to instantiate my first paddle, because I was trying to call a method called “paddleWithTexture” by using the selector “initWithTexture.” I messed around with it for a good five minutes, then asked Markus to come over and check it for me — with him looking over my shoulder, I ran to check the name of the method right away, and ended up looking stupid. I told him I was dumb and sorry for wasting his time, and he shook his head at me and said that kind of thing happened all the time — “you could spend two hours on stuff like that.” Coding is tough for everybody, apparently.
11:06pm: Speaking of spending two hours on something, after way too long I’ve finally got a ball and a paddle moving on the iPhone:
Had an issue with the ball not getting put in my ball array (apparently you have to allocate the memory for an object before you use it — go figure!), and I still have a problem of the paddle going off screen when it reaches the edges (not sure what the deal is there — maybe a float/int problem). But at least the ball and paddle are in there and working, collision works as well.
Next up, I’m going to try to build that line that goes across the screen — on one side, it’ll be black, and on the other it’ll be white. Then I have to figure out a way for the ball to interact with it when it crosses over (so you don’t see a black ball on a black backgound). We’ll see.
12:34am: I have been forgetting to update, obviously. I have the line going across the screen, and it’s easy enough to have the ball interact with it, but now I have a problem. Changing an image on a sprite is a pretty easy task — if you use a spritesheet, which I’ve never actually done. The other devs are telling me it’s a tough topic to learn at a game jam, and they say I should do a more brute force approach, but I’m torn. I should learn spritesheets at some point, right? Still working on it.
3:00am: Still working. This is a slog — I’m getting dragged down into stuff that’s a little bit over my head. I’m juggling a few different problems, but I am getting worn out. The game looks about like I want it to look, but the gameplay’s not quite close enough yet to start balancing it — I can’t seem to get the ball textures to switch color, and if I can’t get a white ball on a black background and vice versa, it’s not really playable. I’ll give it a little while longer yet.
4:29am: Ok, I’m going to call it. I’m not anywhere near done, though the game actually looks and plays somewhat all right:
What I did:
-I got sprites on a screen, and got them to move. The black paddle is moved by touch, and the white paddle currently just follows the black paddle, though I’m not sure if I’m going to leave it that way or not. But all of that was my own programming. The black section that crosses over the view is also all my own programming, which I was pretty impressed that I pulled off without any help.
-The ball does change color when it crosses the line, which was a big win for me. Huge thanks to both Markus Nigrin and Ray Wenderlich for helping out with that one — Ray’s site is great if you ever want to learn iPhone programming or cocos2d.
-I got collision working, which wasn’t so much me (though I did spend a good hour or so on it) as it was a developer named Max, who actually makes the great Soundrop app. He’s working on some really interesting stuff, and he (with just a little bit of input from me) really knocked the collision on this one out of the park.
-And I learned a heck of a lot, both by working on my own game and by watching and talking to the other devs here. I definitely feel like I’ve done quite a bit tonight, and I feel like I’ve learned a lot this week in general about how people deal with this stuff.
What I have to do yet:
-I never did get other balls to spawn, but it seems easy enough — with another hour or so of development, I’m sure I could get that going. That would really make the game more interesting and really bring the thing together.
-And the final piece of gameplay would be making all of those balls actually move the divide back and forth. That seems fairly easy too – I probably will implement it at some point in the future.
-I didn’t get to do any particle work — I really thought I’d get a chance to do that tonight. Oh well — I’ll take a look at it when I get home. All the devs here told me it would only be a few lines of code, once I actually figured it out.
-And I didn’t get to make a title screen, which was probably hoping for a little much anyway. I got all dragged down in the collision stuff, when I thought I’d already solved those problems in code. My biggest issue with the collision turned out to be that my paddle code was written for a horizontal paddle, so when I moved to a vertical paddle, it introduced a whole bunch of issues. And then when I mirrored the paddle on the other side, that broke a lot of stuff too. If I’d had better collision code in the first place, I could have gotten a lot more done.
Oh well. Definitely not a failure, but I thought I’d have more to show. Oh well. Stay tuned — I do see myself working on this one in the future, and maybe it’ll even turn into an app that people can play. I don’t have a developer account, otherwise I’d just release it for free, but if I pick up a dev account in the future and this gets into a form where people can play it, I’ll let you guys check it out. Have a good night! I’m off to pass out (and then wake up in three hours for another day of conferencing and then a long flight home to LA. Gooooood times.
Update: After a few more tweaks, here’s the game in action:
It’s not done yet, but it is actually playable. I may still mess around on it a bit, and if I ever get those last few things done, I may even try to release it out as a free game (if I end up spending the $99 to be a real app developer). I don’t know how fun it actually is, so I’d have to do some game balancing, but at the very least, if I added touch controls to that opposing paddle, it might be a pretty interesting two player game. We’ll see.
Posted on Tuesday, September 13th, 2011 at 6:02 pm. Filed under general.