Monday, February 16, 2009

Quatrain

So I'm in my fourth year of graduate school in Cognitive Science, and my minor is Computer Science. However, the only programming language I have any familiarity with is Java. So I made a New Year's resolution of sorts to at least get my hands dirty with another language this year, as a side project. C++ is a very widely used language in industry and academia, so I thought I'd learn a little C++ by working on a project not directly related to my dissertation work.

I've always liked games of all sorts, so I decided to try my hand at writing a game. I didn't really want to write something from scratch. You can learn a lot that way, but I find that I learn more in programming by starting with an existing framework, seeing others accomplished things, and incrementally adding my own stuff. So I poked around and found the PopCap Framework, which is an open-source set of code for implementing 2D games. PopCap are the makers of the 3-match Bejeweled series, the Peggle games, Zuma, and many others, and they're an industry leader in the casual game market. So I downloaded their framework in early January and started working through the tutorials.

There was a very good tutorial on coding up a version of Breakout, so I started working through that, but it didn't lead to a finished project, and I wanted to actually try working on my own game. So I initially got the idea for a Peggle variant. I started working on that, and needed to use a physics engine. I started to get it working reasonably well when another game idea hit me.

It's easier from both a game play and programming perspective, so I shifted my spare programming hours to the new project, which I called Quatrain. Here's a screen shot of the work in progress:


The object of the game is to drag tiles that are generated one at a time in the little box on the left side of the screen and drop them onto the playing area. To make a legal move, the tile must be dropped so that it connects to an existing tile on the board and the adjacent colors match. The tile to be dropped can be rotated as well, by pressing either the clockwise or counterclockwise buttons on the left of the screen.

When a given solid shape is completely surrounded by either other colors or the edge of the playing area, that shape gets grayed out, and the player gets incrementally more points for each triangle in the bounded shape. If a whole tile gets grayed out, it is destroyed, and the player gets points for that too.

With each shape bounded, the score goes up and the progress bar at the top of the field increments. When the progress bar fills, the player moves on to the next level. Each new level requires a little more progress to complete, and every five levels a new color is added, for a maximum of seven colors. The playable tiles spawn with random colors, and if a new tile spawns that is unplayable, the player can hit the "New Tile" button to destroy it and spawn another new tile. The player starts out with 4 of these mulligans, but earns a new one every 500,000 points.

This is the standard mode, which is untimed, and allows play and progression until the player either gets tired or runs out of New Tiles and gets an unplayable tile. Much like Bejeweled, I plan on implementing three other modes of play: Timed, Puzzle (in which players must form particular shapes to complete each level), and Neverending (which lets the player choose the number of colors and gives them an unlimited supply of New Tiles).

I'm going to put up a website, probably in the next few weeks, and at some point put up a downloadable demo. I'm interested in getting feedback on the gameplay and incorporating that into a final version. So watch this blog for the next few weeks if you're interested in beta testing the game. If you're friends or family I may try to twist your arm into trying it out. :)

2 comments:

mark said...

If I were going to learn a new language I would have learned Ruby or Groovy. C++ is so much like java, it doesn't seem like you are actually learning that much new.

Anonymous said...

Python?