Sunday, March 24, 2013

CodeReview: Chest Work by Muir Dragonne

I've did a review for Muir Dragonne's game for 1GAM March. Theme for this month is roguelike. The game is ok. It deals with theme good.

How ever my task not in review gameplay but code.

So here we go. I've found 11 issues. Some of there simple hacks, some take us a topic to discuss.

  1. Classes should be in separate files (h/cpp).
  2. Classes are used as structs. KISS use structs.
  3. Usually for consants values uses #define. const int - java style.
  4. Some global variables.
  5. There is short init for srand - srand(time(NULL));
  6. Hack for screen clear.
  7. wasd sucks for such kind of games. Use arrows.
  8. A lot of magic numbers. #define it.
  9. There are many classes but no OOP. It's almost C but with classes.
  10. Too much routine in main. I would like to cut it in a functions.
  11. Classes Trap, Chest can be merged in one class Object.
Link to reviewed code.

After all it has good code style, vars naming and such stuff. And also it's simple and not big.

Muir's post about game. It's kinda fun so check this out.