# C++ Help



## Prurient (Apr 2, 2010)

I have all the basics down.  I know all about the format, rules, and restrictions of making basic functions, and I wanted to know what would be best to learn next if I wanted to get into Game Development?  I know C++ isn't the best for Gaming, but I've already gone into it.


----------



## net-cat (Apr 2, 2010)

Prurient said:


> I know C++ isn't the best for Gaming


... since when?

I'd suggest learning the DirectX APIs next. I'd also give OpenGL a look, but let's face it. Most of the gaming world doesn't give a shit about cross-platform and uses DirectX.

A language that's a bit easier to work with is Python. It even has an interface to DirectX (DirectPython) and OpenGL (PyOpenGL.) (Though I've never tried either.) A good place to start to learn both APIs, but you'll find yourself having to get back into C/C++ in the long run.


----------



## Duality Jack (Apr 2, 2010)

C++ is FANTASTIC for gaming, just harder to get started in then some of the more easy languages (ex: Visual basic) but far less limiting once you get into it


----------



## ToeClaws (Apr 2, 2010)

Been 15 years since I last coded in C++, but yeah, as the others say - it's very good for gaming, or technically anything you want to do with it.  It's just a lot more manual.  Think my knowledge of it's a wee bit too much out of date to say anything more.


----------



## Fuzzy Alien (Apr 2, 2010)

Er, probably Java. I prefer C though; that is, if I was forced at gunpoint to program something.


----------



## Kitcat490 (Apr 2, 2010)

Fuzzy Alien said:


> Er, probably Java. I prefer C though; that is, if I was forced at gunpoint to program something.



C or C++ are better for games than Java, Java is slower because it runs in a virtual machine. Nothing against java, I am a java programmer, but it simply isn't for gaming.


----------



## Carenath (Apr 2, 2010)

OP Have a look into SDL (Simple DirectMedia Layer), 2D Boy (example code and framework) and IrrKlang (music).
There's also the XNA IDE if you have a 360 and Xbox Live account.

Another book you should try and get your paws on if you want to get to grips with C++ itself is, Accelerated C++ by Koenig and Moo


----------



## Th0r (Apr 2, 2010)

use SDL with OpenGL

or just openGL, as long as you arent using DX, it'll cause problems later(like if you ever want to make a mac port), plus GL is more widely used, and is the industry standard


----------



## mrfinnigan (Apr 3, 2010)

Th0r said:


> or just openGL, as long as you arent using DX, it'll cause problems later(like if you ever want to make a mac port), plus GL is more widely used, and is the industry standard


The term "industry standard" is synonymous to "most widely-used". In this instance, DirectX is the industry standard. This is primarily due to the Xbox and Xbox 360 having an optimized version of DirectX as its graphics base. OpenGL is the _open-source_ standard, but it's far from the gaming industry standard.


----------



## Carenath (Apr 3, 2010)

mrfinnigan said:


> The term "industry standard" is synonymous to "most widely-used". In this instance, DirectX is the industry standard. This is primarily due to the Xbox and Xbox 360 having an optimized version of DirectX as its graphics base. OpenGL is the _open-source_ standard, but it's far from the gaming industry standard.


DirectX was the "industry standard" since Windows 95, long before the Xbox was even an idea, for the same reason Internet Explorer retains the majority of market share (depending on your sources).


----------



## Rhetorica (Apr 3, 2010)

...without going into the details of why IE took over (outgunning the Netscape devs), that's a bit of an oversimplification.

BUT! Yes, C++ and DirectX are the way to go if you want to be part of the games  industry, but you should consider looking at OpenGL stuff too, because it's more portable. SDL is a bit of a pipe dream except for small budget 2D stuff.

There are a _lot_ of C++ game design tutorials; just look in Google's direction and you'll be bogged down with more than you can handle.

However, it also sounds like you're just getting into programming. It's important to understand that getting a firm grip on programming isn't something you can do overnight, and if you head straight into games programming without an appreciation of good code design and a lot of experience, the sheer amount of work required to make a modern game (even a small one!) will rapidly overpower you. The importance of practising skills with other kinds of programming first (from the humble command line utility to a reasonably-sized GUI application such as, say, Notepad) simply can't be overstated. Unless you go to university for it, where you'll do that anyway.

Don't listen to anyone who tells you that C++ is a less-than-ideal choice for game development, however. They probably either: (a) don't understand it or (b) have an emotional or ideological investment in their personal programming environment. (Suggesting Java is an fascinatingly stupid idea, for example.)

EDIT: Also, there will come a time in your life when you will start to get the impression that you need to learn assembly language in order to optimise your programs fully. That impression will be correct.


----------



## Carenath (Apr 4, 2010)

Rhetorica said:


> BUT! Yes, C++ and DirectX are the way to go if you want to be part of the games  industry, but you should consider looking at OpenGL stuff too, because it's more portable. SDL is a bit of a pipe dream except for small budget 2D stuff.
> 
> Don't listen to anyone who tells you that C++ is a less-than-ideal choice for game development, however. They probably either: (a) don't understand it or (b) have an emotional or ideological investment in their personal programming environment. (Suggesting Java is an fascinatingly stupid idea, for example.)
> 
> EDIT: Also, there will come a time in your life when you will start to get the impression that you need to learn assembly language in order to optimise your programs fully. That impression will be correct.


I put industry standard in quotes, because, it's not really an industry standard. It's commonly used, but, if you lock yourself into DirectX and just learn that, you'll fail as a games developer. The aim should be, to learn C++ and be capable of using other APIs as required. If you write a game for the Wii, or the Playstation, you won't be able to use DirectX. DirectX is fine for Windows and the XBox but nothing outside of that.

SDL is fine for learning, which is why I've directed him towards it, the journey of 1000 miles starts with a single step.

Java is utterly laughable and should really be considered a dead language, I still detest the fact that my university professors state it's the industry standard and push it out there instead of teaching C, C++, Perl, Ruby, Scheme or IASM. I would even argue that PHP makes a better web application language than Java in spite of it's glaring flaws and limitations.


----------



## Telnac (Apr 4, 2010)

I've been a professional game programmer for 14 years now, and a mastery of C++ is a _*must*_ if you want to get into game programming.  I use it every single day.  It doesn't matter if you're talking about user interface, AI, physics, engine code, special effects or tools, it all either is written in C++ or interfaces with the C++ code via some sort of API.  As a result, if you have a good working knowledge of C++ and no knowledge of anything else, you might still get hired on somewhere.  If you have a mastery of several APIs or scripting languages but a shaky knowledge of C++, you won't be hired anywhere... at least, not as a programmer.  You might get hired as a designer if you have a portfolio of levels you've designed for several games.  But designers make 1/2 the money as programmers, on average, and unlike programmers have no real hope of landing a job in a different industry if the game industry takes a giant dump (as it's doing now.)

Of course, ideally you should have both.  

As for languages other than C++...
Lua's a good scripting language to learn.  Java's actually not bad because it's similar to UnrealScript and it is used outside of the game industry quite a bit.  Contrary to what was said above, it's not a dead language.  I personally hate it because it's slow and hard to debug, but it is used as a scripting language.  

C# is a good language to learn if you're going to be writing development tools for artists & designers to use.  More and more, studios are going in that direction.  A lot of scripts these days aren't written in any language at all, but are completely visual, in much the same way a logic flow diagram looks.  Actions, entities and conditionals are drawn out for each state in a state machine.  Lines connecting them say how each state behaves, and what conditions must be met to move to another state.

Designers using such a system need not know any scripting language at all, but the programmer writing that tool is the one doing all the heavy lifting.  They need to have a mastery of both C#, C++ and whatever format is being used to store the data saved from that tool, most likely XML or something similar.

Oh, as for assembly, it's not critical but knowing how it works is a good idea.  That said, really, really good assembly programmers are worth their weight in _*gold!*_  There are few of them around anymore, because colleges no longer stress assembly and few programmers are willing to take the time to really learn how to optimize stuff line by line, but the ones that are still around are the highest paid programmers in the industry.


----------



## nrr (Apr 6, 2010)

Telnac said:


> Oh, as for assembly, it's not critical but knowing how it works is a good idea.  That said, really, really good assembly programmers are worth their weight in _*gold!*_



Assembly programmers who intimately know several ISAs outside x86 are worth the most.  Take it from me.


----------



## auzbuzzard (Apr 7, 2010)

Anyone knows Objective-C?

I know how to drag-and-drop buttons, but not ctrl-click them and writing some codes.

Is there a grammar for it?

Plz help...


----------



## nrr (Apr 10, 2010)

auzbuzzard said:


> Anyone knows Objective-C?
> 
> I know how to drag-and-drop buttons, but not ctrl-click them and writing some codes.



I know enough Obj-C to be dangerous, but I don't think it's what you're looking for here.  You're probably thinking of some of the magic that the Interface Builder does behind the scenes to wire up all of the message passing to make everything work.  There is no code authorship involved here, but it does imply that some will take place later.

That said, I'm not particularly certain that you're ready for Obj-C just from what you're asking here.  I would start off with something else a little more geared toward learning the fundamentals before you dive into an environment that gives you enough rope to shoot yourself in the foot.


----------

