Jump to content

My basic 2d game (share your class project thread)


Recommended Posts

In the future I'd like to re-write this again and make a full feature game under the GPL-3 license, using proper graphics. 

https://github.com/jeffkiwi/cplusplus

If someone here is really nice then please take a look and tell me what the ugliest part is! I'd ask on gamedev.net but I don't like the spirit of that place, it's about commercial games. I intend to release under GPL, not make money! The games industry is too competitive these days and it's controlled by lawyers and investors. I'm the opposite to them, so I post here :P

So anyway, in my opinion the worst aspect of my program is that there is no error checking. I made an error check before but it didn't behave properly. I used a simple thing: IF(imagebitmap == NULL) THEN CloseProgramGracefully() but for some reason that didn't work and the program crashed with a random return number, instead of a nice error messagebox in SDL2. It was a few weeks ago so I don't remember it very well. I think I tried a try-catch too but I can't remember. I honestly don't know what one to use anyway - try-catch, or if xxxxxxx == NULL? Visual Studio has unit testing but I migrated this project back to Code::Blocks so there's no point in Visual Studio unit tests when they won't work with Code::Blocks.

Another problem that I see: my program isn't written according to a "pattern" because I don't know what pattern would suit my program. I doubt that my program needs a pattern. It'd be nice though. When I do an error check and the CloseProgramGracefully() it's nice to be within scope, that way I don't need all the parametres like so: CloseProgramGracefully(graphicsobject, inputobject, soundobject) PLUS delete all block objects, PLUS delete all enemies, PLUS delete all players - another 3 lines each time I wish to close the program, and there are many points where it might need to close due to an error.

It's great that I can write in c++ but I'd like to be better at it. I like the teamwork part of programming, but not so much the programming itself lol. I've been doing programming since I was 12 and I made my first game when I was 15. It's the only job I want, yet I feel embarrassed about my ability.

ps. If anyone else has a project to share then please do share your program (or your experiences in writing the program).

Link to comment
Share on other sites

Hello @jeffnz!

First of all, I shall recommend you to add a Reamde file with a description and instructions how to compile it (i.e., you need SDL to compile). Because currently it's just a set of files. You could add Code::Blocks .cbp files, CMake file or Makefile, any what you want. Also it'd be good to have few screenshots, as you want to share the game.

I can suggest to read http://lazyfoo.net/tutorials/SDL/, it's has a good code style enough and basic SDL principles. Also it'd be good to have knowledges about the game architecture at all: http://www.gameenginebook.com/ (on Google Books), or something like that.

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...