Sign in to follow this  
KB Toys

Using C++

Recommended Posts

Ectara    3097

The way I look at it, any language is simply a tool. If you can describe how you want the game to work in terms of conditional logic and mathematical expressions on paper, you can then write it in C++ and run it. So, I believe that the more appropriate question is "How can I express a game in a strictly logical set of rules and interactions?" Translating to a programming language will follow.

Share this post


Link to post
Share on other sites
KB Toys    110

The way I look at it, any language is simply a tool. If you can describe how you want the game to work in terms of conditional logic and mathematical expressions on paper, you can then write it in C++ and run it. So, I believe that the more appropriate question is "How can I express a game in a strictly logical set of rules and interactions?" Translating to a programming language will follow.

Do you know any good videos I can watch to extend my knowledge on C++?

Share this post


Link to post
Share on other sites
Ectara    3097

 

The way I look at it, any language is simply a tool. If you can describe how you want the game to work in terms of conditional logic and mathematical expressions on paper, you can then write it in C++ and run it. So, I believe that the more appropriate question is "How can I express a game in a strictly logical set of rules and interactions?" Translating to a programming language will follow.

Do you know any good videos I can watch to extend my knowledge on C++?

 

I'm afraid not; the only thing that videos help for me is higher level math.

 

Programming is something that has always been a reading and hands-on experience kind of thing for me. Keep reading whatever you find, and learn to separate the good advice from the bad (prefer ones that quote the C++ standard). Make projects that become incrementally greater. Have you done the common "guess the number", tic-tac-toe, blackjack, and poker programming projects? Those are good starts.

Edited by Ectara

Share this post


Link to post
Share on other sites
Ryan_001    3475

Think of console programming like a king-fu master telling you to hit a bowl of water again and again.  It seems silly to you at the time, and ever so boring.  You want to be making engines and games with cool graphics, and here you are wasting your time with yet another console tutorial.  Yet there is good reason the master has given you those instructions...

 

 

Programming is essentially all problem solving. You have a problem and you break it into smaller problems. You break the problem down enough until you have something you can Google. Then you put all of the pieces together and you have a program. Then the program doesn't work and you have to figure out why. That is programming.

hehe... so true ;)

Share this post


Link to post
Share on other sites
Mats1    1047

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.

Share this post


Link to post
Share on other sites
shadowisadog    3217

 

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!

Edited by shadowisadog

Share this post


Link to post
Share on other sites
BHXSpecter    3119


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.

Share this post


Link to post
Share on other sites
Jazonxyz    138

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 :)

Share this post


Link to post
Share on other sites
parikshit    108

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,

Share this post


Link to post
Share on other sites
BHXSpecter    3119

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.

Share this post


Link to post
Share on other sites
catslap    39

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.

Share this post


Link to post
Share on other sites
BHXSpecter    3119

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 ).

Edited by BHXSpecter

Share this post


Link to post
Share on other sites
catslap    39

 

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.

Share this post


Link to post
Share on other sites
Crichton333    351

1.) Learn C, I think they teach kids this in school nowadays

 

2.) Install Visual Studio Express, its free

 

3.) Start with C++ examples, Google for code and run it in Visual Studio

 

4.) Voila, you now know C++ :)

 

Collect as much code as you can and implement it in your game, at first do not try to invent anything yourself, its all on the Internet already. Use a framework like Cocos for more functions.

Share this post


Link to post
Share on other sites
fluffybeast    132

1.) Learn C, I think they teach kids this in school nowadays

 

2.) Install Visual Studio Express, its free

 

3.) Start with C++ examples, Google for code and run it in Visual Studio

 

4.) Voila, you now know C++ smile.png

 

Collect as much code as you can and implement it in your game, at first do not try to invent anything yourself, its all on the Internet already. Use a framework like Cocos for more functions.

Why C? I see no reason to start with C rather than basic C++.

In C you have to deal with more lower level stuff, there's more fiddling and things are generally a lot less intunitive. Start with C++ and learn the basics. I mean, why would you struggle with char* when you have std::string in C++? And with the standard library, classes and streams, C++ is a lot different from C.

Share this post


Link to post
Share on other sites
BHXSpecter    3119

1.) Learn C, I think they teach kids this in school nowadays

 

2.) Install Visual Studio Express, its free

 

3.) Start with C++ examples, Google for code and run it in Visual Studio

 

4.) Voila, you now know C++ smile.png

 

Collect as much code as you can and implement it in your game, at first do not try to invent anything yourself, its all on the Internet already. Use a framework like Cocos for more functions.

Start at step two and go from there. C++ has evolved enough that the premise of learning C first is no longer worth it. You can certainly go back and learn C if you wish, but if you want to program in C++ then learn C++. I've been programming for a long time and C++ was my second language (BASIC being my first), but I went back and learned other ones just because I love programming languages. 

Share this post


Link to post
Share on other sites
Crichton333    351

"Why C? I see no reason to start with C rather than basic C++."

 

C++ at first may be confusing to him. I also started with BASIC first, in primary school then with C in high school. Then pretty much all other languages in university.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this