Javier Lopez wrote a beginner’s tutorial to write Tetris in C++. The tutorial is platform-independent, which I like. While some people have complained that the tutorial isn’t very good C++, I’ve yet to see a more comprehensive and complete Tetris tutorial. Once you’ve followed it and written your own, feel free to spend the time to write a better one.
Full disclosure: I’ve never written a Tetris clone.
WHAT?! Haven’t ALL game developers worth their salt made their own Tetris? Didn’t icculus say that it was good for the soul?
I’m not going to say that I’m proud of it, but for some reason the farthest I ever got was to write some notes down. I would think about how to represent the various pieces, but I would get hung up on not easily seeing a general way to do so. I could have hard-coded them the way the tutorial does, but I thought, “Nah, I can do it better than that!”
But then I never did it. And so I never wrote a Tetris clone at all.
For new game developers out there, you have to realize that shortcuts and brute force methods are perfectly fine sometimes. It’s more important to get something working, even if it is working badly, than it is to get it right the first time. Otherwise, you spend years tweaking a general purpose game engine.
Lopez’s tutorial will do more to help someone understand basic game logic than most game engine tutorials, and the end result will be a pretty good clone of the original Tetris. The player isn’t going to care that you didn’t use every bit of functionality that C++ (or any language) provides. You made a game, and that’s all that matters.
Tags: tetris clone, game development, tutorial





Wow, now I’m blushing. Thanks for the backlink, Gianfranco.
In fact, I tried to write the tutorial in the most legible way possible, because it is mostly for beginners.
If people found mistakes on it… I dont’t want to know what would they say about my 2d engine: IndieLib. It’s source code should be plenty of wrong things
PS: my first game system was also the Atari 2600 and I like Steve Pavlina blog too
Left by Javier López on December 16th, 2008