Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411491 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 06:56:17 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)I want to learn C++, but I don't know where to begin!
Pages: [1] 2
Print
Author Topic: I want to learn C++, but I don't know where to begin!  (Read 11318 times)
The-Imp
Guest
« on: September 18, 2008, 12:54:21 PM »

Could anybody please help? I really want to learn.
 Cry
Logged
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #1 on: September 18, 2008, 01:02:25 PM »

Do you have experience with other programming languages? It's easier to give direction if we know where you're coming from.
Logged

The-Imp
Guest
« Reply #2 on: September 18, 2008, 01:10:32 PM »

Not much experience what so ever, except for Game Maker, but I can't do much with that by myself either...
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #3 on: September 18, 2008, 01:16:37 PM »

I would advise you start with something like Processing (http://www.processing.org/) before you learn C++.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Akhel
Level 10
*****



View Profile
« Reply #4 on: September 18, 2008, 01:18:47 PM »

Learning C++ as a first language is probably not a good idea, as it is very complex. I'd advise you to start with Python. Read the basic tutorial, get used to it, then get Pygame and have some fun. Wink
Logged
Terry
TIGSource Editor
Level 10
******



View Profile WWW
« Reply #5 on: September 18, 2008, 01:36:03 PM »

Can I go against established wisdom here? C++ is not that hard to learn at all. If you're clever and patient, you can pick it up fairly quickly and as long as you use a good library you'll probably find it's as quick to develop with as something like Python or even Game Maker.

This seems like a fairly good place to start.
Logged

David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #6 on: September 18, 2008, 01:39:15 PM »

Be prepared for what you'll be getting into, then. C++ is relatively low-level and difficult as a first language. Understanding memory management and pointers is critical compared to modern high-level languages that hide pointers and garbage collect memory for you. In fact, I might recommend writing some Java, Python, or Ruby code first, just to get used to common aspects of programming, before diving into C++, which is rather more finicky.

That being said, if you're prepared to make the leap into my favorite language, here's some things you'll want:

An IDE/compiler: Because writing C++ in Notepad and compiling with makefiles is for the stone age! I use and love Visual C++ (the Express version is free), but there's also Dev-C++ and Code::Blocks, both of which are free and open source.

Books: Unfortunately, I don't have any recommendations on entry-level C++ books. Stroustrup's "C++ Programming Language" is the definitive reference, but not really great to learn from. For an intermediate-to-advanced programmer, I highly recommend Noel Llopis's "C++ for Game Programmers." (I think the new edition is credited to Mike Dickheiser.) It probably assumes a bit too much existing knowledge of C++ to be a good starting book, but it's fantastic.

Existing Code: It's hard to learn to program in a vacuum. You might learn best by example. Find some open-source indie games or demos, or download libraries like SDL and try compiling their examples and then changing them in small ways.

Classes: This is a really shaky recommendation, but if you've got the time and money, you might even look into the possibility of a local community college offering any kind of programming course. Steer clear of any vague "information" programs and make sure that they'll be teaching concepts such as pointers and recursion. It's also important that you'll actually be writing any code; purely theoretical courses are mostly useless except for comp sci majors who want to go on to be academics. But you want to make games.

Finally, just start writing! You can read and research and learn and learn and learn, but ultimately, nothing quite compares to actually digging in, learning your environment, writing some code, trying to compile, getting a ton of errors and warnings, and iterating until it works. Start small and stick with it. Learning a language takes time, but it's totally worth it.

Cheers on your journey! Beer!
Logged

Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #7 on: September 18, 2008, 01:47:31 PM »

I view C++ as the ultimate language myself, however I think that if you have absolutely 0 experience with programming, jumping straight into it might be somewhat of a waste of time. Of course it depends entirely on the person doing the jumping and giving an objective suggestion in this case is pretty much impossible.
I just think that by playing around with something like processing, which comes in a ready to use IDE with small examples which deal directly with visual programming and require no additional setup can get someone excited about and involved in code right away.
Setting up Visual C++ with SDL libraries is in itself a project for most people and by the time that's done, all the initial excitement will probably be all but evaporated and even once you do, with no previous code experiences, you'll probably be doing text-only stuff for awhile. With processing, you can have something on the screen pretty much right away and the examples it comes with cover pretty much ever basic graphical technique one will need starting out.
Once you're comfortable with it, you should move on to lower level stuff.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Valter
Level 10
*****


kekekekeke


View Profile
« Reply #8 on: September 18, 2008, 02:10:57 PM »

So, I started not with game programming but with normal programming, which made some difference to me. I started with Microsoft Visual Basic, which is highly intuitive but rather weak. I moved then into Java, which is powerful but incredibly touchy and unwieldy. Once you can see the trends that show up in Basic and Java, it's simple to make the next step to C++. If you learn one Object Oriented Programming Language, it's a piece of cake to learn the others. All you have to do is learn the distinguishing syntax (which even then isn't that sever), and you're about set.


So, I would recommend starting with something simple like Visual Basic, and then easing into C++.
Logged
Terry
TIGSource Editor
Level 10
******



View Profile WWW
« Reply #9 on: September 18, 2008, 02:20:03 PM »

So, I would recommend starting with something simple like Visual Basic, and then easing into C++.

Or you could learn something simple AND USEFUL, like, say, FreeBASIC. Tongue
Logged

Valter
Level 10
*****


kekekekeke


View Profile
« Reply #10 on: September 18, 2008, 02:45:28 PM »

Visual Basic is useful! I made a game in it in which you had use the mouse to touch blue boxes. It was hard though, because you had to avoid the red and green and purple boxes! it was very fun!
Logged
increpare
Guest
« Reply #11 on: September 18, 2008, 03:27:06 PM »

C++ is definitely possible to learn as a first language.  If you want to get into games stuff straight away, you'd probably best start off modifying examples, and I think you'd also need several people you can call on at any moment for help.

I learned the basics of C++ from a book "C++: how to program".  I remember it being a pretty good experience.  Try it, if you don't mind the idea of learning a little bit about the basic language C++ (which is in and of itself a pleasant thing to figure out).  It won't be difficult to pick up basic graphics and games programming skills once you are comfortable with the language.
Logged
dustin
Level 6
*


View Profile
« Reply #12 on: September 18, 2008, 11:09:56 PM »

Quote
Be prepared for what you'll be getting into, then. C++ is relatively low-level and difficult as a first language. Understanding memory management and pointers is critical compared to modern high-level languages that hide pointers and garbage collect memory for you. In fact, I might recommend writing some Java, Python, or Ruby code first, just to get used to common aspects of programming, before diving into C++, which is rather more finicky.


I'm with Terry here I find c++ and java to be about the same level of complexity.  Let me clarify that a bit.  If you want to know absolutly everything about either java or c++ I'd say java is easier because c++ has all these crazy things thrown in but no one says you have to use any of them you can just write c code if you want.  I would say do c++ but don't bother learning about templates/anything that looks to crazy.

Also you can pretty much get away with ignoring memory managment for small games at least.  I mean as long as your not constantly creating variables it's pretty doable to do small arcade style games that don't really need it.  (ie just reuse all your variables instead of deleting/making new ones) and before people say this is bad programming style reusing objects is actually much faster then making new ones so there Smiley
Logged
Hajo
Level 5
*****

Dream Mechanic


View Profile
« Reply #13 on: September 18, 2008, 11:59:40 PM »

C++ has more traps for the unwary than Java has. But it should be possible to learn C++ as first language, and maybe that is even good, to learn every concept in depth than jumping in with knowledge from some other language and trying to adapt that.

The bigger question is, if one wants to use C++ for OOP, or rather procedural programming? It's both well possible in C++, but entirely different ways to tackle problems. If it's about OOP I'd suggest reading about OOD (object oriented design) first, and then start to practice C++ with that knowledge in mind.

I've been programming C for some years before trying C++, and I can tell the switch from procedural to OOP (thinking) is bigger than the syntax seems to tell.
Logged

Per aspera ad astra
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #14 on: September 19, 2008, 02:26:30 AM »

My advise is, don't dive right into C++. You'll only get a headache. If the language itself doesn't get to you, the whole hassle with compilers will.

First learn general programming. This is easy. Just use Game Maker for a while. Make one-script games. They resemble C++ programs in many ways.

You should familiarize yourself with how computers works. Writing a program for a computer, if you don't understand it, gets rather confusing. How memory works, what's a vblank, how files work, why source code is compiled, etc.

Myself I studied electrical engineering, including computers, for 2 years.
Logged
moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #15 on: September 19, 2008, 05:45:28 AM »

I recommend something like pascal of python to grasp the basics then something like C++ or Java to get more into OOP concepts.
Logged

subsystems   subsystems   subsystems
muku
Level 10
*****


View Profile
« Reply #16 on: September 19, 2008, 06:05:06 AM »

To save myself the trouble of typing it all out again, I'll just link to my rant against learning C++ as a first language. I do realize I go counter both Terry's and increpare's opinion on this issue, but keep in mind that Terry and increpare are both very smart people so their assessment might not hold for the merely averagely gifted Wink
Logged
increpare
Guest
« Reply #17 on: September 19, 2008, 06:32:57 AM »

To save myself the trouble of typing it all out again, I'll just link to my rant against learning C++ as a first language. I do realize I go counter both Terry's and increpare's opinion on this issue, but keep in mind that Terry and increpare are both very smart people so their assessment might not hold for the merely averagely gifted Wink
I've never actually used python for anything.  It looks nice, but I guess I don't have any need for it as a main programming language, and am still a bit scared of the whole idea of 'scripting languages'  tbh ...
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #18 on: September 19, 2008, 06:44:55 AM »

I get the impression that a lot of people who think C++ is hard to learn think that you have to start out using pointer, classes, and the other more advanced stuff. I spent at least a year programming in C++ without knowing the first thing about pointers and classes. In that time I just familiarized myself with simple things like input, output, and functions, which you're going to encounter in any other language anyway. Only after I was comfortable with the basics of the language did I start learning about the more advanced and low-level concepts (I didn't even start to use casting until after I have learned about pointers).
If you keep it simple, it should be just as easy to start with C++ as with any other language.
Logged
muku
Level 10
*****


View Profile
« Reply #19 on: September 19, 2008, 06:56:04 AM »

I've never actually used python for anything.  It looks nice, but I guess I don't have any need for it as a main programming language, and am still a bit scared of the whole idea of 'scripting languages'  tbh ...

Why so scared? Call them "dynamically typed bytecode-interpreted languages" if it helps? Wink But, in all seriousness, is it the dynamic typing or the performance that puts you off? Or something else? Large programs can be (and have been) written in Python, so I think calling it a scripting language isn't entirely accurate.

I do think having the right tool at hand for the right job is a good thing, and statically compiled languages aren't right for everything. But this is getting really off-topic since we're talking about learning to program here (and I stall stand by my opinion that C++ is bad for that).

As an aside: I probably come across as some sort of rabid Python preacher here, which I'm not; I use it quite sparingly at the moment. I just use it as an example since it's probably the most prominent dynamic language right now. I think Ruby or Lua would be equally good choices.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic