My Tetris clone is almost complete. I was looking for a place to "publish" it, and found the GD Showcase. So I signed up as a member.
Below is the account of my Tetris development up to this point.
Sunday August 7, 2005 - I laid out the base classes tonight for my Tetris clone. Not much coding done yet.
Monday August 8, 2005 - Started writing the code for the classes. I kept confusing myself trying to think of all the things that had to be done in the game. I have to learn to focus. I created the pictures of the blocks tonight using MS Paint. They aren't pretty, but they work.
Tuesday August 9, 2005 - I don't know how to use GDI+ in .NET, so tonight I'm working on displaying a picture. I did some ad-hoc code to paint the "next" block in the preview area. It works, but when the window looses focus, the block disappears. I put together the layout of the main form and all of the components. I got a square to paint as the next block and in the main game area. I can move the block left and right.
Wednesday August 10, 2005 - I built the mechanism for the blocks to fall. I built the pile and started storing the blocks. There is no collision detection, so they overlap. The graphics blink, show ghost blocks, and have issues. I implement double buffering using a bitmap object as the buffer. This doesn't work. At higher levels, it's even worse + the drawing mechanism takes too long. I redo the algorithm to draw the current block instead of redrawing with a black square when it moves. This still doesn't work. I redo the algorithm to draw the main game board. Still having issues.
Thursday August 11, 2005 - I work on the game for about 1 hour trying to work out the graphics. I'm very close; I can feel it. It still doesn't work though.
Sunday August 14, 2005 - I finally get the graphics figured out. It works great now, and can keep up at the higher levels. After a long weekend back home, I am too tired to put any serious work into the game. After 20 minutes, I'm done.
Monday August 15, 2005 - Tonight I draw the pile, and that works. Move current block to pile, that works. Collision detection for falling blocks. That works, awesome, my pile is growing. I try collision detection for side-to-side movement. It's not work correctly. Eventually I get it figured out, and now I have a working game loop that looks like a Tetris game. Tomorrow I hope to do the block rotation and the ability to clear the lines. Once line clearing is done, the game loop is practically finished (scoring, lines, levels are all line clearing related). Last thing is sounds, high scores, pausing the game, and help files.
Tuesday August 16, 2005 - Sitting at work thinking about installing VS.NET 2003 tonight at home. I would really like to use some of the features in 2003 and .NET 1.1. But I also want to finish the basic game tonight. I think by Friday I should have a polished version.
6:00pm - So I start into the game. I change the base tetrimino class and creation the methods for rotating a block. I then implement the rotation methods in each of the block types. Cool, the blocks rotate. I change the down key so that instead of automatically putting the block on the bottom, it just moves it down. Now I'm getting a Null Reference error message, but there are no details with it. I put Try-Catch blocks around suspect code, but produce nothing.
I decide to upgrade to VS 2003, thinking that it has more debugging information. I start the install around 8:30. At 10:30 I'm ready to fire it up. Same error message comes up. I try to look at the dynamic help for something, but am reminded that I skipped the MSDN installation to save time. I'll have to do that tomorrow.
I wrap the draw next, draw current and draw pile methods in Try-Catch blocks. Aha, I catch an exception on the draw current. The block is a square. I try several more times, and the block is always a square. I open the square class, and there it is, I forgot to ReDim the array. I fix that one error, and finally it works now. During this time, I have realized a small flaw in my collision detection for falling blocks (side-to-side works great). My collision detection algorithm only checks the bottom layer, so an "overhanging" block isn't getting checked. I will have to change that tomorrow. It's now 1:00am and I have to wake up for work tomorrow. So I didn't finish the basic game tonight, but I did get VS 2003 installed. There is no reason that the line clearing, scoring, level advancement and collision detection fix can't be completed tomorrow.
Wednesday August 17, 2005 - Work is out early so I start working on the game around 4:00pm. I fix a bug where the game won't end, and clean up some other coding issues. Debbie had to use the computer so I started working again around 10:30. Time to clear lines. I build the methods, implement them, and everything works well. I then start keeping track of the score, lines, and level. I play the game for the first time. I get to level 13. A couple of issues came up: a rotating issue; a side-to-side collision detection issue; when the first block is created, there is no next block (they are the same, and rotate together). One other change I think the original Tetris game had was after a block was placed on the pile, there was a pause before the next one came out. I think the pause will help from automatically bringing the next block down.
Thursday August 18, 2005 - Today I want to fix those couple of issues that I found last night. I also want to implement the high score and highest lines. These will be stored in the registry and accessible through another Windows form. The game should be functionally stable tonight and very playable. The last thing to implement is music and sounds.
Eventually I also want to implement some way of showing the lines disappearing. Some ideas are: turn them white with particle effect streaming off, then remove them; break the blocks into 4x4 pieces and display those pieces across the screen, like they were crushed. Another idea is to change the background color when you advance a level. I would have a set of 30 colors (I can't see anyone getting past level 30)
Sunday August 21, 2005 - Ok, so my schedule is completely off now. Oh well. Tonight I basically worked on graphics with Debbie. We create some nice looking blocks. Then I decide to create some spheres. They turn out great. Now I have a title for my game as well, "Falling Spheres". That took about 3 hours to get the colors, contrast, etc right. GIMP made it easy, but there was still a lot of tweaking.
Monday, August 22, 2005 - Tonight I fixed the rotation from going out-of-bounds. I also implemented the pause after the collision. Tomorrow, I will work on the rotating overlapping the pile.
Tuesday, August 23, 2005 - I redo the rotation algorithm 3 times before I finally get it right. The game is completely functional now. I still have to implement the high score stuff, create a nice icon graphic, implement the music, and sounds.
Wednesday, August 24, 2005 - I started off tonight trying to separate the main timer loop from the UI. I wanted to be able to show the pile dropping down when lines are cleared. I completely failed. After 2 hours, I used the very nice feature in Visual Studio and undid 500+ edits in 2 files. I then implement the high score screens and registry entries. I play and set the first high score. Now Debbie will have fun playing and beating me. Tomorrow I will get the music and sounds implemented. I'm pretty excited to put the polished game on gamedev.net. Oh yeah, I signed up as a gdnet+ member today. Future journal entries for this game and the games to follow will be posted there.