   My First Game: Tetris Clone
  Hi Guys.First of all: Thanks for all the great articles and posts on this site and the help on irc :)I followed the general advise given and started out with tetris. This is (for the most part) ready, but I'd like to further learn from this experience. As such i'd like to get feedback, and who better to ask then the game development community :)The game is made in C++ with SDL, and works on Linux, Windows and MacOSX. At the moment I don't have the binary versions of these at hand, but the source is availble at http://dl.dropbox.com/u/1074630/FallingBlocks.tar.gzany and all (constructive) feedback is highly appreciated.Thanks in advanced.   
  Hi! I wanted to see your game but it failed to compile. Seems that the file "mainmenu.h" is missing from the package.EDIT: I found the problem -> Linux is case sensitive for files, you should type "MainMenu.h" when including it (in main.cpp), since "mainmenu.h" is a different file (for linux).EDIT2: I managed to compile the game. After a little session of trial and error with the file namming, I've decided to just create a copy of the "missing" files.To improve compatibility next time stay alert to case sensitiviness and keep the same pattern all over your code.I've compiled it with the command line:g++ -DLINUX_DEBIAN -o blocks *.cpp -lSDL -lSDL_ttfAbout the game: It seems that everything is working ok, but what I missed so much is the ability to hold a key and the block would accelerate in that direction. Actually, even without acceleration, you should let the player hold the movement key to go continuously in one direction. If I want to put the block on the far left and I'm on the right edge there is a lot of keyboard strokes to make.Also, you could improve the frame rate a bit making a more fluid motion.I guess that's all for now. But keep up with the good work![Edited by - ppetruzalek on June 8, 2010 1:39:52 PM];  Thanks for the reply. I'll make sure to check out the case sensitivity problems and make it so you only have to keep the key pressed down.> Also, you could improve the frame rate a bit making a more fluid motion.I'm not completely sure I understand what you mean exactly, because I see 2 'options' here:Instead of dropping a complete row (16 pixels in this case) - make it drop 1 pixel at a time, 16 pixels per second, or render it more often?Also, what in your opinion did I do right and/or wrong code-design wise?   ;  I am sorry if my statement was confusing. I will try to elaborate a little more. Right now it looks that you are controlling the falling speed of the blocks by puting some delay between the frames. The move looks like this: fall a row -> stop -> wait 'x' secs -> fall a row.Instead of doing that you could make the block fall one pixel at a time, but regulate it's speed and not it's delay. Let's say, if you have to fall 16 pixels (a row) in 1 second, and you are running at 16 fps (just to make calc simple) then you will fall exactly 1 pixel per frame. When doubling the speed (on higher levels) you would fall 2 pixels per second and so on.You will have to set a timer and cap the frame rate to do that. If you have some trouble figuring it out, take a look at this site that has some very nice written tutorials:http://lazyfoo.net/SDL_tutorials/index.php (with focus in lessons 12, 13 and 14)And about your coding, it looks like you need to figure out some sort of design guideline, since your naming conventions seems very erractic. For instance: one time you use underscore in a function name, other you just merge the low case words and so on...If you look in the internet there is several coding conventions you could follow, if you do not want to create your own. Mine I try to keep simple so it's not hard to follow:Function and Class names are always like AaaaBbbb()member variables have a preceding m_ -> m_aaaapointer variables have a preceding p -> pAaaaanumber (int) variables have a preceding n -> nAaaadouble, float and so on... dAaaa, fAaaa...constants are all uppercase separated by underscores AAAAA_BBBBWhen I want to prototype something sometimes I don't follow this pattern and usually get a messy code as a result, but it's ok if you want just to test an idea.Finally, seeing your main.c looks like you could wrap it all up in a game class and take advantage of the good OOP.You see: you have an init_game function that could easily be set up as a class constructor. Also, that means you would have to create a destructor as well and that is very helpful to keep things clean. I will give you a practical example: in your init code, you create two objects with new:menuhandle = new mainmenu();gamehandle = new MainGame();But I didn't find any code calling delete for these classes, so that means you probably have a leak there. If you had it all wrapped in a class you would have better chances to detect this since you will have to delete everything in the destructor.