Using C++

Started by
33 comments, last by frob 9 years, 11 months ago

Then you could make a text adventure game. The first attempt people have at doing this typically is quite terrible.

I think this is also bad advice. After seeing beginners trying text adventures for three years now, I'm yet to see any of them finish a particularly good one or learn very much from their attempt.

I would suggest that to get a book on C++ is the best way to learn, and failing that, to read online. There is a list here of decent C++ books: http://www.pixelstech.net/article/index.php?id=1337796210.
Each time you read how to do something, you should then try to apply it to a real (small) project. Once you have learnt the basics of C++, which I would consider to be:
Variables, control flow, input/output, arrays, strings, functions, structs and classes, inheritence and debugging. If you learn this stuff, you will forever be a significantly better games programmer, if you choose to pursue programming games in C++ or otherwise.

To then make games in C++, you will probably want to use an external library. Popular options are SDL, SFML (my recommendation) and Allegro. This will allow you to start creating 2D games. These have good tutorials on Youtube and other places online. However, you will need to be comfortable using C++ before starting to learn these libraries.

Also, learn any maths that you can. The better you are at maths, the better you will be at programming.

Advertisement

Then you could make a text adventure game. The first attempt people have at doing this typically is quite terrible.

I think this is also bad advice. After seeing beginners trying text adventures for three years now, I'm yet to see any of them finish a particularly good one or learn very much from their attempt.

I disagree because often the subject of data driven programming gets brought up from the attempt. Failure is perfectly fine in this context, the entire point of the exercise is attempting to create something. Text adventure games are deceptively "simple" and can involve complex data structures, regular expressions, and various forms of file IO.

I don't see where we are ones to judge what people learn from attempting to create certain programs.

Anyway I have failed at countless things during my programming career so far, including quite a number of text adventure games. I DID learn a good bit from the attempts. I have lots of unfinished projects rotting on my hard drive, but that does not mean that any were a waste of time!


I don't see where we are ones to judge what people learn from attempting to create certain programs.

I agree because everyone learns differently. What worked for you may not work for others so it is unfair to give a path for something that has no set path to learning.


So I have recently watched several videos on C++. I understand the basics, but how can I apply this into developing a game?

I can understand where he is coming from. I've read many books and done tons of experiment programs as I learned. When I started out, I could set there and help other beginners fix their code no problem, but when it came to mine I couldn't think (I just locked up). Still do lock up on my own projects from time to time and have to force myself to just start typing code in hopes that the block will lift.

Let me add my advice. Books have more detail than a video or tutorial will have and cover more. You can learn from the videos and tutorials, but if you want to know more about a feature in C++ then you need a book for that (I'd recommend Bjarne Stroustrup's The C++ Programming Language for a reference). Just keep programming and trying anything and everything you can and when you hit a snag, ask questions... lots and lots of questions.

You can use C++ along with SDL to make video games. Why don't you private message me? I can help you make a Pong game using C++/SDL, and you can go from there :)

According to me, the best way to learn C++ and proceed to game programming is to first get a book for C++. The best one I know of is Let us C++ by Yashwant Kanetkar or even C++ How to Program is good. Then get a book for Introductions to Data Structures and Algorithms and after these if you still wanna further your knowledge, you can also read Introduction to Cormen. Otherwise you can proceed with game programming using 2D APIs like ClanLib or Allegro for starters and then, move ahead to OpenGL for 3D development. All of these APIs are well documented, so I'm sure you can find a good book for the above. Also, only for the introduction part you can also refer to the book, Introduction to Game Programming Using C++, by Alan Thorn. Happy to help,

I can't say I've heard of any of those books. Personally, when it comes to C++, I would recommend C++ Primer (not to be confused with C++ Primer Plus) for beginners, The C++ Programming Language by Bjarne Stroustrup as a reference. Some can learn game programming while learning the language, but I always recommend learning C++ first before tackling anything else.

Learning C++ first makes it so you can focus more on learning to apply what you know to game development. I think it is more stressful for a beginner to learn (I will use Pong as an example) to make Pong and understand everything about making such a simple game while trying to learn functions, classes, pointers, etc. at the same time. If they have a grasp of the language before undertaking any game it will be easier and will be less stressful if they run into something in the language they don't know.

start here (for free):

http://www.cplusplus.com/doc/tutorial/

then (much later) buy this:

http://www.stroustrup.com/4th.html

then (much much later) buy this:

http://www.amazon.com/gp/product/0321334876?ie=UTF8&tag=aristeia.com-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0321334876

all the while writing programs and asking lots of questions. If you're not interested in c++ specifically, and just want to get running with games, something like flash with flashpunk will likely be many times quicker for a basic game, and with lots more examples available. You can always move to c++ later.

If you want a basic project in c++ with SDL2 I can post something simple up.

Yes, you can start at Cplusplus.com, but should really invest in getting C++ Primer 5th Edition by Stanley B. Lippman, Josee Lajoie, and Barbara E. Moo to learn C++ and The C++ Programming Language 4th Edition by Bjarne Stroustrup for a reference. The one place tutorials fail is that they don't cover nearly enough information to be really valuable which is why they are okay for getting your feet wet, but should be brushed aside for books (especially books that are known to be considered popular by other users). Scott Meyer is also a good author to get from so you should definitely invest in Effective C++, More Effective C++, Effective STL (as they all still cover some points that are still valid even though they are a little outdated) and keep an eye out for his new Effective book that he is calling Effective Modern C++ (but there is no release date mentioned last I knew).

I think Primer and Bjarne's book are the best two, but if you want you can also see what ISOCPP recommends ( https://isocpp.org/get-started ).

So I have recently watched several videos on C++. I understand the basics, but how can I apply this into developing a game?

Thanks

Let me help put that into perspective for you...

You've just watched several videos on how to use a hammer, and now want to build your own home.

"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

So I have recently watched several videos on C++. I understand the basics, but how can I apply this into developing a game?

Thanks

Let me help put that into perspective for you...

You've just watched several videos on how to use a hammer, and now want to build your own home.

Overdramatic twaddle, there's no need for expertise in the entire language, there's not a company I've ever worked for that would permit you to use it all anyway. C only has 30 odd keywords, get your head around loops and decisions and pretty much you're on a running start. A modern ide's autocomplete holds your hand through any most of the more complicated parts.

Good luck KBToys, I hope you have fun learning, don't be out off at all. There's plenty of people and forums who will help if you get stuck.

This topic is closed to new replies.

Advertisement