• Advertisement
Sign in to follow this  

When to start with C++?

This topic is 1773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Almost everyone who posts on this forum will usually argue that it's best not to start with C++? But how will you know when it's time to move on to C++?

 

The reason I want to get into C++ is not because I think it's a superior language to Java(What I use now), I just feel that there are more C++ game programmers out there and it's easier to get support on my projects and more code samples to look at.

Edited by stein102

Share this post


Link to post
Share on other sites
Advertisement

If you want to know C++ then start with it now and dont waste time learning something you dont want to use.

If you want to know Java then start with it now and dont waste time thinking about maybe learning C++ later, but dont do it if you think its inferior(whether thats valid or not) as that only gets demotivating for you.

If you know one of those languages already well someday and only at that point decide to learn another that is also something good to do.

Share this post


Link to post
Share on other sites

Well, I already know a fair amount of Java and feel pretty confident with it. But I also know that C++ is the industry standard for Game Programming and that I'll eventually have to learn it.

Share this post


Link to post
Share on other sites

I came into programming the old fashioned way. I started with Basic then moved to C and then C++. I personally would not recommend you learn C++ until you first learn the C way of doing things.

Share this post


Link to post
Share on other sites

Okay, I think I'll dive into C++ then. What book would you recommend me to pick up? I was thinking something like "Beginning C++ through game programming" Or "Programming principals and practice using C++" What would be the best book for me? Thanks

Share this post


Link to post
Share on other sites

    A little late to the party and I'm going to chime in with the unpopular opinion.  I think you should move in to C++ when all else fails.  C++ is the highest performing language when properly optimized to a systems hardware and even then only when performing complex floating point math.  Beyond that Java and C# are languages that optimize themselves to your users hardware (more times than not making them perform better than a standard portable C++ optimized program) and they are many many times more productive, that is you get more done with less work.

 

    Before everyone jumps in and "corrects" me that C++ is so much more powerful, that it's performance is so much faster or that it is the only portable language out there let me do a bit of debunking.

 

http://stackoverflow.com/questions/138361/how-much-faster-is-c-than-c

http://stackoverflow.com/questions/2285864/why-is-net-faster-than-c-in-this-case

http://www.codeproject.com/Articles/212856/Head-to-head-benchmark-Csharp-vs-NET

 

... and a simple search of "C# Faster than C++" will yield quite a bit more like articles that show less biased testing and benchmarking.  I would assume the same can be shown for java.

 

    So before I get too far off topic here the point is that Bytecode languages such as Java and C# are regularly and falsely accused of hindering performance of your code upwards of 25% when in actuality this is less fact than it is truth.  The arguments always come from highly biased C++ advocates that create their benchmark testing in such a way that it forces the opposing language to slow down and perform outdated practices.  Couple this with the fact that C++ is a much more difficult language, not entirely OOP (it's a linear language with OOP capabilities), the fact that all compilers and builds can be different, and a slew of other productivity hindrances that C++ imposes, my first recommendation is always to learn a language you are comfortable with and learn it well while ignoring everyone telling you that C++ is the only answer.  So the point of this, you mention that you already know some Java?  GREAT  learn the rest of it and make a game!

Share this post


Link to post
Share on other sites

Just some anecdotes from me too:

 

I knew some languages when I started, Java/Delphi/VisualBasic. So I could do basic programming without thinking too much about it.

 

First time I started with C++ when I had to do some university assignments with it. I remember passing *** pointers to pointers between stuff and learning never to clean up memory because that got in a way of finishing my task... Loads of trouble. I also learned that you can get ridiculous stuff to compile with C :). And even work somewhat, and print endless strings of OS memory. Fun.

 

I tried to stay away from C++ since then, got into C#.

I remember making DirectSound filter with C# and realized that you can't compete with compilers like C in areas such as real-time sound processing. Just no easy way.

Later I got into XNA right when it appeared. I experimented with HDR post-processing effect in XNA and also got a bit disappointed in speed limits. You just can't beat no-check, direct memory access.

 

Later I worked on some networked application and I did it with C++. That's when I learned real C++: standard library, threading (with boost), templating, and wrote my own smart pointer template (although later I realized it already existed). The bugs I made were very tough. They really bite you in C++, especially pointer-related things.

 

So to answer your question. When will you know to move to C++? I know that if i had moved to it sooner, I would had learned it sooner. It is simple as that :).

Share this post


Link to post
Share on other sites

I am just hobbyist programmer, but I feel that learning C++ is easier if you already have basic programming knowledge, like what methods are. Otherwise it only depends on your needs, i.e. you ready to learn C++ when you have particular problems to solve.

Share this post


Link to post
Share on other sites

stein102, on 10 Mar 2013 - 00:14, said:
Well, I already know a fair amount of Java and feel pretty confident with it. But I also know that C++ is the industry standard for Game Programming and that I'll eventually have to learn it.

"A fair amount" can mean anything. What's the toughest / most extensive thing you have actually programmed in Java?

As for the C++ books, "Programming: Principles and Practice" is really good. It starts from zero and talks a lot about programming concepts in addition to the language, so it's fine for people new to programming in general. If you are not a total beginner, then "The C++ Programming Language", also from Stroustrup, would be a fine choice. The 4th edition of TCPL is supposed to ship 20th of May; the previous editions are/were great books but are not worth getting at this point because the language has evolved tremendously.

Share this post


Link to post
Share on other sites

I personally learned C++ first, as my first language. It took me a while (about 1.5 years) to just get grasp of all of it's features.

