Petit Computer and You
To be honest, even though I refresh Nintendo’s PR site every Thursday morning for the list of new eShop releases, I tend to just ignore the DSiWare section. I have no clue why that is. I’ve bought 3DS games from the eShop simply because I was bored and wanted to try something new, but I’ve outright ignored potentially fantastic DSiWare games. One DSiWare game, however, called out to me like a siren in the mist. From the moment that I heard of it, I prayed that it would make it to American shores.
About a month ago, it finally became available to English-speaking audiences.
That game is Petit Computer, and it is one of the coolest pieces of software ever released for Nintendo’s dual-screened handheld.
What Is It?
Petit Computer is a BASIC interpreter. It essentially turns your DS into a terminal that you can type commands into. Using the ancient (by computing standards) BASIC language, you can create your own programs and run them on the DS. The intent is to develop games, but you could actually make about anything – I’ve even seen spreadsheet and other productivity tools prototyped in Petit Computer.
The key difference between Petit Computer and other “level development” suites, like Little Big Planet or Wario Ware DIY, is freedom. You aren’t restricted to building levels out of a tiny set of objects and physics commands. In Petit Computer, you can make any sort of game imaginable. The catch, of course, is that you have to code everything yourself.
In my day job, I’m a data mining and artificial intelligence researcher, so I have more than a little bit of programming experience. Trust me, learning an entire programming language might sound daunting, but it can be a lot of fun. There’s nothing quite like working through all of the challenges of putting together a software project.
Even with my experience, toying with Petit Computer has been an education. There’s something all at once infuriating and amazingly refreshing about working with a language as antiquated as Basic. It’s easy to learn the basics (if you’ll pardon the expression) of BASIC, but mastering the language will give your mind more of a workout than any Brain Training.
A Few Games
Even if you don’t really want to build your own games, Petit Computer is absolutely worth the price of admission as a way to play the hundreds of fantastic games that other programmers have put together.
Although the game lacks a dedicated game browser, you can “scan” in other games by reading a series of QR codes with the DS’ camera. There are a number of sites around the web where people put up the codes for their games – check the end of this post for a list of the best ones.
I’ve been too busy to try out many of these games yet, but here are a few of my favorites:
- Spectacle Hurricane – A fast-paced third person shooter reminiscent of Space Harrier.
- Quest – A wonderful old-school, first-person dungeon crawler.
- Olion – First-person space combat. It’s really hard, but also really satisfying when you do well.
- Minesweeper – You know what this is. You love it. Finally, you can satisfy your crippling Minesweeper addiction on the DS.
- Trek – A port of an old Star Trek game. Trek is a fairly sophisticated, largely text-based, strategy game. It’s kind of complicated at first, but really interesting.
- Mahjong Solitaire – This is just the basic tile matching game, but like Minesweeper, it’s really addictive. It’ll also last you awhile – this version of Mahjong Solitaire has tons of levels.
Writing Your First Program
Now that you’ve seen what people have produced with the coding tools in Petit Computer, you are almost certainly curious about what it would take to put together your own programs. This can definitely seem daunting at first. Even if you’ve programmed in newer languages, BASIC can be a bit of a pain (not being modern, it lacks some of those wonderful modern conveniences that we’ve grown used to).
Still, once you get over the initial learning curve, programming Petit Computer apps can be just as fun as playing them. To get you started, I’ve decided to port over Gob’s Program from Arrested Development.
1. INPUT "GOB'S PROGRAM: Y/N" ; RESPONSE$
2. IF RESPONSE$=="Y" THEN GOTO @LOOP
3. GOTO @EXIT
5. PRINT "PENUS"
6. GOTO @LOOP
Yes, yes. I know. This little program isn’t exactly Tetris. Still, Gob’s Program does give us a little more meat to chew on than your average “Hello World” example. Right off the bat, we get an example of how to take input from the touchscreen keyboard. The INPUT command in line 1 outputs the text “GOB’S PROGRAM: Y/N” and waits for the user to type a response and hit the enter key. The response is stored in the appropriately names variable, “RESPONSE$.” The dollar sign ($) at the end of the variable name is a type specifier – it declares that the input is a string of text.
We now want to know if the user inputted a yes or a no. To check this, we use a conditional statement in line 2. This is fairly straightforward. If RESPONSE$ is equal to “Y”, we resume execution on line 4 (where it says @LOOP). The double equal signs indicate that we want to test for equality. A single equal sign is an assignment. If you put a single equal sign on this line, you would actually assign the value “Y” to the RESPONSE variable.
If the RESPONSE is equal to “Y,” we resume execution on line 4. If not, we continue to line 3, which contains a “GOTO” expression. The meaning of this is also fairly straightforward – this instruction tells the program to resume execution on the indicated line. “@EXIT” is a label – it’s a nickname for a line in the program. You can also just indicate a line number (for example, GOTO 10), but the practice of using labels means that you don’t need to remember a certain number (and update that GOTO statement each time you add code to your program).
A yes response to the initial query will send you to line 4, another label. Line 5 is a simple output command. You want to print (snicker, snicker) “PENUS” to the screen. Line 6 is another GOTO command, which sends you back to line 4. That’s right – from this point, lines 4 through 6 will continue indefinitely. At this point, you will want to hit the stop button on the touchscreen (or press select).
Or, you know, you could watch the word PENUS print endlessly. I won’t judge.
Congratulations! You’ve just taken your first step into the frightening world of BASIC programming. Study the sample programs, and look at what developers have been putting together. Even though you can scan the QR codes of most PetitComputer programs, I actually do recommend typing a few of them in. You’ll learn a lot just by reading code that others have written. Before you know it, you’ll be making games with the best of them.
One word of warning, however, before you go. If you ever, ever use a GOTO statement outside of BASIC, your family will be eaten by velociraptors in the middle of the night. Enjoy!
Here are a few of the great resources that we’ve found on the web:
- Official Website – The official webpage contains source code for each of the example programs included in the DSiWare app. It also has a converter which can read in programs from your SD card and produce QR codes, so that you can easily share your own programs with others.
- English Wiki – The English language wiki is still new, but it already has a number of program listings and resource links.
- Japanese Wiki – This is the absolute best resource out there for programming tips, new games, and other resources. The downside, of course, is that it’s in Japanese. Google Translate does well enough to help you get around the site. Not everything will make sense, but the goods on this site are still worth a bit of a headache.
- NeoGAF Thread – NeoGAF has a good group of Petit Computer fans putting together cool games and apps. If you have questions and can’t read or write in Japanese, these guys are probably your best bet.
- SomethingAwful Thread – Same deal as above. This thread is a great resource for new games to try out or to ask questions.
- Japanese Program Listing – The official Japanese Petit Computer website has a huge list of really cool games. There’s a slight catch, however. These games come from the original version of Petit Computer, which didn’t have the QR code reader – you’ll have to type these in yourself.