Saturday, March 16, 2013

Building Breakout In 3 Days - Day 1

I've got a programming assignment to program a Breakout clone, and I've decided if I'm going to do this, I might as well record my process and post it here on my blog.

Example of the classic Breakout game

The Brief

My assignment is as follows: create a clone of the classic game Breakout. I'll be coding "from scratch" (no engine) in DirectX. I'll have three types of blocks, with different "health" totals each.
Everything else has been left to me. I don't want to embellish and add too much, as I think it's important to show I am working from the brief. However, I hope to add a few little flairs within the brief specifications to show my creativity.

My Approach

The first step was to choose a graphics API. I already worked with DirectX extensively for a module last semester, so I decided to use that framework for this project.

For the game framework, I have a C++ Allegro project used for a demo last semester. This project includes handling of separate scenes (screens), buttons, and mouse/keyboard input using Allegro. I'll combine this with my 2D DirectX code to build a good platform to start from.

From there, I will begin the next steps to getting the game up and running.
  • A paddle that can be moved by mouse input.
  • A base level with walls on the top and sides.
  • A ball that bounces around the level and off the ball in the traditional Breakout fashion
  • Lose condition when the ball leaves the bottom of the level
  • A block which collides with the ball and performs an effect after being hit
  • A yellow block which disappears on hit
  • A orange block which changes the ball color and disappears after two hits
  • A red block which disappears after three hits.
  • Win condition when all blocks are gone from level
  • Level loader which reads a level from a .txt file.
  • Textures for each block, different ones after it has been hit (cracked)
  • Start screen with play button, stating controls.
  • Add sound for collisions, possibly background music.
  • Implement a lives system
  • Implement a scoring system
  • Implement multiple levels
  • Ball goes faster over time, or at later levels
...and more, if I have time.

Getting Started

The first goal was to combine my two separate projects to create a 2D game using only DirectX. I started with the DirectX project, since it already had visual studio set up to handle DirectX libraries. I then removed all the unnecessary classes and shaders from the earlier project, keeping only the texture shader since that's all I'd need for a 2D project.

From there, I began adding in the framework from my Allegro project, modified to take advantage of the DirectX api. Primarily, the framework will be used to manage "screens" - transitioning between the title screen and the main level. It also has a set of callback frunctions for taking input, loading, and unloading screens.

All I managed to get to today was to add the screen structure in, but I didn't have time to fully integrate it with the program. That will come tomorrow, when I hope to get the basics of the game coded in, minus possibly loading from level, which I will focus on during day 3.

All in all, I think I made a good start on the project, and look forward to some speed programming tomorrow!

No comments:

Post a Comment