Thread: Practice project ideas for beginners? allegro?

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    3

    Practice project ideas for beginners? allegro?

    I'm fairly new to c++ programming(and programming in general). I would like any ideas for practice projects using the following items, and anything else you think I should look into as a beginner. So far everything I've done has been a console app, but I've been looking at windows forms applications.

    I'm fairly confident using:
    • loops
    • switch statements
    • Boolean logic
    • various data types such as: strings, chars, ints, etc
    • and a few other simple actions.


    I've already done:
    • a simple calculator
    • a story generator, kind of like a mad-lib
    • number guessing game(1-100, it told you higher or lower)
    • a few other simple programs

    I started a rather large and over ambitious text based rpg, got most of it working including a shop/inventory, scaled difficulty, character levels/exp, random monster appearance and generation, etc. I didn't finish it, but I'm mentioning it because I was able to use some function(I don't remember exactly, it was a few months ago) to implement save states by listing the various items(chars, ints, strings) to write to some file, and then loading them based on the characters name.

    I (think I) understand pointers, but have never really used them, and would like to get more familiar with them. I only have very limited experience using classes, and would like to get more experience with them as well.

    I've also toyed a very little bit with the allegro game library, and would like to get more acquainted with it.

    Any ideas are greatly appreciated, thanks in advance!

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    to address the OP's question, I'd suggest learning some GUI programming. FLTK and Qt are good options for C++. also, database access is a good thing to know, so have a look at sqlite, mysql and postgres. you can also look at microsoft SQL server, but all but the most crippled versions of it are expensive commercial software.
    Last edited by Elkvis; 03-29-2012 at 06:27 AM.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Bodach View Post
    I (think I) understand pointers, but have never really used them, and would like to get more familiar with them. I only have very limited experience using classes, and would like to get more experience with them as well.
    In that case, before you get into allegro or GUI stuff, I'd do some reading and exercises about the fundamentals of OOP, which will be important with games and GUIs:

    C++ Annotations Version 9.2.1 Chapter 13
    C++ Annotations Version 9.2.1 Chapter 14

    Hopefully after going thru the stuff above you'll be intrigued enough to want to read chapter 15, 16, 17 too:

    The C++ Annotations

    I don't think there are exercises there, but there are examples. Basically, you just want to read the chapter, probably code the examples and play with them, then as an exercise try to come up with something which parallels the examples and demonstrates the central concept of the chapter. You can always ask here, eg, "Is this a good idea for an inheritance exercise?" (I'm sure many or most people here have had to do them at some point) or even "Suggestions for an inheritance class hierarchy exercise?". Those will probably be easy enough to use to explore polymorphism too.

    Keep in mind, you won't be done with this in an afternoon. You might get a grip on it, though, in a few full days (say 16-24 hours of programming time). Again, these concepts are fundamental not just to programming things like games and GUIs, but to understanding the C++ libraries that you use to do such things, because they will always involve a lot of class hierarchies in the API. Which means, once you grasp the ideas of inheritance and polymorphism via simple/contrived examples/exercise, you will have plenty of (less simple) real world examples to look at demonstrating what the real use value of these things are.
    Last edited by MK27; 03-29-2012 at 06:55 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    Mar 2012
    Posts
    3
    Thanks for your input, I wont be able to get started until this afternoon. When I do and I have questions, should I start a new thread for each, or should I just ask them here?

    I grasp the ideas of inheritance and polymorphism, I've just never used them. i understand the purpose and concept, but I've never been able to get them to work. I tried using inheritance in the aforementioned RPG, first an enemy class, and then more specific, but it kept messing up.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Bodach View Post
    Thanks for your input, I wont be able to get started until this afternoon. When I do and I have questions, should I start a new thread for each, or should I just ask them here?
    Start a new thread.

    I grasp the ideas of inheritance and polymorphism, I've just never used them. i understand the purpose and concept, but I've never been able to get them to work. I tried using inheritance in the aforementioned RPG, first an enemy class, and then more specific, but it kept messing up.
    That's probably normal, which is why it is a good idea to do simple exercises outside the context of a larger project. This allows you to focus, and it will also leave you with a working example of something, so next time you want to do something similar, you can just look at that example, rather than going "well I remember I did something like this in project xyz" and then trying to abstract from that.

    "Vehicle" is kind of a good base for inheritance/polymorphism stuff, because not only are there different kinds of vehicles (bikes, planes, etc) but there are, eg, different kinds of bikes and planes. One of the interesting things "bike" throws in is that determining the speed of a bike involves a formula common to all bikes (google "gear inches") but which a) does not apply to other vehicles and b) can involve factors and variables dependent upon the specific type of bike.

    Because class hierarchies extent from the general to the specific, when you are contemplating a base class, think whether it might have a base. Eg, WRT to your RPG, enemy might be derived from actor (or being) which could also be the base of player and any other kind of being (aka, an actor in the game). This can extent pretty far. It is not that unusual to actually have a custom base class "Object", from which all other classes in a program are eventually derived. A purpose for that might be to add a unique id to each object and logging in the destructor.

    You can add bases later on, but this can introduce more complications than adding a derivative. Whereas eliminating a redundant base by incorporating it into its lone derived class (if that's what you end up with) is not as big a deal.
    Last edited by MK27; 03-29-2012 at 09:35 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Project Ideas
    By Poincare in forum C Programming
    Replies: 7
    Last Post: 05-02-2009, 09:25 PM
  2. Lab/Project Ideas?
    By gflores in forum C++ Programming
    Replies: 6
    Last Post: 08-05-2004, 11:31 PM
  3. Hey I fished the small little practice project
    By incognito in forum C Programming
    Replies: 3
    Last Post: 03-05-2003, 08:36 PM

Tags for this Thread