## Recommended Posts

##### Share on other sites
Quote:
 Original post by goldenknight1. Should i study C ? (i skip it. Did i miss anything important in C that i can use for C++).

If you want to master C++, you will need to know C, since C++ is not separate from it.

Quote:
 Original post by goldenknight2. Is it impossible for me to study 2D and 3D?

Given enough time, why should it be impossible?

Quote:
 Original post by goldenknightPointers is so hard. I know they are only variables taht hold an address but it can get confusing for a beginner.

You can always switch to Java or C#. I would only study C++ if you actually want to work in the games industry (and are not aiming at mobile platforms or browser games).

Quote:
 Original post by goldenknight4. Is it worth it to study visual basic and C ? ( i been told by many progs that i should study C++ and Java only. Is it true guys?)

Visual Basic seems rather useless for games (I'm sure it's decent for application prototyping or simple applications). You'll need C to fully understand C++ but it's unlikely that you'll have to write a game in C these days. Generally you want to study programming, and not languages. The language doesn't matter as much as the algorithms, data structures, patterns, and paradigms.

##### Share on other sites
Quote:
 1. Should i study C ? (i skip it. Did i miss anything important in C that i can use for C++).

All of C's features are in C++, so if you can program in C++ then you can (give or take a few minor differences) then you can program in C. That is however only theoretically, because the way of structuring code and thinking is completely different in the two languages. I've however found that C projects are generally harder to maintain, and by looking at open source C projects I've also found that they're generally harder to understand. Therefore I'd suggest not learning C, for now. At worst, it will give you habits which might harm your C++ code.

Quote:
 2. Is it impossible for me to study 2D and 3D?

If you've only been learning programming for two weeks I think you should wait a bit. Make sure you've really grasped the basics first.

Quote:
 3. if it's possible, what books should i study ( please not hard books, my english is not very good, i read about 5 books about C++ and now i understand the basics, but i'm not satisfied. I want to study graphics to create 2D games). Please help me.

I recommend Beginning C++ Through Game Programming, 2nd Ed. by Michael Dawson. The first book was very good so I would expect the second edition to be even better.

Quote:
 Pointers is so hard. I know they are only variables taht hold an address but it can get confusing for a beginner.

Pointers are a surprisingly difficult subject to grasp, even if they're so simple. Luckily though, pointers should be used as seldomly as possible, because you should use references instead wherever possible. Read about them from many sources to get a wide picture of them, and give them some time and the whole concept of pointers will finally sink in.

Quote:
 4. Is it worth it to study visual basic and C ? ( i been told by many progs that i should study C++ and Java only. Is it true guys?)

It is not true that you should only learn C++ and Java. I would say that it would be easier to grasp C++ if you had a programming background with another language. Python, for instance, is an excellent choice if you want to get the hang of programming: it's simple and doesn't delve into the details too much. A flavor of basic is also a good method of understanding how programming really works.

It is always better to know more languages, because then you can always pick the one which fits your situation the best. C++ is not the ultimate super-language, since it has flaws as well as strengths. I suggest that you pick a simpler language and then move on to C++ again, noteworthily Python which I mentioned above.

##### Share on other sites
Thanks, you guys are very nice people. Can you give me another good books please.

##### Share on other sites
Thinking in C++ is available for free. I have not actually read it, but I did read Thinking in Java, by the same author, and it was very nice and clear and helped me learn Java originally, so I believe the author to be a competent writer.

##### Share on other sites
Ehm, i have another question. What is XML , do i need to study it to be able to write games? (sorry for this kind of "stupid" question).

I'm aiming at totally mastering C++ then try to use that language only. But some says that you can't write games for consoles using C++ (What i know from my books that i have read so far is that C# is like Java) So the question is, How hard, how long it takes to understand C++ thoroughly.

And let's say after i understand C++, how long it takes to understand directX?
all these times i only used consoled based program, not windows32 application.
What books should i read to understand the VERY BASIC about windows application and directx ? (and i mean total beginner books.)
Thanks

##### Share on other sites
Quote:
 What is XML , do i need to study it to be able to write games?

XML is a data interchange language/markup/format. Games existed before XML, so you can safely bet you don't need to study it [smile]. However, it is useful to know in general, and quite easy to learn. That said, I wouldn't bother learning it before I found a use for it.

Quote:
 (sorry for this kind of "stupid" question).

Don't be.

Quote:
 How hard, how long it takes to understand C++ thoroughly.

Years. You will get a "working knowledge" of C++ in less than a year, but you will trip yourself up from time to time because your simplified views of the language don't reflect what is actually going on. Also, your code will be hard to read and maintain unless you learn idiomatic C++.

This is my experience anyway, I had to relearn how to program in idiomatic C++. The sources I used didn't emphasise it at any rate. I also had to learn how to write large systems, which can take quite a while. The time you spend fighting with the language will mean you will probably produce less games in this period.

Even now, while I am very good with the language having used it for a number of years, I still learn new corner cases every few months.

Quote:
 And let's say after i understand C++, how long it takes to understand directX?

Personally, once you are good at C++ I would use an API like SDL to make 2D games. This will teach you a lot of stuff you need to learn about making games without some of the complexities DirectX introduces.

Quote:
 all these times i only used consoled based program, not windows32 application.

This is a good idea. Make sure you do all the exercises in any books you are using. They will give you lots of practical experience in problem solving: a vital skill in programming.

##### Share on other sites
Umm all links that you give are broken.

##### Share on other sites
XML is a language used to describe and structure data. It looks like this:
<Animals>  <Animal>    <Type>Dog</Type>    <Name>Peter</Name>  </Animal>  <Animal>    <Type>Cat</Type>    <Name>Helen</Name>  </Animal></Animals>

Programs then read this data and extract information from it, and it is widely used. Web pages are described in HTML, which is an XML-based language. You don't need to know it to program games, but like most technologies it's a useful addition to your knowledge base.

Mastering C++ is not easy. It will take you years to become good, and when you're good there's still plenty you won't know. It is not easy to give you a certain time figure on when you've learned C++ thoroughly, since it depends on the amount of energy you invest into learning it.

I have no books to recommend about graphics or Windows programming, but I still want to stress that it's important that you know the basics before starting with the more advanced stuff. Write some simple console games, gain some experience, then pursue graphics. You're being too hasty.

##### Share on other sites
Not hasty, it's just that all this time i could have learn C++, but no.... i need to learn poetry, culture, history. All these thing i learn from school aren't very useful. The only thing that i find useful and fun is math and how to read and write.(true story).

But let's not talk about me. Last question.
I'm in trouble learning operator overloading, i think it's from absolute C++. Can you guys give me an eagle eye of this topic . And if you would be kind please give me an eagle eye and hints to learn pointers. (very confusing this one, hard to remember this point to what. You know what i mean right?)

Thanks.

##### Share on other sites
Quote:
 Original post by goldenknightNot hasty, it's just that all this time i could have learn C++, but no.... i need to learn poetry, culture, history. All these thing i learn from school aren't very useful. The only thing that i find useful and fun is math and how to read and write.(true story).

These things are useful, in their own way.

Quote:
 I'm in trouble learning operator overloading, i think it's from absolute C++. Can you guys give me an eagle eye of this topic .

Operator overloading is one of those weird things that looks really weird and ugly when you write it, but makes the code using it less weird and ugly (if you do it right).

You should be familiar with std::cout by now. Consider what this means:
std::cout << "Hello " << playerName << ", how are you?" << '\n';

Here, we have a variable (std::cout) on the far left, and then a bitwise left shift operator, then a string literal, another variable, another bitwise left shift operator, and so on. These can't be actual bitwise shifts though, because these only have meaning for integral types.

What has happened is that std::cout (which is of type std::ostream) has overloads of "operator<<", which allow you to write string literals, integers, character literals, std::string instances and all manner of things to its stream.

Consider the alternative, using method calls (a fictional "output" function):
std::cout.output("Hello ");std::cout.output(playerName);std::cout.output(", how are you?");std::cout.output('\n');

This is several times longer.

The bitshift operator was chosen to replace such an "output" function because:
1) it has no real meaning for streams anyway
2) it looks a little like you are "sending" the right operand to the stream.

Aside from stream operations and an important corner case I will mention in a bit, operator overloading is rare enough in C++. Certain types, such as mathematical ones (games feature 2D or 3D vectors and also matrices) can benefit from their use.

The most imporant operator with regards to operator overloading it operator=. This is because if you create a type (using "struct" or "class", the two are nearly interchangeable) then if you do not overload operator=() then the compiler will do it for you. It will do the simplest thing, it calls the operator=() of all the members of the type.

This can result in problems if your class is in charge of a resource. Consider a "file" class, like std::fstream. It holds some kind of operating system file handle inside it. Such handles are usually primitive types, integers or pointers. Your file class probably obtains the handle in the constructor, and releases it in its destructor (an important C++ idiom called RAII).

However, if the compiler generated operator=() was used, it would create a copy of the raw file handle. This is bad. Consider if the copy now falls out of scope, its handle is released. However, this means that as far as the operating system is concerned, your program is finished with the file. So if the original tries to read or write to the file it will crash or an error will be generated. The proper thing for such RAII classes is to overload operator=() and do a "deep" copy of the data, or to suppress the compiler generated version (this is beyond the scope of this reply).

Quote:
 And if you would be kind please give me an eagle eye and hints to learn pointers. (very confusing this one, hard to remember this point to what. You know what i mean right?)

Pointers are used (and abused) in C++ for achieving a number of important language goals. They are used with arrays, they are used to pass things by reference, they are used to dynamically allocate memory and must be used to store polymorphic types and optional semantics.

You may not be familiar with some of the above terms. We use pointers with raw arrays because C++ does not allow us to directly pass arrays as arguments to functions. Nor does it allow us to allocate variable sized arrays.

Pass by reference means to pass data to a function without making a copy of that data. This can be used to prevent costly copy operations when they are unnecessary, and to allow a function to "write back" changes through its parameters.

Pointers are used with dynamically allocated memory because that the way C++ allows you to handle such memory. They are used for storing polymorphic types because the size of polymorphic types can (and usually will) vary, and C++ does not allow us to access variable sized data without using pointers or references (and references are often unsuitable for long term storage of data because they are not reseatable).

We use pointers for optional parameters. This means that the function tests the argument to see if it is NULL before using it.

Some of the features in C++ were introduced specifically to reduce the number of places where pointers are used. The C++ "reference" modifier is one such example. Pointers are a huge source of errors (hence the "abused" above) in programs, so idiomatic C++ tries to avoid using so called "raw" pointers except where absolutely necessary.

Replacements include using standard containers instead of raw arrays, C++ references for pass by reference, "smart" pointers (such as the boost libraries smart_ptr section) to manage dynamically allocated memory and polymorphic type storage, boost::optional<> for optional semantics. All of the above use pointers "under the hood", but in a controlled way that eliminates many of the opportunities for error.

The above is to give you an idea of why these things are used, they won't necessarily help you learn them.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628281
• Total Posts
2981804

• 9
• 10
• 11
• 17
• 14