I developped some time ago a simple tetris engine. Why? Oh, just because I always wanted to do so but never did… Tetris is a very easy game to develop, I really recommend it to people who would like to get started into game developping.
As you all know Tetris was born back in 1984, in Russia but we still play it! There are tons of clones and it can be run in almost any hardware because the algorithms are simple and only need ineteger sums to work.
The idea was of doing a simple tetris engine. I wanted to keep it awat from the graphics in order to make it usefull for any 2D engine. When I ended I said to myself, cool, it works, and now… what? If I don’t show my engine works it becomes quite useless… And that’s why I decided to use my own engine to create a Tetris game in console using ncurses for the colors. The final result was quite good and funny but I used single spaces to represent blocks, making the game looks like streched. I didn’t give it much importance and left it that way… until now. After showing the game to many friends tehy all say to me the same thing: >The blocks look awfull! Therefore I decided to change the use of the engine to make it look better.
And there it is, I admit it look much better than before (I don’t have any picture to show but you can imagine the teris with 1x2 rectangles instead of squqred-shaped blocks).
You can find the source code and test it by yourself here The repo includes the ncurses static library for Linux x64 and OSX x64. I’m sorry Windows users :(
I’m not sure if it works well in windows because it needs to fetch elapsed time in order to make the game playable and I didn’t searched how to do it in Windows ;P