BBC (Brian's Boot Camp)

Not to be confused with the British Broadcasting Corporation, the BBC will focus on Brian's fast paced journey of the mastery of the Java programming language.

Thursday, March 03, 2005

Assignment #5 The Odds are Stacktropolised Against You

Alright, after that forced title, here's an exercise that will primarily teach you how to read/trace through/modify someone else's code. You'll also get exposure with managing projects with more than one source file (Stacktropolis has 15).

First things first: Stacktropolis: An Overview:
Stacktropolis is a Tetris clone; the fundamental rules of Tetris apply. The object is to rotate the falling blocks in order to fit them in and clear lines. When a line is cleared the remaining blocks will fall accordingly.

Stacktropolis' twist is that it introduces the idea of the reward gauge. I loved the reward system in the original Monkey Target from Super Monkey Ball (Turning off wind, Magnet Ball, etc). I like the idea that as you do better, your reward is progressively better.

So at the bottom of the game is the reward gauge. To fill up the gauge you need to clear lines with green balls in them. Each green ball that is cleared raises the gauge by one unit. Watch out though, if you clear a line with a red ball, your reward gauge drops to zero. The idea then becomes balancing between trying to get the best reward possible and "caching out" the gauge before clearing a line with a red ball.

At any point you can cach out your current reward (by pressing the 'A' key), or take the equivalent point value (by pressing the 'Z' key). The rewards, in order of least to best, are:

  • A single white block is put in your queue as the next block. This is useful for "filling in the cracks".
  • The drill-down block. This block will essentially clear a column -- it will continue to fall until it hits the bottom, removing any blocks in its path.
  • The delete line reward. This starts a moving line from top to bottom. When the player hits "D" the current line is removed.
  • Hazards to Rewards. This reward changes all the red balls into green.
  • Gravity Well (my favorite). This invokes gravity on the blocks by having all the blocks fall as far as they can, filling in the gaps, clearing lines as they go.
  • Clear Blocks Reward. The highest reward simply clears all the existing blocks on the screen.
The Assignment:
  • I emailed you the codebase for Stacktropolis a while back, so you already have everything you need from me. To build Stacktropolis you'll need to download Ant, which is a build tool similar to Make. Once you've downloaded Ant and extracted it, you'll need to set two environment variables, ANT_HOME and JAVA_HOME, and add ANT_HOME\bin to your path. The installation instructions should have details on that. Once Ant is configured, go to the st directory (of Stacktropolis) and type "ant" to build it.
  • Once built, play around with the game. Get a feel for it. Try out all the rewards, etc.
  • Once you feel comfortable with the game itself, try reading through some of the source. Trace through the startup process, insert a System.out.println() statement here and there and rebuild it to see if it did what you thought it was going to.
  • Once you're relatively comfortable with all that, make the following modification: Change the first and second rewards (the single block and the drill down) to have the option to "detonate" at any point during their trip down if the player hits the "D" key. The detonation should be a clearing of blocks within a certain radius of the current position of the reward block. You can play around with what that radius should be (whatever seems to serve the game balance). Blocks left hanging in space should drop accordingly.
  • You're in someone else's kitchen now, follow the coding style and comment what you do accordingly. Stacktropolis is very light on the comments since I never intended anyone else to see it, but you can get an indication of the style of comments (Javadoc).
So there you go. Good luck.

0 Comments:

Post a Comment

<< Home