28 April 2007

Teaching GBA Homebrew to Kids

This past Thursday (April 26th) was Take Your Offspring to Work Day*. This is where you bring your young-uns in to work and then you show them what you do for your job. Rather than have them come in and watch me browse the web all day, I thought it would be nice to run a class for all the kids that were coming into Google's Kirkland office.

I've been putting together a simple Intro to Programming class for a local Montessori school so this seemed like a perfect opportunity to test things out before the trial run this summer.

The full class targets 10-12 year olds and starts with a basic introduction to computer engineering (binary, bytes, how things are represented in memory, ...), and then some gaming stuff like creating your own sprites, and then some code to move them around the screen, and then either animation or more coding depending on what direction the kids want to go.

For the 1-hour TYOTWD version, I needed to simplify things a bit so I dropped the computer engineering intro and replaced it with a demo of The Legend of Zelda - The Minish Cap running in an emulator. I demoed the game using the debugger version of No$gba so that I could show how the different background layers and sprites were used in the game.

After that, I showed them how to create their own sprites using Spritely, which is a sprite editor that I am writing. Now there are a number of nice tile/map editors out there, but none of them was perfect for what I wanted to do - they are either too complicated, or force you to work with tiles (instead of sprites), or cost money, or are really map/background editors, or have some other problem.

I wrote Spritely with a mind to make it easy to create GBA/NDS sprites, and I made a bunch of simplifying assumptions along the way. It only handles 8x8 pixel tiles, only allows the sprite sizes supported by the GBA/NDS, and restricts you to 16-color palettes. But it does allow you to directly edit multi-tile sprites.

In addition, Spritely has an option to generate the source code for a complete GBA or NDS project (including makefile) that you can compile and see your sprites in action. The generated project doesn't do much - it just allows you to move your sprites around - but it demonstrates the basics. The generated code requires that you have the latest version of devKitPro installed, but that's OK since I pre-installed everything needed on the laptops that the kids were using.

So in summary, I had the kids:
  • Create some sprites using Spritely
  • Export the GBA/NDS project from Spritely into a directory
  • Open a command prompt and "cd" to that directory
  • Type "make"
  • Double-click the .gba or .nds ROM to run the program in an emulator (either VisualBoyAdvance or the standard version of No$gba)
Yes, that's right. I had 10 year olds pulling up a command prompt and typing "make" to build their project. And it worked.

I also had a couple of cartridges available so that they could see their creation running on a real GBA/NDS. One 7-year old walked around with an NDS playing her "game" for (what seemed like) half an hour. Google was also nice enough to buy a few NDS cartridges to give out as prizes.

Note that even though I was targetting 10-12 year olds, there were kids ranging in age from 6 to 16 present. The younger kids needed their parents (or siblings) help with the computer, but had no problem creating their own sprites once they were shown the basics. I had hoped to go into the source code a bit with the older kids, but didn't have time.

Now, the TYOTWD class was slated to take an hour, but we kept an extra hour at the end for people who wanted to stay on and keep working. We ended up having to chase the kids off to the next event after nearly 2 and a half hours.

So it seems like it was a success. It started out a bit rough because my laptop wouldn't connect to the projector properly, and we didn't have One Laptop Per Child so the kids had to share, and the room was a bit cramped. But all-in-all it looked like the kids were excited to be there. It was nice to overhear some of them talking to their parents afterwards: "I hope you got all that information dad, because I want to keep doing this when we get home".

Hopefully at least one of the kids will continue their interest in programming. Maybe we'll see some innovative GBA/NDS homebrew coming out a few years from now.

As a final note, the kids were using a preview version of Spritely. I'll be releasing it widely once I fix a few obvious flaws and add a few more features.

* Take Your Offspring to Work Day (TYOTWD) is also known as Take Your (Daughters / Daughters and Sons / Spawn) to Work Day
GBA = Gameboy Advance
NDS = Nintendo DS

2 comments:

Unknown said...

Hi there. I was wondering if you have released your "Spritely" editor. I have been hunting high and low for a simple editor my kids and I can use to create some game characters. I have the shell of a simple game coded but it's with borrowed graphics so it doesn't quite feel like it's our game. You can email me - macdug (at) gmail.com
Thanks
Doug MacLeod

Unknown said...

can u post a link 2 spritely thanks alot