After that I did some game programming for PC, and then started to learn Java so that I could start programming for Android. , I was suprissed that I learned Java very quickly (it took me about 1 month to get grasp of all of it's differences and new features between C++. And knowing both languages is satisfying feeling, because with those two, you can understand almost every other popular programming language like C or C#.

Share this post


Link to post
Share on other sites

Personally, I would do check for the following:

 

  1. Do I know the current language I'm using relatively well?
  2. Have I made games (finished and running) in this current language?

If yes, to both answers, then go on to learn another language. If no, especially to #1, then maybe you should hold off. Switching languages too quickly often makes matters worse, not better.

 

In short, IMO, stick with Java and make games in Java. Once you've done that, then learn idiomatic C++. It'll be easier and you'll already have two skills under your belt when you start learning idiomatic C++. OOP and game dev. :)

Share this post


Link to post
Share on other sites
The key is do not be scared of c++. You do not need to move to it if you want to learn it do so. Do not let other people tell you what language you have to learn if it interest you just do it. Look at me do instance I know many languages but I do not know any better than I know C because I love it. People tell me c++ is better and I should learn that but I really don not want to because I have no real need to do so.

Share this post


Link to post
Share on other sites

 But how will you know when it's time to move on to C++?

 

It'll take 10 years to fully understand it, so there's no harm in starting to learn it now.

Share this post


Link to post
Share on other sites
I knew assembler before I knew C and C before C++. I understood pointers already thanks to assembler and curiously found the C/C++ way to approach them more convoluted because of the complex syntax. Looking at assembly output helped me understand what compilers do and get the language better.

Share this post


Link to post
Share on other sites

@Alpha_ProgDes has it right; use what you know first. Learning another language "because it's probably got better performance", before you have anything published in the languages you're already good with, is premature optimization - and as we all know, premature optimization is bad.

 

And for what it's worth, I'd avoid C++ like the plague anyway. If you DO pick up C++, avoid the STL containers like the plague - their performance is absolutely abyssmal.

Share this post


Link to post
Share on other sites

@Alpha_ProgDes has it right; use what you know first. Learning another language "because it's probably got better performance", before you have anything published in the languages you're already good with, is premature optimization - and as we all know, premature optimization is bad.

And for what it's worth, I'd avoid C++ like the plague anyway. If you DO pick up C++, avoid the STL containers like the plague - their performance is absolutely abyssmal.


Talking about premature optimisation and then saying to avoid the standard library for performance reasons is a massive self-contradiction.

Share this post


Link to post
Share on other sites

@Alpha_ProgDes has it right; use what you know first. Learning another language "because it's probably got better performance", before you have anything published in the languages you're already good with, is premature optimization - and as we all know, premature optimization is bad.

And for what it's worth, I'd avoid C++ like the plague anyway. If you DO pick up C++, avoid the STL containers like the plague - their performance is absolutely abyssmal.


Talking about premature optimisation and then saying to avoid the standard library for performance reasons is a massive self-contradiction.

 

Actually, no, it goes to prove the point. Many times, when deciding to optimize early based off of minor observations, without really completing the solution, you just muck it up. In this case, OP is asking to switch to C++ because (essentially) "that's what everyone uses"; having a java background, OP would expect the C++ STL containers to confer that same sort of naive "all native code is fast" performance benefit, when in actuality, they're the fastest way to murder C++ code.

 

Write first, optimize later. OP's java will quite likely be faster than their C++, since they already know their Java, and the best patterns/weaknesses in the language. If they write their Java and finds that it is, in fact, too slow (or nobody wants to run Java), then they can look to a new language.

 

Unless they really honestly just WANT to learn a new language, just for the sake of learning it, which is an entirely different conversation.

Edited by akesterson

Share this post


Link to post
Share on other sites

I didn't even mention Java. I'm just saying, if you use C++ without the standard library you are making life difficult for yourself.

 

Switching language is hardly an optimisation. Switching to a different container type is trivial in comparison.

Share this post


Link to post
Share on other sites

@GD.NET: tldr:C++ rox/sux, Java sux/rox. The end. This debate is older than some of the people on this board.

Also, as for containers, BOOST for the win.

 

@OP: You're going to get bored of hello world and the amazing joys of console text output REALLY quickly.

Get reasonably good with that first. Then try some graphics programming.

I'm assuming you're going to program in Windows so you will want to go with DirectX. You'll want the Direct X SDK. 

Now, there is steep speed bump in the learning curve as you go from console to Windows programming, and that is the windowing system itself. This doesn't have to be a stumbling block in your coding pursuits. Find a good tutorial site. I like CodeProject.

http://www.codeproject.com/search.aspx?q=directx&doctypeid=1

Best thing to do is find a SERIES of Direct X tutorials. This is that whole "gradual learning", "bit by bit", "walk before you run" deal.

Once you have a quasi-firm grasp of DirectX, find a sprite repository and experiment with animating.

http://charas-project.net/charas2/index.php (This one's all sorts of fun.)

 

Sound/music is important. Or you can tell your users to hum while they play. Find a free sound/music repo and add background music and sound effects to your project.

Bit by bit. Little by little.

 

And then one day, not today, or even next week, you'll make the move to 3D. Make some 3D models. Spin them around like a planets in a solar system. (My CG instructor made us do a 3D solar system with the "Utah Teapot" with the sun, three planets and the moon). Go with Blender for now. Sculptris also, but mostly for heads. If you're a college student, you can get a LEGIT copy of Maya 3D and other AutoDesk products free. Free is good. 

 

 

Go make us proud.

Edited by Altruist

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement