gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Usable parts of C++- help!! :)

#1913 - Saj - Sat Jan 25, 2003 5:55 pm

Hi, I've just set out to learn games programming. :)

I know a tiny bit of C but I only want to learn relevant parts of C++.

Here's a list of all the C++ elements.
which ones should I concentrate on for games programming?



    1. Making and Using Objects.
    The process of building programs using compilers and libraries.

    2. The C in C++.
    Features in C that are used in C++, as well as a number of basic features that are available only in C++.

    3. Data Abstraction.
    The ability to create new data types.
    laying the groundwork for more powerful OOP abilities.
    organizing code into header files and implementation files.

    4. Hiding the Implementation.
    separating the underlying implementation from the interface that the client programmer sees, and thus allow that implementation to be easily changed without affecting client code.

    5. Initialization and Cleanup.
    One of the most common C errors results from uninitialized variables. guaranteeing that variables of your new data type (?objects of your class?) will always be initialized properly.

    6. Function Overloading and Default Arguments.
    multiple libraries reuse the same function name.

    7. Constants.
    The const and volatile keywords, especially inside classes. how to create compile-time constants inside classes.

    8. Inline Functions.
    Preprocessor macros +benefits of a real function call.

    9. Name Control.
    Creation, visibility, placement of storage, and linkage. static keyword, classes namespace feature.

    10. References and the Copy-Constructor.
    C++ pointers handle addresses: lets the compiler handle the address manipulation while you use ordinary notation. +copy-constructor,pointer-to-member.

    11. Operator Overloading.
    Confusing uses of arguments, return types, and the decision of whether to make an operator a member or friend.

    12. Dynamic Object Creation.
    learning how C++?s new and delete elegantly solve this problem by safely creating objects on the heap.

    13. Inheritance and Composition.
    Data abstraction, creating new types from existing types.

    14. Polymorphism and virtual Functions.
    Manipulating objects in that family through their common base class.

    15. Templates.
    Inheritance and composition (reusing object code).




:) THANKS :)

PS: how many months/years will it take a relatively smart-guy to become a games programmer? and is assembly as complicated as this?!

#1931 - col - Sun Jan 26, 2003 4:48 am

Saj wrote:
Hi, I've just set out to learn games programming. :)

I know a tiny bit of C but I only want to learn relevant parts of C++.

Here's a list of all the C++ elements.
which ones should I concentrate on for games programming?

If you're going to do game programming - especially on a low power system like gba, you'll need to know your programming language inside out :)
Of the features that you've listed, You won't understand the advanced ones until you learn the simpler stuff. And you won't _really_ understand the simpler stuff until you've begun to grasp the advanced stuff :)
As you get to know the language, you will find your own style and use certain language features more and others less. At the end of the day, the more of the language that you truly understand, the better a programmer you'll be...Theres no point trying to make decisions about leaving stuff out before you've even started :)


Saj wrote:
PS: how many months/years will it take a relatively smart-guy to become a games programmer? and is assembly as complicated as this?!


That depends on how many hours you can devote per day, and on how strong your enthusiasm is - you should/will never stop learning, but you can make a simple game within a few months if you're a fast learner.

Assembly is very simple and very pure.
The thing is that its more difficult to describe a complex engineering problem - like a game - in a such a simple language.
All the 'complexities' of c++ are there to make it easier to describe the system that you are implementing.

which is easier?
...
ldr r1, [r6, r4, lsr#5]
tst r1, r11
andeq r1, r1, r3
beq r7
...

or

if(keypress() == buttonA){
player1->fireWeapon;
}

(ok so these aren't _real_, but i'm sure you get my point)
Assembly is ideal for simple things that must be repeated thousands of times - like processing samples in an audio mixer, you can optimise the hell out of them, without losing your way...

learn c++ (the whole thing MWaahahahaha)
learn asm (when you absolutely have to because you *know* c++ isnt fast enoughfor a specific task - asm can also help you with debugging)

good luck and ENJOY ;-)

cheers

col.

#1944 - Saj - Sun Jan 26, 2003 12:07 pm

WOW!

Thanks for giving me such an excellent answer, you've pretty much covered everything there!!

I'll try to put in at a couple of hours a day and be as dedicated as you guys.

Thanks again.