Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
Games industry requires C++. Skynesey learnt Java (stupud University) So how should I go about learning C++? what should I be striving to accomplish to begin with? 'cout "hello worlds"'? Or something else? Any good resources or books? |
||
CPUFreak91![]() Member Posts: 2337 From: Registered: 02-01-2005 |
quote: Well for one, your syntax is wrong
www.cprogramming.com -- nice resource. http://cppreference.com/ -- You might find it useful, I have. http://kgptech.blogspot.com/2005/07/cc_112128559089023869.html -- Lots of links there ------------------ "Oh, bother," said the Borg. "We've assimilated Pooh." Open source, open mind. My Programming and Hacker/Geek related Blog [This message has been edited by CPUFreak91 (edited September 27, 2007).] |
||
steveth45![]() Member Posts: 536 From: Eugene, OR, USA Registered: 08-10-2005 |
quote: So is yours. ![]()
I'd say, get a C++ textbook. As long as it's fairly recent and not a "C++ in 24 hours" or "idiot's guide" kind of book, it should be pretty good. Start by reading through the Wikipedia page on C++ which covers the history and the major language features so you know what you are getting into. ------------------ |
||
CPUFreak91![]() Member Posts: 2337 From: Registered: 02-01-2005 |
quote: Oops. ------------------ "Oh, bother," said the Borg. "We've assimilated Pooh." Open source, open mind. |
||
SSquared![]() Member Posts: 654 From: Pacific Northwest Registered: 03-22-2005 |
So is...oh, nevermind. ![]() Skynes, don't be too hard on your education on Java. Learning any language is good and will be that much easier to learn a new one. A lot of syntax is similar across languages (for loops, if statements, etc.) and learning Java should mean you have an understanding of OO concepts. These factors alone should really help in learning C++. One of your big issues will be learning about memory management. Where Java cleaned up all of your memory for you using garbage collection, C++ requires the developer to delete memory when it is no longer needed. |
||
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
I knew my syntax was wrong :P I'll look at those sites thanks. As for books what of the C++ for Games ones? Or is general C++ better to focus on? |
||
steveth45![]() Member Posts: 536 From: Eugene, OR, USA Registered: 08-10-2005 |
quote: My experience with "general" game programming books is that they tend to focus on particular API's, instead of game programming in general. I'd stick with the straight C++ books. You can learn all you need to about particular API's from the 'net. ------------------ |
||
leet hacker![]() Member Posts: 118 From: Hobbiton, Shire, Middle-Earth Registered: 07-30-2007 |
even though i don't know c++ (or any programming languages, for that matter ![]() ------------------ |
||
D-SIPL![]() Moderator Posts: 1345 From: Maesteg, Wales Registered: 07-21-2001 |
quote: Good advice. I would forget about game programming in C++ for now. Get the basics nailed first learn about functions, variable, data types, try looking into some statements like switch/case and then put together a little text based game to practice what you have learnt. Then look into OOP programming, check out classes etc and re-write your text based game applying what you have learnt from that. Once you have completed that, look into Win32 programming, initialization, message handling etc. I would say after that you will be ready to start some graphical game programming with C++. Maybe start with a library like SDL or Allegro and then move onto DirectX. During my Game Develoment Degree this is the route we have taken and it has worked really well. ------------------ |
||
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
OOP I know back to front. I do it naturally. To begin with I really need the structure of the language. things should be much simpler after that.
|
||
Calin![]() Member Posts: 358 From: Moldova Registered: 12-04-2006 |
Well if 'games industry' is what you're aiming at then you need to learn C++ . However if getting into games industry is not your #1 priority and you still want to make (/try to make) games then you can use C# for that. There's a number of engines (including free ones) that will let you do the programming of your games in C# (without the headache of writing your own wrapper ) ------------------ |
||
Mene-Mene![]() Member Posts: 1398 From: Fort Wayne, IN, USA Registered: 10-23-2006 |
So far I've like Thinking in C++. Its free, and pretty good. A bit difficult to understand for somethough. Google is your best friend. A couple other good stuff: http://www.programmingtutorials.com/cplusplus.aspx From what it looks like this is pretty good, can't tell you much first hand though. I've also been enjoying: Accelerated C++. by Andrew Koenig, and Barbara E. Moo. 12th printing October 2005. ------------------ |
||
CPUFreak91![]() Member Posts: 2337 From: Registered: 02-01-2005 |
quote: Some say C# is Microsoft's version of Java. You might be able to pick that up pretty quickly ------------------ "Oh, bother," said the Borg. "We've assimilated Pooh." Open source, open mind. |
||
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
Games Industry is what I'm aiming for. C# I know pretty well. |
||
samw3![]() Member Posts: 542 From: Toccoa, GA, USA Registered: 08-15-2006 |
I'd say if you just want to learn C++ syntax and best practices get a general book. Programming games, tho, is a distinct programming paradigm, similar to real-time systems or simulations. You probably won't find the patterns, algorithms, and best practices for game programming in a general C++ book. So, if you already got the game algorithms under your belt, just get a c++ book, otherwise you might want to pick up a good game algorithms book. Does anyone know of a book that details common game algorithms? One that could be helpful to anyone wanting to write games in any language? God Bless! ------------------ |
||
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
Here's what I've noticed so far. cout << is odd. I'll be ok with it, but it's different to what I'm used. cin.ignore will be a new addition. I've never given thought before to enter being a character and having to manually ignore it. If statements are the same as I know Strings are weird. I'm so used to a variable string that having to revert to an array of characters is very strange and will take getting used to. Struct and methods I'm mostly fine with. Except this declaring methods like you do variables. That's odd.
quote: ...was for. Research showed it to be including the standard library and the in out stream (the iostream I figured out on my own). So I'm content to include them |
||
samw3![]() Member Posts: 542 From: Toccoa, GA, USA Registered: 08-15-2006 |
quote: Think of these both as a single "import" statement in java. Java knows where to get the file to import based upon a standardized directory structure. C++ doesn't, so the #include statement includes a file (most of the time a header file) to be compiled with the current file. The "using" statement imports a namespace into the local context of the current file, kind of like "import" in java. Your program can function without it but you would have to type std::cout instead of just cout. (:: is the namespace resolver in c++) God Bless! ------------------ |
||
Mene-Mene![]() Member Posts: 1398 From: Fort Wayne, IN, USA Registered: 10-23-2006 |
I'll give you guys an example to further explain (don't peg me about my syntax please guys, I've not done C++ for a while, and I never was that good.) without using:
lotsa extra typing, this is good if you're using multiple namespaces I believe. With using:
------------------ [This message has been edited by Mene-Mene (edited October 02, 2007).] [This message has been edited by Mene-Mene (edited October 02, 2007).] [This message has been edited by Mene-Mene (edited October 02, 2007).] |
||
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
import is a good comparison. It's what I thought of it when I seen it. But didn't know WHAT I was importing did I did a little reading. | ||
supercoder![]() Member Posts: 37 From: Registered: 08-20-2007 |
http://www.cppgameprogramming.com hes simple code and demo code like toetactoe and pong baby steps u into allegro too. ------------------ |
||
Realm Master![]() Member Posts: 1971 From: USA Registered: 05-15-2005 |
okay, i'm late in getting to this topic so here's my quick advice: If you know java, your pratcially set. the languages are very similar (which could also pose as a problem... but not too much of one) You just have to get used to graphics librarys and stuff. there, I done. ------------------ |
||
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
http://www.cppgameprogramming.com/cgi/nav.cgi?page=index seems like a good site. But a few have said, he wants you to use the specific libraries and program he uses... >.< and for the life of me I can't figure out how on earth to get them to work. |
||
lghtngclp![]() Junior Member Posts: 3 From: Here Registered: 09-10-2007 |
Have you tried http://www.cplusplus.com/doc/tutorial/ ------------------ |
||
steveth45![]() Member Posts: 536 From: Eugene, OR, USA Registered: 08-10-2005 |
Since you know the fundamentals of OOP, you're in a good place for learning C++. There are just a few things you'll need to learn, really, like memory management fundamentals, the difference between pointers and references, header files, class construction, and some standard library API for good measure (all the std::cout business). I program all day in C++, and I rarely touch the standard library, it's really mostly useful as a tool for learning C++, and writing simple, console applications. The std::cout << "Hello World." example actually encompasses a number of difficult or obscure aspects of C++, as it relies on namespaces (the std namespace and :: symbol), static instances (cout), operator overloading (the << operator, which actually is a standard C++ operator for bit-shifting, re-purposed by the arcane standard library for streaming operations), and string literals (anything in quotes). Namespaces work like they do in Java, but use the double colon instead of the period. Operator overloading in C++ allows you to reuse common operators (+, =, ==, <<, >>, etc) as though they were calling methods (functions) of the associated objects. The flexibility of C++ allows for such alien looking constructions, but the standard library could have just as easily made it a normal function call, (std::cout.print("Hello, World.")) C++ was made to be powerful, not easy. ------------------ |