views:

252

answers:

2

I just finished a 2d platformer in C++/Allegro. Its still in an incomplete stage...

I wonder how to go about a peer-review from people who are into game development. I would like to review my project on grounds of

  1. game play
  2. Collision detection
  3. use of OOP
  4. programming of sounds, effects etc
  5. any further ideas
  6. ways in which i could have done better
  7. ways to optimize

current code looks like a garbage at some places... so could you also suggest some simplification techniques?

you can view my project (if you wish) at updated link - nincompoop (direct link)

http://ideamonk.googlepages.com/nincompoop_distro.rar

As of now I am switching to C# and XNA, finding it very easy and fast to learn all because I'm impressed from -

http://catalog.xna.com/GameDetails.aspx?releaseId=341

I do no intend to sell any product or popularise anything here... my intent is to get tips to be better from people who are better. As for the page where I have uploaded my project, its not supported by ads of any kind. so please feel safe.

+1  A: 

RECAP from previous episode -

I do not understand why people vote you down and offensive. Keep the good work... – Daok (27 mins ago)

anything awefully wrong in asking for a peer review ? think before hitting the down button, tomorrow you might too be in need of peer review! – Abhishek Mishra (26 mins ago)

@Daok : thats what I was precisely wondering 58 seconds ago! – Abhishek Mishra (25 mins ago)

This is silly. It might not fit the typical mold of a SO question, but a peer-review isn't a bad thing, and not worthy of an offensive much less 4 down votes. – Thomas Owens (23 mins ago)

@Mitchel Sellers : you know what, there had been a good discussion over game dev while I was working on this project.. so I thought it would be good to put it up fr review.. but @ stackoverflow ... things are really great! ycombinator crowd is yet more intelligent, they come up wid amazing feedbacks – Abhishek Mishra (21 mins ago)

I think it might be the phrase and tone of the question. It sounds more like product announcement, than a question for help. If it had been phrased as a "How to properly peer-review my project" etc then people might have been less harsh. – Mark Ingram (21 mins ago)

Point is, this is not what Stack Overflow is for. It's for asking specific technical questions. – Remi Despres-Smyth (19 mins ago)

woops... yeah it was rolling in my mind as I typed the question... let me rephrase it into a REAL question! :) – Abhishek Mishra (18 mins ago)

and one could've as well given technical feedbacks as on how to improve the game.. besides I'm putting up the source code for review as well! Is there any way to OPEN a question again ? – Abhishek Mishra (17 mins ago)

I've asked for code review, and received it here. Abhishek, if someone reopens this and you get to edit it, look at this question: http://stackoverflow.com/questions/161873/k-r-exercise-my-code-works-but-feels-stinky-advice-for-cleanup as a code review question example. – John Rudy (12 mins ago)

@John : Thanks! hope it works!

Abhishek Mishra
+3  A: 

The first thing I noticed in your source code is that you've got most of your game logic is in the main.cpp file, with the nesting going as deep as 11 tabs! For code organizational purposes, this is a nightmare. Of course, I did this too on my first game. :) The first thing you can do is simplify your main game loop to look something like this:

int main () 
{
    game_object gob;
    gob.init_allegro();
    gob.load_assets();
    while(true) {
        gob.handle_inputs()
        if (!gob.update())
            break;
        gob.render();
    }
    gob.cleanup();
}

Everything else should be refactored into your game_object class. It will be much easier to manage this way, also your code might actually fit on the page since you can avoid deep nesting. If you find your code getting more than 3 tabs deep, then whatever you are doing needs to be refactored into another method or even a separate class.

My second suggestion would be to replace your goto's with something a little more sane like this:

bool playerwins = check_win_condition();

if(playerwins) {
    // win condition code
} else {
    // lose condition code
}
postfuturist